Author Topic: Event Loops  (Read 441 times)

Just want a list that has the different kinds of event loops.


Single Brick


Relay Loop:
Code: [Select]
X 33ms onActivate   Self   fireRelay
X 33ms onRelay   Self   fireRelay
X 0ms onRelay   -do stuff-
A relay is fired upon itself, which triggers onRelay. Basic loop with a minimum 33ms delay.


ifVariable Loop
Code: [Select]
X 0ms onActivate        Self VCE_ifVariable -var- == -anything-    1 99
X 0ms onVariableFalse    Self VCE_ifVariable -var- == -anything-    1 99
X 0ms onVariableFalse    -do stuff-
As long as -var- is not set -anything- it should return false, which triggers the same comparison again. Probably the fastest and most efficient one; easily canceled if -var- becomes -anything-.


VariableUpdate Loop:
Code: [Select]
X 0ms onActivate         Self VCE_modVariable -var- Set -anything-
X 0ms onVariableUpdate Self VCE_modVariable -var- Set -anything-
X 0ms onVariableUpdate -do stuff-
A VCE variable is updated, which triggers onVariableUpdate. Not useful if you want to use VCE_modVariable again.


VariableFunction Loop
Code: [Select]
X 0ms onActivate Self VCE_stateFunction -name- 2 99
X 0ms onActivate Self VCE_callFunction -name-
X 0ms onVariableFunction Self VCE_callFunction -name-
X 0ms onVariableFunction -do stuff-
You have to state and call the function, which triggers onVariableUpdate. Stating required and sometimes functions can be unwieldy (for me at least).


Gravity Projectile Loop
Code: [Select]
X 0ms onActivate Self spawnProjectile 0 0 3 Arrow
X 0ms onProjectileHit Self spawnProjectile 0 0 3 Arrow
X 0ms onProjectileHit -do stuff-
A projectile goes up and comes back down, which triggers onProjectileHit. Also known as the "Why are you hitting yourself?" Loop. Slow and ineffective. Easily stopped by something getting in the way.



Multi-Brick


Relay Loop
Code: [Select]
X 33ms onActivate Self fireRelayDown
X 0ms onRelay Self fireRelayDown
X 0ms onRelay -do stuff-
Code: [Select]
X 0ms onRelay      Self    fireRelayUp
Two bricks; one on top of the other. Brick fires down, brick fires up.


Projectile Loop
Code: [Select]
X 0ms onActivate Self spawnProjectile 0 5 0 Pong
X 0ms onProjectileHit Self spawnProjectile 0 5 0 Pong
X 0ms onProjectileHit -do stuff-
Code: [Select]
X 0ms onProjectileHit Self spawnProjectile 0 -5 0 Pong
Two bricks; one north of the other. Brick shoots one; it shoots back.
« Last Edit: July 10, 2013, 06:09:59 PM by tredden »

Gravity Projectile Loop
Code: [Select]
X 0ms onActivate Self spawnProjectile 0 0 3 Arrow
X 0ms onProjectileHit Self spawnProjectile 0 0 3 Arrow
X 0ms onProjectileHit -do stuff-
A projectile goes up and comes back down, which triggers onProjectileHit. Also known as the "Why are you hitting yourself?" Loop. Slow and ineffective. Easily stopped by something getting in the way.

Last time i checked, this does not allow you to access the client. In fact, I think Badspot forcefully removed the client so players cant make these sort of loops with default events. Although the client and player targets are there, it simply does not work.

EDIT: Just tested, Client target works, however Player does not.
« Last Edit: July 10, 2013, 06:21:56 PM by boodals 2 »

Last time i checked, this does not allow you to access the client. In fact, I think Badspot forcefully removed the client so players cant make these sort of loops with default events. Although the client and player targets are there, it simply does not work.

You could probably work around it.