PrimalScript Add Intellisense for Custom Programs

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
drukamp
Posts: 42
Last visit: Fri May 12, 2023 8:36 am
Has voted: 1 time

PrimalScript Add Intellisense for Custom Programs

Post by drukamp »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build: PrimalScript 2017: 7.3.106
32 or 64 bit version of product: 64-bit
Operating system: Windows 10 (Build: 15063.540)
32 or 64 bit OS: 64-bit

I am trying to learn JavaScript by playing Screeps. I have the autocomplete scripts for the Screeps program. How to I import those scripts into PrimalScript so that it will autocomplete code as I type?
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: PrimalScript Add Intellisense for Custom Programs

Post by Alexander Riedel »

To be honest I am not sure. I have to look into what 'Screeps' actually is and how this thing works. Can you attach ONE of these scripts here?
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
drukamp
Posts: 42
Last visit: Fri May 12, 2023 8:36 am
Has voted: 1 time

Re: PrimalScript Add Intellisense for Custom Programs

Post by drukamp »

For starters, i cannot get intellisense/autocomplete working. By that i mean when i launch PrimalScript and open a .js file (which i have associated with JavaScript in the Language options), i cannot get console.log to be recognized. After i type the period after "console", i should get autocomplete options. One being "log". Once I get that solved, i will need to figure out how a add a custom library so i can use a *.d.ts file to use as a reference for custom intellisense/autocomplete.

Here is an example from the .t.ds file that i need to import:
/**
* This file is Screeps API description file.
* This might need some updates when Screeps publishes new features or changes it's existing API
*/
declare const OK: 0;
declare const ERR_NOT_OWNER: -1;
declare const ERR_NO_PATH: -2;
declare const ERR_NAME_EXISTS: -3;
declare const ERR_BUSY: -4;
declare const ERR_NOT_FOUND: -5;
declare const ERR_NOT_ENOUGH_RESOURCES: -6;
declare const ERR_NOT_ENOUGH_ENERGY: -6;
declare const ERR_INVALID_TARGET: -7;
declare const ERR_FULL: -8;
declare const ERR_NOT_IN_RANGE: -9;
declare const ERR_INVALID_ARGS: -10;
declare const ERR_TIRED: -11;
declare const ERR_NO_BODYPART: -12;
declare const ERR_NOT_ENOUGH_EXTENSIONS: -6;
declare const ERR_RCL_NOT_ENOUGH: -14;
declare const ERR_GCL_NOT_ENOUGH: -15;
declare const FIND_EXIT_TOP: 1;
declare const FIND_EXIT_RIGHT: 3;
declare const FIND_EXIT_BOTTOM: 5;
declare const FIND_EXIT_LEFT: 7;
declare const FIND_EXIT: 10;
declare const FIND_CREEPS: 101;
declare const FIND_MY_CREEPS: 102;
declare const FIND_HOSTILE_CREEPS: 103;
declare const FIND_SOURCES_ACTIVE: 104;
declare const FIND_SOURCES: 105;
declare const FIND_DROPPED_RESOURCES: 106;
declare const FIND_DROPPED_ENERGY: 106;
declare const FIND_STRUCTURES: 107;
declare const FIND_MY_STRUCTURES: 108;
declare const FIND_HOSTILE_STRUCTURES: 109;
declare const FIND_FLAGS: 110;
declare const FIND_CONSTRUCTION_SITES: 111;
declare const FIND_MY_SPAWNS: 112;
declare const FIND_HOSTILE_SPAWNS: 113;
declare const FIND_MY_CONSTRUCTION_SITES: 114;
declare const FIND_HOSTILE_CONSTRUCTION_SITES: 115;
declare const FIND_MINERALS: 116;
declare const FIND_NUKES: 117;
declare const TOP: 1;
declare const TOP_RIGHT: 2;
declare const RIGHT: 3;
declare const BOTTOM_RIGHT: 4;
declare const BOTTOM: 5;
declare const BOTTOM_LEFT: 6;
declare const LEFT: 7;
declare const TOP_LEFT: 8;
declare const COLOR_RED: 1;
declare const COLOR_PURPLE: 2;
declare const COLOR_BLUE: 3;
declare const COLOR_CYAN: 4;
declare const COLOR_GREEN: 5;
declare const COLOR_YELLOW: 6;
declare const COLOR_ORANGE: 7;
declare const COLOR_BROWN: 8;
declare const COLOR_GREY: 9;
declare const COLOR_WHITE: 10;
declare const COLORS_ALL: number[];
declare const CREEP_SPAWN_TIME: 3;
declare const CREEP_LIFE_TIME: 1500;
declare const CREEP_CLAIM_LIFE_TIME: 500;
declare const CREEP_CORPSE_RATE: 0.2;
declare const OBSTACLE_OBJECT_TYPES: string[];
declare const ENERGY_REGEN_TIME: 300;
declare const ENERGY_DECAY: 1000;
declare const REPAIR_COST: 0.01;
declare const RAMPART_DECAY_AMOUNT: 300;
declare const RAMPART_DECAY_TIME: 100;
declare const RAMPART_HITS: 1;
declare const RAMPART_HITS_MAX: {
2: 300000;
3: 1000000;
4: 3000000;
5: 10000000;
6: 30000000;
7: 100000000;
8: 300000000;
};
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: PrimalScript Add Intellisense for Custom Programs

Post by Alexander Riedel »

Console (or console.log) is not standard JavaScript object. It is likely part of a framework, like node.js, or part of another web API framework.
It would be important to know which framework is used.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
drukamp
Posts: 42
Last visit: Fri May 12, 2023 8:36 am
Has voted: 1 time

Re: PrimalScript Add Intellisense for Custom Programs

Post by drukamp »

Sorry... yes, i have node.js installed.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: PrimalScript Add Intellisense for Custom Programs

Post by Alexander Riedel »

Ok, I will look into that. This may take a day or five, with the holiday weekend.
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 6 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.