Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Ghoulboy78
Copy link
Contributor

Remake of the disaster that was #1415

@Ghoulboy78 Ghoulboy78 marked this pull request as draft August 5, 2022 08:21
@Ghoulboy78
Copy link
Contributor Author

Still have one thing to sort out here

@gnembon
Copy link
Owner

gnembon commented Aug 19, 2022

looking forward to it :)

@Ghoulboy78 Ghoulboy78 marked this pull request as ready for review June 30, 2023 12:35
@Ghoulboy78
Copy link
Contributor Author

Ready for review, almost a year later lol...

Copy link
Collaborator

@altrisi altrisi left a 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
Copy link
Collaborator

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.
Copy link
Collaborator

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:

Suggested change
Used with no arguments, return the list of all available sound names.
Used with no arguments, returns the list of all available sound names.

Copy link
Collaborator

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?

Comment on lines -94 to -98
* `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
Copy link
Collaborator

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.

Comment on lines +115 to +135
* `'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`
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While at it

Suggested change
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

Comment on lines +543 to +550
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>
Copy link
Collaborator

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()`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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'),
Copy link
Collaborator

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.

Suggested change
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)->(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
my_function(stuff)->(
my_function(stuff) -> (

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants