Scripting: Difference between revisions

For loops/Delay
No edit summary
(For loops/Delay)
Line 224: Line 224:
{{HeaderNoTOC|Stop animation}}
{{HeaderNoTOC|Stop animation}}
<code>an</code>
<code>an</code>
==Wait/Delay==
{{HeaderNoTOC|Wait for a certain amount of time}}
<code>. 5</code> waits for 5 seconds before running more of the code.
{{HeaderNoTOC|Wait until action is finished}}
<code>.</code> simply waits until an action like walking, fading, or other things are completed. This is a great way to ensure you finish moving to a location.
==Repeat/For Loop==
For loops allow you to repeat sections multiple times. <code>[ <number></code> begins a for loop and <code>]</code> ends it with all code between being repeated multiple times.
As an example <code>[ 5</code> followed by some code and <code>]</code> afterwards would run code 5 times. See the below example.
<nowiki>
[ 5
mv forward
. 2
]</nowiki>
This allows the script runner to move forward and pause for 2 seconds for a total of 5 times.
62

edits