-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating Scarpet docs for Auxiliary.md #1524
base: master
Are you sure you want to change the base?
Conversation
Still have one thing to sort out here |
looking forward to it :) |
Ready for review, almost a year later lol... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few comments, also personally I like lists to start with a leading space instead of zero but that's my preference (though it does cause a big diff that does nothing else).
Other than this I think it looks ok.
|
||
Used with no arguments, return the list of available sound names. | ||
|
||
and `voice`. `pos` can be either a block, triple of coords, or a list of thee numbers. Uses the same options as a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the number 3. However, isn't "a list of three numbers" already mentioned by "triple of coords"?
and `voice`. `pos` can be either a block, triple of coords, or a list of thee numbers. Uses the same options as a | ||
corresponding `playsound` command. Note that modifying `pitch` also modifies the duration of the sound. | ||
|
||
Used with no arguments, return the list of all available sound names. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're at it:
Used with no arguments, return the list of all available sound names. | |
Used with no arguments, returns the list of all available sound names. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually there's like lots like this, so maybe not/leave it for another one?
* `debug` - if True, it will only be visible when F3+B entity bounding boxes is enabled. | ||
* `facing` - applicable only to `'text'`, `'block'` or '`item'` shapes, where its facing. Possible options are: | ||
* `player`: Default. Element always rotates to face the player eye position, | ||
* `camera`: Element is placed on the plane orthogonal to player look vector, | ||
* `north`, `south`, `east`, `west`, `up`, `down`: obvious |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't have been removed, I think it's because they were added after the PR was started.
* `'label'` - draws a text in the world. Default `line` attribute controls main font color. | ||
`fill` controls the color of the background. | ||
* Required attributes: | ||
* `pos` - position | ||
* `text` - string or formatted text to display | ||
* Optional attributes | ||
* `value` - string or formatted text to display instead of the main `text`. `value` unlike `text` | ||
is not used to determine uniqueness of the drawn text so can be used to | ||
display smoothly dynamic elements where value of an element is constantly | ||
changing and updates to it are being sent from the server. | ||
* `size` - float. Default font size is 10. | ||
* `facing` - text direction, where its facing. Possible options are: `player` (default, text | ||
always rotates to face the player), `north`, `south`, `east`, `west`, `up`, `down` | ||
* `doublesided` - if `true` it will make the text visible from the back as well. Default is `false` (1.16+) | ||
* `align` - text alignment with regards to `pos`. Default is `center` (displayed text is | ||
centered with respect to `pos`), `left` (`pos` indicates beginning of text), and `right` (`pos` | ||
indicates the end of text). | ||
* `tilt`, `lean`, `turn` - additional rotations of the text on the canvas along all three axis | ||
* `indent`, `height`, `raise` - offsets for text rendering on X (`indent`), Y (`height`), and Z axis (`raise`) | ||
with regards to the plane of the text. One unit of these corresponds to 1 line spacing, which | ||
can be used to display multiple lines of text bound to the same `pos` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Label is already below, so this is pretty much a copy of the one below. One should be removed.
### `escape_nbt(expr)` | ||
|
||
Excapes all the special characters in the string or nbt tag and returns a string that can be stored in nbt directly | ||
Excapes all the special characters in the string or nbt tag and returns a string that can be stored in nbt directly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While at it
Excapes all the special characters in the string or nbt tag and returns a string that can be stored in nbt directly | |
Escapes all the special characters in the string or nbt tag and returns a string that can be stored in nbt directly |
You might want to put this in the `__on_close()->` function, so it gets called as the last thing, when you want to save | ||
the app's data. But to do that, your data must be NBT-compatible. | ||
|
||
<pre> | ||
__on_close()->( | ||
store_app_data(encode_nbt(global_app_data)) | ||
); | ||
</pre> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think this is automatic, though I don't really remember anymore and would have to check (though I've done similar in the past so I'm not really sure). (non-blocking)
themselves, so that's about it. | ||
|
||
### `tick_time()` | ||
|
||
Returns server tick counter. Can be used to run certain operations every n-th ticks, or to count in-game time. | ||
In order to run operations every n-th ticks, it's probably better to use `schedule()` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to run operations every n-th ticks, it's probably better to use `schedule()` | |
In order to run operations every n-th ticks, it's usually better to use `schedule()` |
<pre> | ||
global_timer = 20; //Doing something every second | ||
__on_tick()->( | ||
if(!(tick_time()%global_timer), //Inverting cos we want this to run when tick_time()%global_timer = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(!(tick_time()%global_timer), //Inverting cos we want this to run when tick_time()%global_timer = 0 | |
if(!(tick_time()%global_timer), //Inverting cos we want this to run when tick_time()%global_timer is 0 |
Or ==
, the one you prefer
and triggering the script in a 'proper' way (there is not 'proper' way, but via command line, or server chat is the most 'proper'), | ||
defining `__on_tick()` event handler, but in case you need to take a full control over the game loop and run some simulations using | ||
`game_tick()` as the way to advance the game progress, that might be the simplest way to do it, | ||
and triggering the script in a 'proper' way (there is not 'proper' way, but via commmand line, or server chat is the most 'proper'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already had the right amount of m.
and triggering the script in a 'proper' way (there is not 'proper' way, but via commmand line, or server chat is the most 'proper'), | |
and triggering the script in a 'proper' way (there is not 'proper' way, but via command line, or server chat is the most 'proper'), |
<pre> | ||
global_timer = 40; //Every 2 seconds | ||
|
||
my_function(stuff)->( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my_function(stuff)->( | |
my_function(stuff) -> ( |
Remake of the disaster that was #1415