Author Topic: What is Delay for, how is measured and how do you properly use it?  (Read 656 times)

The questions in the title.
I try to put numbers as  if it worked but nothing happens :/

Milliseconds I think
A delay of 3000 is 3 seconds

stuff I've been meassuring it wrong all the time
If for example, there is two "on activate" events, If I put a delay of 3s to it, will it only be activable with that event after 3s then return to the first one if activated again?

It will just delay the second event by 3 seconds. You can activate it as much as you want.

Do you know how to make it so you can't activate it before 3 seconds?


toggleEventEnabled
That can easily mess up everything if you don't use it completely right. You'd be better off by using setEventEnabled

If I understand you correctly this is what you want to happen.

You probably want something else to happen but I used setlight to clear it up.

The light will turn on 3 seconds after the brick is activated
The light will stay on because there's no other event after line 1.

toggleEventEnabled | 2? There is no third event.

toggleEventEnabled | 2? There is no third event.
Oh right my bad, the number 2 in the box should be 1
I didn't test it  :iceCream:

If I understand you correctly this is what you want to happen.

You probably want something else to happen but I used setlight to clear it up.

The light will turn on 3 seconds after the brick is activated
The light will stay on because there's no other event after line 1.
Not exactly. I want something so the brick can't be activated again before 3 secs. I'm using Phydeoux doors and switches, and I dont want switch spam.

0  |  0  |  onActivate  |  [action]
1  |  0  |  onActivate  |  Self  |  toggleEventEnabled  |  0 1
2  |  3000  |  onActivate  |  Self  |  toggleEventEnabled  |  0 1

It uses two actions, open and close, should I put the close one behind the no2 event?

You could always do this instead:

Code: [Select]
0 onActivate  do_your_stuff_here
0 onActivate  Self  setRayCasting  false
3000 onActivate  Self  setRayCasting  true

Disabling raycasting for three seconds will prevent players from clicking on it.

I see. Gotta try it myself