Effects
Line instructions.
Effects are the bread and butter of Skript code. Every code-line is an effect. Effects do not return or give back any kind of value, and are entirely self-contained on a single line.
Effects are like verbs or actions - instructions to do something.
Most effects require some sort of input from expressions. Effects may be placed only in entries.

Language Rules

  1. 1.
    Effects must begin with an absolute phase, usually some sort of verb or action (run..., set..., delete...).
  2. 2.
    Effects may never begin with an input.

Compilation

Most effects will be compiled to simple bytecode operations (such as invoke calls.)
Compilation should generally be done on the second compile pass when all expression data has been loaded onto the stack. States may be altered on the first preCompile pass where necessary.
Be careful not to leave any garbage on the stack after the effect passes - all effects should leave the stack as it was to maintain symmetry for programmatic jumps.
An example is given below.
Skript Source
Instruction Assembly
Bytecode Compilation
1
run my_func(1, 2, {foo})
2
return true
Copied!
1
push1
2
push 2
3
loadObject foo
4
invokeStatic "my_func"
5
pop // pops the result of the invocation to empty stack
6
push1
7
returnSmall
Copied!
1
iconst_1
2
bipush 2
3
aload 0
4
invokestatic 'my_func'
5
pop
6
iconst_1
7
ireturn
Copied!
Copy link