SkLectern

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Kiip

Staff member
Supporter
Jan 21, 2019
8
1
3
Netherlands
EARLY PREVIEW, BUG TESTING ONLY
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.

Macros
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:
Code:
command /test:
  trigger:
   chance!(broadcast "hi", 0.5)

macro chance!(statement, chance):
  if chance of $chance:
   $statement
With as result:
Code:
command /test:
  trigger:
   if chance of 0.5:
     broadcast "hi"
Structures are also supported:
Code:
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
With as result:
Code:
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