Patch Release 2.12.2
Skript 2.12.2
Today, we are releasing Skript 2.12.2 to continue resolving issues reported with 2.12.
As always, you can report any issues on our issue tracker.
Happy Skripting!
Changelog
Bug Fixes
- #8077 Fixes an issue where using entities with the second 'play effect' pattern was not possible.
- #8098 Implements type-aware function parsing to fix issues where function calls could not be parsed as the correct functions.
- #8109 Fixes an issue where the 'loop value' expression sometimes failed to evaluate when used with other expressions.
- #8135 Fixes issues with function parsing related to loading and having singular default values.
- #8151 Removes an errant colon in the examples for the fire resistance effect.
- #8164 Fixes an exception being thrown for some uses of the
%classinfo% inputexpression. - #8147 Fixes a bug where an
elsesection was considered delayed due to a delay in itsifsection. - #8171 Fixes parsing order issue with
reversed 2 timesby only allowing plural inputs toreversed %objects%.
API/Development
- #8041 Exposes
BukkitUtils#getRegistryClassInfo()to assist with creating types backed by Bukkit or Paper registries. - #8121 Allows null inputs to
Direction.combine(). - #8132 Loosens generics for
EntryDataExpressionfromTto? extends Tto allow for subtypes for the default values. - #8145 Prioritizes Skript syntaxes before addon-provided syntaxes when ordering syntaxes of the same priority.
- #8154 Ensures the possible return types for
ExpressionListare accurate after use ofgetConvertedExpression(). - #8158 Makes
SectionContextandSectionContext#modify()public for addon use.
Click here to view the full list of commits made since 2.12.1
Notices
Experimental Features
Experimental features can be used to enable syntax and other behavior on a per-script basis. Some of these features are new proposals that we are testing while others may have unsafe or complex elements that regular users may not need.
While we have tested the available experiments to the best of our ability, they are they are still in development. As a result, they are subject to change and may contain bugs. Experiments should be used at your own discretion.
Additionally, example scripts demonstrating usage of the available experiments can be found here.
Click to reveal the experiments available in this release
For-Each Loop
Enable by adding using for loops to your script.
A new kind of loop syntax that stores the loop index and value in variables for convenience.
This can be used to avoid confusion when nesting multiple loops inside each other.
for {_index}, {_value} in {my list::*}:
broadcast "%{_index}%: %{_value}%"
for each {_player} in all players:
send "Hello %{_player}%!" to {_player}
All existing loop features are also available in this section.
Queue
Enable by adding using queues to your script.
A collection that removes elements whenever they are requested.
This is useful for processing tasks or keeping track of things that need to happen only once.
set {queue} to a new queue of "hello" and "world"
broadcast the first element of {queue}
# "hello" is now removed
broadcast the first element of {queue}
# "world" is now removed
# queue is empty
set {queue} to a new queue of all players
set {player 1} to a random element out of {queue}
set {player 2} to a random element out of {queue}
# players 1 and 2 are guaranteed to be distinct
Queues can be looped over like a regular list.
Script Reflection
Enable by adding using script reflection to your script.
This feature includes:
- The ability to reference a script in code.
- Finding and running functions by name.
- Reading configuration files and values.
Local Variable Type Hints
Enable by adding using type hints to your script.
Local variable type hints enable Skript to understand what kind of values your local variables will hold at parse time. Consider the following example:
set {_a} to 5
set {_b} to "some string"
... do stuff ...
set {_c} to {_a} in lowercase # oops i used the wrong variablePreviously, the code above would parse without issue. However, Skript now understands that when it is used, {_a} could only be a number (and not a text). Thus, the code above would now error with a message about mismatched types.
Please note that this feature is currently only supported by simple local variables. A simple local variable is one whose name does not contain any expressions:
{_var} # can use type hints
{_var::%player's name%} # can't use type hintsRuntime Error Catching
Enable by adding using error catching to your script.
A new catch [run[ ]time] error[s] section allows you to catch and suppress runtime errors within it and access them later with [the] last caught [run[ ]time] errors.
catch runtime errors:
...
set worldborder center of {_border} to {_my unsafe location}
...
if last caught runtime errors contains "Your location can't have a NaN value as one of its components":
set worldborder center of {_border} to location(0, 0, 0)Damage Sources
Enable by adding using damage sources to your script.
Note that
typehas been removed as an option for the 'damage cause' expression asdamage causeanddamage typenow refer to different things.
Damage sources are a more advanced and detailed version of damage causes. Damage sources include information such as the type of damage, the location where the damage originated from, the entity that directly caused the damage, and more.
Below is an example of what damaging using custom damage sources looks like:
damage all players by 5 using a custom damage source:
set the damage type to magic
set the causing entity to {_player}
set the direct entity to {_arrow}
set the damage location to location(0, 0, 10)For more details about the syntax, visit damage source on our documentation website.
Join us on Discord
We have an official Discord community where we share announcements and and perform testing for upcoming features.
Thank You
Special thanks to the contributors whose work was included in this version:
- @Absolutionism
- @APickledWalrus
- @arpita2525 ⭐ First contribution! ⭐
- @JakeGBLP
- @sovdeeth
- @TheLimeGlass
As always, if you encounter any issues or have some minor suggestions, please report them at https://github.com/SkriptLang/Skript/issues.
If you have any bigger ideas or input for the future of Skript, you can share those too at https://github.com/SkriptLang/Skript/discussions.