Generic Effects

Common effects included in Skript with simple behaviour.

Print

print %Object%
print "hello"
print 6 + 5
print {var}

This prints a value to the System.out print stream, seen by the system console. This is useful for command-line applications or for checking what the value of something is during testing.

When using ByteSkript as a DSL, there might be a better method of giving information to the user.

Wait For

wait [for] %Duration%
wait 1 second
wait for 50 milliseconds

This causes the executor to wait for the given duration before continuing. Code will continue running after the wait is completed.

In some executor models, timing control might be unavailable. For example, waits are not supported when running the verifier entry.

Sleep

(sleep|wait|pause)
wait
sleep

This causes the current executor to sleep indefinitely. This is a dangerous effect, since it requires another process to wake it up.

Another background process may wake the executor using the wake effect.

The process may occasionally wake without warning due to system upset, but this is a rare occurrence.

In some executor models, timing control might be unavailable. For example, sleeping is not supported when running the verifier entry.

Wake

wake %Thread%
wake {process}

This attempts to wake the executor of the provided process if it is currently sleeping.

This cannot be used to wake the current process - if it were sleeping the instruction would not run.

This will generally be used to wake up background processes, or in conjunction with the sleep effect to pause execution until something happens.

set {thread} to the current process
set {var} to a new runnable:
    print "doing something in the background"
    wait 10 seconds
    print "waking up the executor"
    wake {thread}
run {var} in the background // this runs in the background so it won't sleep
print "going to sleep"
sleep // halts until the wake instruction is called
print "somebody woke me up"

Last updated