docs fixes
This commit is contained in:
1 parent
3f9556f9aa
commit
78ee80248b
2 files changed
+14
-10
No files matched your search
@@ -62,7 +62,7 @@ or an OVERLY complex example:
|
|||||||
or simply
|
or simply
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
/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')
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
It definitely pays to check what higher level `scarpet` functions have to offer.
|
It definitely pays to check what higher level `scarpet` functions have to offer.
|
||||||
@@ -112,16 +112,17 @@ Or rather:
|
|||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
if
|
if
|
||||||
(
|
( x<y+6,
|
||||||
x<y+6,
|
|
||||||
(
|
(
|
||||||
set(x,8+y,z,'air');
|
set(x,8+y,z,'air');
|
||||||
plop(x,top('surface',x,z),z,'birch')
|
plop(x,top('surface',x,z),z,'birch')
|
||||||
),
|
),
|
||||||
|
// else if
|
||||||
sin(query(player(),'yaw'))>0.5,
|
sin(query(player(),'yaw'))>0.5,
|
||||||
(
|
(
|
||||||
plop(0,0,0,'boulder')
|
plop(0,0,0,'boulder')
|
||||||
),
|
),
|
||||||
|
// else
|
||||||
particle('fire',x,y,z)
|
particle('fire',x,y,z)
|
||||||
)
|
)
|
||||||
</pre>
|
</pre>
|
||||||
@@ -134,8 +135,10 @@ have problems with them
|
|||||||
## Functions and scoping
|
## Functions and scoping
|
||||||
|
|
||||||
Users can define functions in the form `fun(args....) -> expression` and they are compiled and saved for further
|
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,
|
execution in this, but also subsequent calls of /script command, added to events, etc. Functions can also be
|
||||||
passed as arguments, called with `call` function, but in most cases you would want to call them directly by
|
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
|
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,
|
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
|
and those are all which name starts with 'global_', and local variables which is everything else and those
|
||||||
|
|||||||
@@ -51,10 +51,10 @@ number('2')+number('2') => 4
|
|||||||
Returns a formatted string representing expression. Accepts formatting style accepted by `String.format`.
|
Returns a formatted string representing expression. Accepts formatting style accepted by `String.format`.
|
||||||
Supported types (with `"%?"` syntax):
|
Supported types (with `"%?"` syntax):
|
||||||
|
|
||||||
* d, o, x: integers
|
* `d`, `o`, `x`: integers, octal, hex
|
||||||
* a, e, f, g: floats
|
* `a`, `e`, `f`, `g`: floats
|
||||||
* b: booleans
|
* `b`: booleans
|
||||||
* s: strings
|
* `s`: strings
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
str(null) => null
|
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
|
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
|
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
|
(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
|
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
|
instance `join_task()` at all from the main script and server thread, because any use of Minecraft specific
|
||||||
|
|||||||
Reference in new issue
Block a user