added system_info, deprecated seed
This commit is contained in:
1 parent
6f0faf991a
commit
239aa9e143
7 files changed
+258
-11
No files matched your search
+55
-6
@@ -309,8 +309,10 @@ block positions. All variables starting with `_` are read-only, and cannot be de
|
||||
|
||||
`scarpet` accepts numeric and string liters constants. Numbers look like `1, 2.5, -3e-7, 0xff,` and are internally
|
||||
represented primarily as Java's `double` but `scarpet` will try to trim trailing zeros as much as possible so if you
|
||||
need to use them as integers or even longs - you can. However any operation on a number even if it can be properly
|
||||
represented as long, but not a double type, will make them round up to be doubles.
|
||||
need to use them as integers or even longs - you can. Long values will also not loose their long precision in addition,
|
||||
subtraction, negation and multiplication, however any other operation that is not guaranteed to return a long value
|
||||
(like division) on a number even if it can be properly
|
||||
represented as long, will make them convert to doubles.
|
||||
|
||||
Strings use single quoting, for multiple reasons, but primarily to allow for
|
||||
easier use of strings inside doubly quoted command arguments (when passing a script as a parameter of `/script fill`
|
||||
@@ -3356,7 +3358,7 @@ stack at slot. Returns previous stack in that slot.
|
||||
<pre>
|
||||
inventory_set(player(), 0, 0) => ['stone', 64, {}] // player had a stack of stone in first hotbar slot
|
||||
inventory_set(player(), 0, 6) => ['diamond', 64, {}] // changed stack of diamonds in player slot to 6
|
||||
inventory_set(player(), 0, 1, 'diamond_axe','{Damage:5}') => null //added slightly damaged pick to first player slot
|
||||
inventory_set(player(), 0, 1, 'diamond_axe','{Damage:5}') => null //added slightly damaged diamond axe to first player slot
|
||||
</pre>
|
||||
|
||||
### `inventory_find(inventory, item, start_slot?, ), inventory_find(inventory, null, start_slot?)`
|
||||
@@ -4015,9 +4017,10 @@ loop(1000,game_tick()) // runs the game as fast as it can for 1000 ticks
|
||||
loop(1000,game_tick(100)) // runs the game twice as slow for 1000 ticks
|
||||
</pre>
|
||||
|
||||
### `seed()`
|
||||
|
||||
Returns current world seed.
|
||||
### `seed()` deprecated
|
||||
|
||||
Returns current world seed. Function is deprecated, use `system_info('world_seed')` insteads.
|
||||
|
||||
### `current_dimension()`
|
||||
|
||||
@@ -4064,7 +4067,53 @@ The call will return `null` if the statistics options are incorrect, or player d
|
||||
If the player encountered the statistic, or game created for him empty one, it will return a number.
|
||||
Scarpet will not affect the entries of the statistics, even if it is just creating empty ones. With `null` response
|
||||
it could either mean your input is wrong, or statistic effectively has a value of `0`.
|
||||
# `/script run` command
|
||||
|
||||
|
||||
### `system_info()`, `system_info(property)`
|
||||
Fetches the value of a system property or returns all inforation as a map when called without any arguments. It can be used to
|
||||
fetch various information, mostly not changing, or only available via low level
|
||||
system calls. In all cirumstances, these are only provided as read-only.
|
||||
|
||||
Available options in the scarpet app space:
|
||||
* `app_name` - current app name or `null` if its a default app
|
||||
* `app_list` - list of all loaded apps excluding default commandline app
|
||||
* `app_scope` - scope of the global variables and function. Available options is `player` and `global`
|
||||
* `app_player` - returns a player list that have app run under them. For `global` apps, the list is always empty
|
||||
|
||||
Relevant world related properties
|
||||
* `world_name` - name of the world
|
||||
* `world_seed` - a numeric seed of the world
|
||||
* `world_path` - full path to the world saves folder
|
||||
* `world_folder` - name of the direct folder in the saves that holds world files
|
||||
|
||||
Relevant gameplay related properties
|
||||
* `game_difficulty` - current difficulty of the game: `'peacefu'`, `'easy'`, `'normal'`, or `'hard'`
|
||||
* `game_hardcore` - boolean whether the game is in hardcore mode
|
||||
* `game_storage_format` - format of the world save files, either `'McRegion'` or `'Anvil'`
|
||||
* `game_default_gamemode` - default gamemode for new players
|
||||
* `game_max_players` - max allowed players when joining the world
|
||||
* `game_view_distance` - the view distance
|
||||
* `game_mod_name` - the name of the base mod. Expect `'fabric'`
|
||||
* `game_version` - base version of the game
|
||||
|
||||
Server related properties
|
||||
|
||||
* `server_motd` - the motd of the server visible when joining
|
||||
* `server_ip` - IP adress of the game hosted
|
||||
* `server_whitelisted` - boolean indicating whether the access to the server is only for whitelisted players
|
||||
* `server_whitelist` - list of players allowed to log in
|
||||
* `server_banned_players` - list of banned player names
|
||||
* `server_banned_ips` - list of banned IP addresses
|
||||
|
||||
System related properties
|
||||
* `java_max_memory` - maximum allowed memory accessible by JVM
|
||||
* `java_allocated_memory` - currently allocated memory by JVM
|
||||
* `java_used_memory` - currently used memory by JVM
|
||||
* `java_cpu_count` - number of processors
|
||||
* `java_version` - version of Java
|
||||
* `java_bits` - number indicating how many bits the Java has, 32 or 64
|
||||
* `java_system_cpu_load` - current percentage of CPU used by the system
|
||||
* `java_process_cpu_load` - current percentage of CPU used by JVM# `/script run` command
|
||||
|
||||
Primary way to input commands. The command executes in the context, position, and dimension of the executing player,
|
||||
commandblock, etc... The command receives 4 variables, `x`, `y`, `z` and `p` indicating position and
|
||||
|
||||
@@ -401,9 +401,10 @@ loop(1000,game_tick()) // runs the game as fast as it can for 1000 ticks
|
||||
loop(1000,game_tick(100)) // runs the game twice as slow for 1000 ticks
|
||||
</pre>
|
||||
|
||||
### `seed()`
|
||||
|
||||
Returns current world seed.
|
||||
### `seed()` deprecated
|
||||
|
||||
Returns current world seed. Function is deprecated, use `system_info('world_seed')` insteads.
|
||||
|
||||
### `current_dimension()`
|
||||
|
||||
@@ -450,3 +451,50 @@ The call will return `null` if the statistics options are incorrect, or player d
|
||||
If the player encountered the statistic, or game created for him empty one, it will return a number.
|
||||
Scarpet will not affect the entries of the statistics, even if it is just creating empty ones. With `null` response
|
||||
it could either mean your input is wrong, or statistic effectively has a value of `0`.
|
||||
|
||||
|
||||
### `system_info()`, `system_info(property)`
|
||||
Fetches the value of a system property or returns all inforation as a map when called without any arguments. It can be used to
|
||||
fetch various information, mostly not changing, or only available via low level
|
||||
system calls. In all cirumstances, these are only provided as read-only.
|
||||
|
||||
Available options in the scarpet app space:
|
||||
* `app_name` - current app name or `null` if its a default app
|
||||
* `app_list` - list of all loaded apps excluding default commandline app
|
||||
* `app_scope` - scope of the global variables and function. Available options is `player` and `global`
|
||||
* `app_player` - returns a player list that have app run under them. For `global` apps, the list is always empty
|
||||
|
||||
Relevant world related properties
|
||||
* `world_name` - name of the world
|
||||
* `world_seed` - a numeric seed of the world
|
||||
* `world_path` - full path to the world saves folder
|
||||
* `world_folder` - name of the direct folder in the saves that holds world files
|
||||
|
||||
Relevant gameplay related properties
|
||||
* `game_difficulty` - current difficulty of the game: `'peacefu'`, `'easy'`, `'normal'`, or `'hard'`
|
||||
* `game_hardcore` - boolean whether the game is in hardcore mode
|
||||
* `game_storage_format` - format of the world save files, either `'McRegion'` or `'Anvil'`
|
||||
* `game_default_gamemode` - default gamemode for new players
|
||||
* `game_max_players` - max allowed players when joining the world
|
||||
* `game_view_distance` - the view distance
|
||||
* `game_mod_name` - the name of the base mod. Expect `'fabric'`
|
||||
* `game_version` - base version of the game
|
||||
|
||||
Server related properties
|
||||
|
||||
* `server_motd` - the motd of the server visible when joining
|
||||
* `server_ip` - IP adress of the game hosted
|
||||
* `server_whitelisted` - boolean indicating whether the access to the server is only for whitelisted players
|
||||
* `server_whitelist` - list of players allowed to log in
|
||||
* `server_banned_players` - list of banned player names
|
||||
* `server_banned_ips` - list of banned IP addresses
|
||||
|
||||
System related properties
|
||||
* `java_max_memory` - maximum allowed memory accessible by JVM
|
||||
* `java_allocated_memory` - currently allocated memory by JVM
|
||||
* `java_used_memory` - currently used memory by JVM
|
||||
* `java_cpu_count` - number of processors
|
||||
* `java_version` - version of Java
|
||||
* `java_bits` - number indicating how many bits the Java has, 32 or 64
|
||||
* `java_system_cpu_load` - current percentage of CPU used by the system
|
||||
* `java_process_cpu_load` - current percentage of CPU used by JVM
|
||||
@@ -83,7 +83,6 @@ scoreboard_add
|
||||
scoreboard_remove
|
||||
scoreboard_display
|
||||
see_sky
|
||||
seed
|
||||
set
|
||||
set_biome
|
||||
set_poi
|
||||
@@ -100,6 +99,7 @@ structures
|
||||
structure_eligibility
|
||||
structure_references
|
||||
suffocates
|
||||
system_info
|
||||
tick_time
|
||||
ticks_randomly
|
||||
top
|
||||
|
||||
@@ -68,9 +68,9 @@
|
||||
|
||||
scan volume neighbours rect diamond
|
||||
|
||||
format logger sound particle particle_line particle_rect
|
||||
format logger sound particle particle_line particle_rect system_info
|
||||
|
||||
run save tick_time world_time day_time last_tick_times game_tick seed current_dimension in_dimension view_distance
|
||||
run save tick_time world_time day_time last_tick_times game_tick current_dimension in_dimension view_distance
|
||||
|
||||
plop harvest destroy schedule nbt draw_shape create_marker remove_all_markers
|
||||
|
||||
|
||||
Reference in new issue
Block a user