Skip to main content

Handler Loop

The following methods, presented below, handle the repetition of a specified code at defined intervals without interruption.

Parameters

ParameterDescription
everyInterval in milliseconds for code execution (default 60000)
codeThe command code to be executed in the loop

Example

Available Features

Within loop commands, the following functions are available:

  • $break - halt the loop command.
  • $continue - skip the current iteration.
  • $index - returns the number of times the loop has been executed so far.
<AoiClient>.loopCommand({
every: 5000,
code: `
$if[$index==5]
$break
$else
$print[Current index: $index]
$endif
`
})

<AoiClient>.loopCommand({
every: 5000,
code: `
$if[$index==5]
$continue
$else
$print[Current index: $index]
$endif
`
})