diff --git a/docs/scarpet/language/Overview.md b/docs/scarpet/language/Overview.md index a63629da..0689740f 100644 --- a/docs/scarpet/language/Overview.md +++ b/docs/scarpet/language/Overview.md @@ -62,7 +62,7 @@ or an OVERLY complex example: or simply
-/script run print('There is'+for(rect(x,9,z,8,8,8), _ == 'diamond_ore')+' diamond ore around you')
+/script run print('There is '+for(rect(x,9,z,8,8,8), _ == 'diamond_ore')+' diamond ore around you')
It definitely pays to check what higher level `scarpet` functions have to offer.
@@ -112,16 +112,17 @@ Or rather:
if
-(
- x<y+6,
+( x<y+6,
(
set(x,8+y,z,'air');
plop(x,top('surface',x,z),z,'birch')
),
+ // else if
sin(query(player(),'yaw'))>0.5,
(
plop(0,0,0,'boulder')
),
+ // else
particle('fire',x,y,z)
)
@@ -134,8 +135,10 @@ have problems with them
## Functions and scoping
Users can define functions in the form `fun(args....) -> expression` and they are compiled and saved for further
-execution in this but also subsequent calls of /script command. Functions can also be assigned to variables,
-passed as arguments, called with `call` function, but in most cases you would want to call them directly by
+execution in this, but also subsequent calls of /script command, added to events, etc. Functions can also be
+ assigned to variables,
+passed as arguments, called with `call('fun', args...)` function, but in most cases you would want to
+call them directly by
name, in the form of `fun(args...)`. This means that once defined functions are saved with the world for
further use. For variables, there are two types of them, global - which are shared anywhere in the code,
and those are all which name starts with 'global_', and local variables which is everything else and those
diff --git a/docs/scarpet/language/SystemFunctions.md b/docs/scarpet/language/SystemFunctions.md
index 502a3c63..e25b48ba 100644
--- a/docs/scarpet/language/SystemFunctions.md
+++ b/docs/scarpet/language/SystemFunctions.md
@@ -51,10 +51,10 @@ number('2')+number('2') => 4
Returns a formatted string representing expression. Accepts formatting style accepted by `String.format`.
Supported types (with `"%?"` syntax):
-* d, o, x: integers
-* a, e, f, g: floats
-* b: booleans
-* s: strings
+* `d`, `o`, `x`: integers, octal, hex
+* `a`, `e`, `f`, `g`: floats
+* `b`: booleans
+* `s`: strings
str(null) => null @@ -81,7 +81,8 @@ the off-tick time in between ticks that didn't take 50ms. There are however bene like fine time control not relying on the tick clock, or running things independent on each other. You can still run your actions on tick-by-tick basis, either taking control of the execution using `game_tick()` API function (nasty solution), or scheduling tick using `schedule()` function (much nicer solution), but threading often gives -the neatest solution to solve problems in parallel (see scarpet camera). +the neatest solution to solve problems in parallel +(see [scarpet camera](/src/main/resources/assets/carpet/scripts/camera.sc)). Due to limitations with the game, there are some limits to the threading as well. You cannot for instance `join_task()` at all from the main script and server thread, because any use of Minecraft specific