@lostcityrs/runescript 0.9.2 → 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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021-2026 Joshua Filby and other contributors.
3
+ Copyright (c) 2023-2026 Lost City
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright 2021-present Joshua Filby and other contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the “Software”), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -2,6 +2,74 @@
2
2
  <h1>RuneScriptTS</h1>
3
3
  </div>
4
4
 
5
- A fork of [Neptune](https://github.com/neptune-ps/neptune) (a project undertaking modern OSRS), this project is instead entirely RuneScript-focused.
5
+ This is a **RuneScript Compiler**, written in TypeScript. Our focus is to preserve RS2 history as accurately and authentically as we can.
6
6
 
7
- This is a work-in-progress effort to port [this](https://github.com/LostCityRS/RuneScriptKt) to run in TypeScript, and the upstream repo will be sunsetted in favor of this.
7
+ ### Installation and Usage
8
+
9
+ `npm i @lostcityrs/runescript`
10
+ (or yarn, bun, pnpm...)
11
+
12
+ ```ts
13
+ import { CompileServerScript, CompilerTypeInfo } from '@lostcityrs/runescript';
14
+
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
+ });
33
+ ```
34
+
35
+ The compiler expects a couple things to be in place.
36
+
37
+ 1. A source folder that contains `.rs2` scripts.
38
+ 2. Symbol information provided for the types you plan on referencing.
39
+
40
+ By default it will read scripts from `../content/scripts`.
41
+ After it runs, compiled output will be placed in `./data/pack/server`.
42
+ If that doesn't work for your use case, please see the config object you pass to CompileServerScript.
43
+
44
+ See [LostCityRS/Server](https://github.com/LostCityRS/Server) for a working example.
45
+
46
+ ### Building RuneScriptTS
47
+
48
+ After cloning:
49
+ ```sh
50
+ bun i
51
+ bun run antlr
52
+ ```
53
+
54
+ Testing:
55
+ You can test changes without publishing by copying `dist/runescript.js` into your consumer's node_modules folder
56
+ ```sh
57
+ bun run build
58
+ cp dist/runescript.* ../node_modules/@lostcityrs/runescript/dist/
59
+ ```
60
+
61
+ ### History
62
+
63
+ Originally a fork of [Neptune](https://github.com/neptune-ps/neptune)'s script compiler.
64
+ Our initial compiler fork (2023-2026) focused instead on making a complete server script compiler, along with a script runtime and world simulation:
65
+ https://github.com/LostCityRS/RuneScriptKt
66
+ https://github.com/LostCityRS/Engine-TS
67
+
68
+ As of February 2026 we have transitioned from the "legacy" Kotlin codebase to this TypeScript codebase (clean port).
69
+ Consumers should use this. It is production-ready and produces compatible output along with some bug fixes.
70
+
71
+ ### Credits
72
+
73
+ Polar: For your years of work on Neptune and many days brainstorming together.
74
+ Flenarn: For your effort porting so much Kotlin code to TypeScript. There were only a few lines to fix afterwards - great job.
75
+ Contributions in RuneScriptKt: Henke96 [PR #1](https://github.com/LostCityRS/RuneScriptKt/pull/1) and Bea5 [PR #2](https://github.com/LostCityRS/RuneScriptKt/pull/1).
@@ -1,3 +1,35 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export declare function CompileServerScript(): void;
3
+
4
+ export declare function CompileServerScript(config?: {
5
+ sourcePaths?: string[];
6
+ symbols?: Record<string, CompilerTypeInfo>;
7
+ excludePaths?: string[];
8
+ checkPointers?: boolean;
9
+ writer?: {
10
+ jag?: {
11
+ output: string;
12
+ };
13
+ js5?: {
14
+ output: string;
15
+ };
16
+ };
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
+ };