Pre-Release 2.12.0-pre1 #7991
APickledWalrus
started this conversation in
General
Replies: 1 comment
-
|
Looking forward! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Skript 2.12.0-pre1
Today, we are excited to celebrate the beginning of the second half of the year with a new Skript pre-release! Skript 2.12.0-pre1 is now available! This release includes dozens of new features and bug fixes, along with early support for 1.21.6/7.
Below, you can familiarize yourself with the changes. Additionally, by clicking here, you can view the list of new syntax on our documentation site. As always, report any issues to our issues page!
Per our release model, we plan to release 2.12.0 on July 15th. We may release additional pre-releases before then should the need arise.
We would also like to welcome a new addition to the team, @Absolutionism!
Happy Skripting!
Major Changes
Ephemeral Variables
Ephemeral variables (or ram vars, or memory vars) are now fully implemented by default for all users. These are global variables that are not saved between restarts. To make a variable ephemeral, add a hyphen (
-) to the start of its name:{-var}. These variables are about 2.5x faster to change compared to normal global variables. You do not need to do anything to enable them.Function Overloading
Note
The
script reflectionexperiment, which includes syntax for dynamically referencing and executing functions, does not yet support working with overloaded functions.Function overloading enables creating functions that have the same name but different parameters types/parameter counts.
function send_welcome(p: player): send_welcome({_p}, false) function send_welcome(p: player, first_time: boolean): if {_first_time} is true: send "Welcome to our server for the first time, %name of {_p}%!" to {_p} else: send "Welcome back to our server, %name of {_p}%!" to {_p}Local Variable Type Hints (Experimental)
Note
This feature is currently experimental and can be used by enabling the
type hintsexperiment.Local variable type hints enable Skript to understand what kind of values your local variables will hold at parse time. Consider the following example:
Previously, 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 (Experimental)
Note
This feature is currently experimental and can be used by enabling the
error catchingexperiment.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 (Experimental)
Note
This feature is currently experimental and can be used by enabling the
damage sourcesexperiment.Caution
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:
For more details about the syntax, visit damage source on our documentation website.
Contributing Updates
We are now allowing contributors to release their code contributions under the more-permissive MIT License. For more information, please review our LICENSING.md file.
⚠ Breaking Changes
index of "a" in "b", values that do not appear in the second string will now returnnoneinstead of the previous-1.is enchanted withcondition now looks for exact levels instead of the specified level or better. Old behavior can be replicated withif {_item} is enchanted with sharpness 2 or better. Some examples:amount of {a::*}, "b", it was before parsed as(amount of {a::*}), "b", but it is now parsed asamount of ({a::*}, "b"). Use parentheses as necessary to clarify your intent.beaconis now a required keyword for therangeandtierexpressions.remove allchanger for the 'custom model data' expression has been removed. It functioned the same asremove.headhas been removed as an option for the 'player skull' expression ashead of playerconflicts with the 'head location' expression.typehas been removed as an option for the 'damage cause' expression asdamage causeanddamage typenow refer to different things.world.RegistryParser#getAllNameshas been removed in favor ofRegistryParser#getCombinedPatterns(from thePatternedParserinterface).sincedocumentation field have changed on SkriptEventInfo:SkriptEventInfo#getSince() (String) -> SkriptEventInfo#getSince() (String[])BukkitSyntaxInfos.Event.since() (String) -> BukkitSyntaxInfos.Event.since() (Collection<String>)BukkitSyntaxInfos.Event.Builder.since(String) -> BukkitSyntaxInfos.Event.Builder.addSince(String)Changelog
Additions
-) which are cleared when the server restarts.alongas an option in the 'push' effect:push player along vector(1,1,1) at speed 3.remove allchanger support has been removed.arg-1could be misinterpreted as(arg) - 1.event-entity typeevent value for entity related events.1.23E4,10e-10) to numbers.amount of {a::*}, "b", it was before parsed as(amount of {a::*}), "b", but it is now parsed asamount of ({a::*}, "b"). Use parentheses as necessary to clarify your intent.Changes
noneinstead of-1.rangeandtierexpressions now requirebeaconin their syntax.or betterandor worseadded as newly available comparison options.aliasesfolder will now be created automatically so that users know where to place custom aliases.Bug Fixes
event-itemin a 'craft' event often returnedairdue to the recipe being complex.raid omeneffect was incorrectly given the aliasbad omen.orlists.if sharpness 1, efficiency 3, and knockback 2 contains sharpness.next/previous'loop-value' could fail to reset in-between loops.API Changes
sincedocumentation field. Some methods have had their signatures changed and addons using them will need to be updated.RegistryParser#getAllNamesmethod withRegistryParser#getCombinedPatterns(from thePatternedParserinterface).Expression#possibleReturnTypes()andExpression#canReturn().headhas been removed as an option for theplayer skullexpression.Typegeneric parameter in theAnyContainsinterface.PropertyCondition.#isSectionOnly()method in SectionExpression allowing the ability to check if it requires a Section.Click here to view the full list of commits made since 2.11.2
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 loopsto 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.
All existing loop features are also available in this section.
Queue
Enable by adding
using queuesto 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.
Queues can be looped over like a regular list.
Script Reflection
Enable by adding
using script reflectionto your script.This feature includes:
Local Variable Type Hints
Enable by adding
using type hintsto 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:
Previously, 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 catchingto 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 sourcesto your script.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:
For more details about the syntax, visit damage source on our documentation website.
Help Us Test
We have an official Discord community for beta testing Skript's new features and releases.
Thank You
Special thanks to the contributors whose work was included in this version:
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.
This discussion was created from the release Pre-Release 2.12.0-pre1.
Beta Was this translation helpful? Give feedback.
All reactions