In order to detect properties of specific clones. a variety of lists and local variables need to be used. Local variables are duplicated with a clone's properties, but a sprite cannot detect an individual clone's local variable's value. However, a clone can detect a sprite, which can therefore send a message to trigger the sprite's scripts. In order for a sprite to detect the properties of a clone, the clone must use lists in order to "communicate" with the sprite.

For the following scripts, assume the following:

  • (clones) — a global variable used to count how many clones have been created.
  • (clone id) — a local variable duplicated with the clone that represents what clone number in chronological order of creation it is.
  • (quantities::list) — a list used to store the wanted value for each clone.
  • Sprite1 — the sprite which creates the clones

These following scripts would go in Sprite1:

when gf clicked
delete [all v] of [quantities v]
set [clones v] to (0)

When creating a clone of Sprite1, use the following script in Sprite1:

add [] to [quantities v]
change [clones v] by (1)
create clone of (myself v)

If the desired value is a reporter, use this script in Sprite1:

when I start as a clone
set [clone id v] to (clones)
forever
replace item (clone id) of [quantities v] with (. . .::grey reporter)

Then (item (x) of [quantities v]) will return the quantity for the clone with the clone ID x.

If the desired value is a boolean, use this script in Sprite1:

when I start as a clone
set [clone id v] to (clones)
forever
replace item (clone id) of [quantities v] with <. . .::grey boolean>

Then <(item (x) of [quantities v]) = [true]> will return the quantity for the clone with the clone ID x.

See Also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.