Repeat

From LuaSTG Wiki
Jump to navigation Jump to search
Repeat
Taskrepeat.png
Repeat Icon
Location Task Tab

A Repeat node repeats the execution of a code segment by a specified number of times. Repeat is useful for looping tasks such as attacks or moving the boss that happen more than once. The execution of a repeat node can be stopped either when it finishes looping the specified number of times, or when it reaches a Break node or break statement in Lua code.


Table of Information[edit | edit source]

A list of parameters of a repeat node is shown below.

Repeat Options Function
Times (number) How many times the loop will repeat before it stops
Interval (in frames) (number) How many frames the Task will wait at the end of the loop (60 = one loop every 60 frames). This parameter is an integer. In LuaSTG Sharp this parameter is removed from the node
Number of Var (variable) Number of variables
Var X name (variable) The variable's name (E.g. x)
Var X init value (number) Initial value of the variable (E.g. 1)
Var X increment (number) Amount the variable is incremented by in each interval

In older versions to LuaSTG Sharp, Times was named Number of times. Number of Var was not an option of the repeat node. Instead, the editor has 4 varaibles slots that can be filled in or left blank.


Attention[edit | edit source]

Putting the repeat after a function will not allow it to loop.

Repeat node only repeats what's inside it, or its child nodes' execution. It does not repeat what comes in front of the node.


Example[edit | edit source]

Example of various ways you can use repeat:

RepeatExample.PNG


Repeat Node Versions: General and Task[edit | edit source]

In older versions of editor to LuaSTG Sharp, the repeat node under the General tab is different from the one under the Task tab. The former does not have an interval (task wait at the end of the loop) while the latter does. The one in task can only be put under a Task node, unlike the one under General. The one under General can be used in more general situations.