81 lines
1.9 KiB
Markdown
81 lines
1.9 KiB
Markdown
# IScriptEvent.setValue
|
|
|
|
[← IScriptEvent](index.md) · [← Master](../../wiki.md)
|
|
|
|
Parça 2/3 · [önceki](setValue.md) · [sonraki](setValue-3.md)
|
|
|
|
scheduleScript
|
|
|
|
default void scheduleScript(int delay)
|
|
|
|
Schedule execution of the same script (with same function) given ticks forward.
|
|
|
|
Read scheduleScript(String, String, int) for more information.
|
|
|
|
function main(c)
|
|
{
|
|
var states = c.getServer().getStates();
|
|
var counter = states.getNumber("counter");
|
|
|
|
if (counter < 10)
|
|
{
|
|
c.send(counter + " Mississippi...");
|
|
states.add("counter", 1);
|
|
|
|
c.scheduleScript(20);
|
|
}
|
|
else
|
|
{
|
|
states.reset("counter");
|
|
c.send("Here I go!");
|
|
}
|
|
}
|
|
|
|
|
|
Parameters:
|
|
delay - How many ticks should pass before scheduled script will be executed.
|
|
|
|
scheduleScript
|
|
|
|
default void scheduleScript(java.lang.String function,
|
|
int delay)
|
|
|
|
Schedule execution of the same script with given function given ticks forward.
|
|
|
|
Read scheduleScript(String, String, int) for more information.
|
|
|
|
|
|
|
|
function main(c)
|
|
{
|
|
// Schedule script execution of function other
|
|
// within same script a second later
|
|
c.scheduleScript("other", 20);
|
|
}
|
|
|
|
function other(c)
|
|
{
|
|
c.send("A second ago, function \"main\" told me to say \"hi\" to you... :)")
|
|
}
|
|
|
|
|
|
scheduleScript
|
|
|
|
void scheduleScript(java.lang.String script,
|
|
java.lang.String function,
|
|
int delay)
|
|
|
|
Schedule execution of given script with specific function given ticks forward.
|
|
|
|
When scheduling a script, it will use same data which were passed into current script's function. I.e.
|
|
subject, object, world, server and values.
|
|
|
|
ProTip: if you put some values into this context using setValue(String, Object), then that value will be also
|
|
available when the scheduled script will be executed.
|
|
|
|
// Script "a"
|
|
function main(c)
|
|
{
|
|
// As ProTip states, you can pass some value using
|
|
// setValue() and getValue() event's functions
|