REPORT BUGS HERE
Supercharge your scripts with various new language features and performance gains, transpiling right into Skript code.
Please do note that this is just a proof of concept, and the result is by no means production grade.
This language feature is similar to Skript options, it gets searched and replaced before execution like options, but allows arguments like functions. The benefit of macros is that they don't have a performance impact unlike functions, and it allows for syntax elements to be passed as argument. Please do note that parsing times may increase, and your scripts can become quite large when transpiled. Use with caution and optimize the macro body.
Macros need to end with a ! and unlike functions they don't have types for arguments.
The syntax to use macros is as follows:
command /test: trigger: chance!(broadcast "hi", 0.5) macro chance!(statement, chance): if chance of $chance: $statement
command /test: trigger: if chance of 0.5: broadcast "hi"
item!(dirt, 5 seconds) item!(stone, 10 seconds) structure macro item!(item, cooldown): command /$item: cooldown: $cooldown cooldown message: &cWait a little longer before getting another item! trigger: give $item to player
command /dirt: cooldown: 5 seconds cooldown message: &cWait a little longer before getting another item! trigger: give dirt to player command /stone: cooldown: 10 seconds cooldown message: &cWait a little longer before getting another item! trigger: give stone to player
Simple arithmetic like 3 + 2 gets simplified into 5.
This allows you to write more clear code without worrying about performance.