diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index deb9d57e..f3abbba6 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -2958,7 +2958,7 @@ public class CarpetExpression this.expr.addLazyFunction("store_app_data", -1, (c, t, lv) -> { if (lv.size() == 0) - throw new InternalExpressionException("'store_app_data' needs nbt tag and optional file"); + throw new InternalExpressionException("'store_app_data' needs NBT tag and an optional file"); Value val = lv.get(0).evalValue(c); String file = null; if (lv.size()>1) @@ -3165,7 +3165,7 @@ public class CarpetExpression } /** - *

/script load / unload <module> (shared?), /script in <module> commands

+ *

/script load / unload <app> (global?), /script in <app> commands

*
*

load / unload commands allow for very conventient way of writing your code, providing it to the game * and distribute with your worlds without the need of use of commandblocks. Just place your scarpet code in the /scripts @@ -3181,13 +3181,15 @@ public class CarpetExpression * // baz = foo() * *

- *

/script load/unload <module> (?shared)

+ *

/script load/unload <app> (?global)

*

Loading operation will load that script code from disk and execute it right away. You would probably use it to * load some stored procedures to be used for later. To reload the module, just type /script load again. * Reloading removes all the current global state (globals and functions) that were added later by the module.

*

Loading a module, if it contains a __command() method, will attempt to registed a command with that - * module name, and register all public (no underscore) functions available in the module as subcommands. It will also + * app name, and register all public (no underscore) functions available in the module as subcommands. It will also * bind specific events to the event system (check Events section for details).

+ *

Loaded apps have the ability to store and load external files, especially their persistent tag state. + * For that check load_app_data and store_app_data functions.

*

If an app defines __config method, and that method returns a map, it will be used to apply custom * settings for this app. Currently the following options are supported:

* - *

Unloading a module removes all of its state from the game, disables commands, and removes bounded events

- *

Scripts can be loaded in shared and player mode. Default is player, so all globals and stored functions are + *

Unloading an app removes all of its state from the game, disables commands, and removes bounded events

+ *

Scripts can be loaded in shared(global) and player mode. Default is player, so all globals and stored functions are * individual for each player, meaning scripts don't need to worry about making sure they store some intermittent data - * for each player independently. In shared mode - all global values and stored functions are shared among all players. - * To access specific player data with commandblocks, use /execute as (player) run script in (module) run ... + * for each player independently. In global mode - all global values and stored functions are shared among all players. + * To access specific player data with commandblocks, use /execute as (player) run script in (app) run ... * To access global/server state, you need to disown the command from any player, so use a commandblock, or any arbitrary * entity: /execute as @e[type=bat,limit=1] run script in (module) globals for instance. *

- *

/script in <module> ...

- *

Allows to run normal /script commands in a specific module, like run, invoke,..., globals etc...

+ *

/script in <app> ...

+ *

Allows to run normal /script commands in a specific app, like run, invoke,..., globals etc...

*
*/ public void loadScriptsFromFilesCommand() diff --git a/src/main/java/carpet/script/Expression.java b/src/main/java/carpet/script/Expression.java index 0cab3df3..89994ce3 100644 --- a/src/main/java/carpet/script/Expression.java +++ b/src/main/java/carpet/script/Expression.java @@ -51,7 +51,7 @@ import static java.lang.Math.min; /** - *

Fundamental components of scarpet programming language (towards upcoming version 1.5).

+ *

Fundamental components of scarpet programming language (version 1.5).

* *

Scarpet (a.k.a. Carpet Script, or Script for Carpet) is a programming language designed to provide * the ability to write custom programs to run within Minecraft and @@ -205,10 +205,10 @@ import static java.lang.Math.min; * *

Code delivery, line indicators

*

Note that this should only apply to pasting your code to execute with commandblock. Scarpet recommends placing your - * code in packages (files with .sc extension that can be placed inside "/scripts" folder in the world files - * and loaded as a module with command /script load [package_name]. Scarpet modules loaded from disk should only + * code in apps (files with .sc extension that can be placed inside "/scripts" folder in the world files + * and loaded as a scarpet app with command /script load [app_name]. Scarpet apps loaded from disk should only * contain code, no need to start with "/script run" prefix

- *

The following is the code that could be provided in a foo.sc file located in world /scripts folder

+ *

The following is the code that could be provided in a foo.sc app file located in world /scripts folder

* *
  * run_program() -> (