@lostcityrs/runescript 0.9.3 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,28 +10,38 @@ This is a **RuneScript Compiler**, written in TypeScript. Our focus is to preser
10
10
  (or yarn, bun, pnpm...)
11
11
 
12
12
  ```ts
13
- import { CompileServerScript } from '@lostcityrs/runescript';
13
+ import { CompileServerScript, CompilerTypeInfo } from '@lostcityrs/runescript';
14
14
 
15
- CompileServerScript();
15
+ // opcode->command lookup + pointer info
16
+ const commandInfo: CompilerTypeInfo = ...;
17
+
18
+ // script id->name lookup
19
+ const runescriptInfo: CompilerTypeInfo = ...;
20
+
21
+ // config id->name lookup
22
+ const npcInfo: CompilerTypeInfo = ...;
23
+
24
+ CompileServerScript({
25
+ symbols: {
26
+ 'command': commandInfo,
27
+ 'runescript': runescriptInfo,
28
+
29
+ 'npc': npcInfo,
30
+ ...
31
+ }
32
+ });
16
33
  ```
17
34
 
18
35
  The compiler expects a couple things to be in place.
19
36
 
20
37
  1. A source folder that contains `.rs2` scripts.
21
- 2. ".sym" files containing ID->name maps in tsv-format (tab-separated values):
22
- ```tsv
23
- 0 p11_full
24
- 1 p12_full
25
- 2 b12_full
26
- 3 q8_full
27
- ```
28
- There must be a sym file for every config type you reference in your scripts.
38
+ 2. Symbol information provided for the types you plan on referencing.
29
39
 
30
- By default it will read scripts from `../content/scripts` and symbols from `./data/symbols`.
40
+ By default it will read scripts from `../content/scripts`.
31
41
  After it runs, compiled output will be placed in `./data/pack/server`.
32
- If that doesn't work for your use case, there is a config object you can pass to CompileServerScript. There is a .d.ts file included that describes the structure.
42
+ If that doesn't work for your use case, please see the config object you pass to CompileServerScript.
33
43
 
34
- See [LostCityRS/Server](https://github.com/LostCityRS/Server) for a working example of everything if you aren't using that already.
44
+ See [LostCityRS/Server](https://github.com/LostCityRS/Server) for a working example.
35
45
 
36
46
  ### Building RuneScriptTS
37
47
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  export declare function CompileServerScript(config?: {
5
5
  sourcePaths?: string[];
6
- symbolPaths?: string[];
6
+ symbols?: Record<string, CompilerTypeInfo>;
7
7
  excludePaths?: string[];
8
8
  checkPointers?: boolean;
9
9
  writer?: {
@@ -15,3 +15,21 @@ export declare function CompileServerScript(config?: {
15
15
  };
16
16
  };
17
17
  }): void;
18
+
19
+ export declare type CompilerTypeInfo = {
20
+ max: number;
21
+ map: Record<string, string>;
22
+
23
+ // info for some configs
24
+ vartype: Record<string, string>;
25
+ protect: Record<string, boolean>;
26
+
27
+ // info for commands only
28
+ require: Record<string, string>;
29
+ require2: Record<string, string>;
30
+ conditional: Record<string, boolean>;
31
+ set: Record<string, string>;
32
+ set2: Record<string, string>;
33
+ corrupt: Record<string, string>;
34
+ corrupt2: Record<string, string>;
35
+ };