current index

current index



Kode wheel segment Timing and Logic
Style Specialised
Modifiers None
Primarily WHEN/DO WHEN
Pre-made brains that use it unknown

Timing and Logic> current index


This tile is used to query a [for each of] loop. Every time a [for each of] loop occurs the current index increments by 1. So you can use current index to apply different kode for each time the loop runs, or in the case of an object set [for each of] loop, you can apply different kode to different objects in the set.

WHEN [for each of][all visible objects]

…WHEN [current index][equal to][1] DO [it][highlight][red]
…WHEN [current index][equal to][2] DO [it][highlight][green]

You can also use current index to pick a random object from a set by creating a random number generator, and applying kode to the current index that matches that number.

WHEN DO [numvar:random number][=][random number][1][to][all visible objects][count][as integer]

WHEN [for each of][all visible objects]

…WHEN [current index][equal to][random number] DO [objvar:my random object][=][it]


Example Code

See above



Other Uses

Comments are closed.

Website Powered by

Up ↑

%d bloggers like this: