Output delay

Avatar
Dafflewoctor
415 Posts
Posted Nov 21, 2013
Is there any way to fire an output from a trigger, not as a delay, but where it wouldn't be fired unless you stayed in the trigger for a certain amount of time?
Advertisement
Registered users don’t see ads! Register now!
Avatar
FelixGriffin
2,680 Posts
Posted Nov 21, 2013
Replied 27 minutes later
Use a logic_timer, which resets its time when it's disabled. You can either make the time random within a range, or specify a number of seconds. Enable the timer OnStartTouch, and disable it on OnEndTouch. When it fires, have it activate whatever else and then disable itself.
Avatar
Lpfreaky90
2,842 Posts
Posted Nov 21, 2013
Replied 5 hours later
Or just fire a logic_relay with a delay of the time you want the player to be on the button;
then give the button onunpressed <relay> cancelpending. :smile:
Avatar
FelixGriffin
2,680 Posts
Posted Nov 21, 2013
Replied 2 hours later

Lpfreaky90 wrote:
Or just fire a logic_relay with a delay of the time you want the player to be on the button;
then give the button onunpressed cancelpending. :smile:

Wait, that's what cancelpending does? I had no idea you could do that!

Avatar
User
630 Posts
Posted Nov 21, 2013
Replied 1 hour later
When you have a Relay, who Fires an Output with a Delay of maybe 5 secounds And it get triggered, you can "break up" (cancel pending) the Output.
So the Output Will not fired :biggrin:

Example
A floor_button opens a door with a delay of 10 sec's but on UnPressed it closes the door within 2 seconds. Now the problem is, that if you go on the button, and go within 5 seconds off the button, the door opens later, but you're not standing on the button. Now you can easily Make a relay, that has the outputs of the button, and make the Output from the floor_button: " OnUnpressed -> Door_Rl -> Cancelpending. " So now if you go of the button, the 10 seconds will be canceled :biggrin:

Avatar
Lpfreaky90
2,842 Posts
Posted Nov 21, 2013
Replied 14 minutes later

FelixGriffin wrote:
Lpfreaky90 wrote:

Or just fire a logic_relay with a delay of the time you want the player to be on the button;
then give the button onunpressed cancelpending. :smile:

Wait, that's what cancelpending does? I had no idea you could do that!

Yep! It's also great for preventing errors that can be caused by quick moving on/off buttons;

Do_stuff_rl;
ontrigger, , 0.10
ontrigger, undo_stuff_rl, cancelpending, 0.00

undo_stuff_rl
ontrigger, , 0.10
ontrigger, do_stuff_rl, cancelpending, 0.00

Advertisement
Registered users don’t see ads! Register now!
Avatar
srs bsnss
552 Posts
Posted Nov 26, 2013
Replied 4 days later

Lpfreaky90 wrote:
Yep! It's also great for preventing errors that can be caused by quick moving on/off buttons;

It's important for laser relays/catchers as well, if not more important than on buttons.

Also, I remember learning the use of CancelPending by reading a conversation between wrathofmobius, Habzs and Aixce in the IRC Webchat who had a discussion by using outputs, like 'ent_fire Aixce Kill', then wrathofmobius would reply with 'ent_fire Habzs CancelPending' "i saved you aixce"

Good times. Wasn't there myself, but good times.