diff --git a/CHANGELOG.md b/CHANGELOG.md index adc83dd..d763503 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,24 @@ +### 0.7.2 - Nov 4, 2021 + +- add `ONMISSION` variable that can be used to manipulate the global player's on a mission status + +```js +if (!ONMISSION) { + showTextBox("Not on a mission. Setting ONMISSION to true"); + ONMISSION = true; +} +``` + +#### BREAKING CHANGE + +- using `new` operator on a static object (for which Sanny Builder Library does not define a constructor, e.g. `Audio` or `Hud`) now throws an error: + +```js + var hud = new Hud(); // error: Hud is not constructable +``` + +- minimum required version of `sa.json` is `0.166` + ### 0.7.1 - Nov 02, 2021 - new static function `Memory.Translate` to get memory address of a function or variable by its name (see [documentation](using-memory.md#finding-memory-addresses-in-re3-and-revc)) diff --git a/README.md b/README.md index 1919f19..e864aa4 100644 --- a/README.md +++ b/README.md @@ -193,7 +193,7 @@ When JavaScript is enabled CLEO Redux needs commands definitions from https://li Minimum required version of the commands definitions: * `gta3.json`: `0.99` * `vc.json`: `0.143` - * `sa.json`: `0.164` + * `sa.json`: `0.166` ### Script Lifecycle @@ -306,6 +306,28 @@ if (GAME === "sa") { } ``` +- `ONMISSION` - global flag controlling whether the player is on a mission now. + +```js +if (!ONMISSION) { + showTextBox("Not on a mission. Setting ONMISSION to true"); + ONMISSION = true; +} +``` + +- `TIMERA` and `TIMERB` - two auto-incrementing timers useful for measuring time intervals. + +```js +while(true) { + TIMERA = 0; + // wait 1000 ms + while(TIMERA < 1000) { + wait(0) + } + showTextBox("1 second passed") +} +``` + - `log(...values)` - prints comma-separated `{values}` to the `cleo_redux.log` ```js @@ -328,10 +350,14 @@ while (true) { showTextBox("Hello, world!"); ``` -- family of static methods in the `Memory` class for manipulating different data types. See the [Memory guide](using-memory.md) for more information. - - `exit(reason?)` - terminates the script immediately. `exit` function accepts an optional string argument that will be added to the `cleo_redux.log`. +```js + exit("Script ended"); +``` + +- family of static methods in the `Memory` class for manipulating different data types. See the [Memory guide](using-memory.md) for more information. + ### Deprecated Note: usage of the following commands is not recommended. diff --git a/examples/free_resprays[mem].js b/examples/free_resprays[mem].js index d15717a..248d658 100644 --- a/examples/free_resprays[mem].js +++ b/examples/free_resprays[mem].js @@ -6,6 +6,7 @@ if (GAME !== "re3" && GAME !== "reVC") { wait(1000); var addr = Memory.Translate("CGarages::RespraysAreFree"); -Memory.WriteU8(addr, 1, 0); - -showTextBox("Resprays are free now!"); +if (addr) { + Memory.WriteU8(addr, true, false); + showTextBox("Resprays are free now!"); +} diff --git a/website/index.html b/website/index.html index 56e6fc7..d69adad 100644 --- a/website/index.html +++ b/website/index.html @@ -97,7 +97,7 @@