Output delay
Quote from Dafflewoctor on November 21, 2013, 7:54 amIs 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?
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?
Quote from FelixGriffin on November 21, 2013, 8:21 amUse 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.
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.
Quote from Lpfreaky90 on November 21, 2013, 2:08 pmOr 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.
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.
Quote from FelixGriffin on November 21, 2013, 4:59 pmLpfreaky90 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 <relay> cancelpending.Wait, that's what cancelpending does? I had no idea you could do that!
then give the button onunpressed <relay> cancelpending.

Wait, that's what cancelpending does? I had no idea you could do that!
Quote from User on November 21, 2013, 6:08 pmWhen 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![]()
Example
[spoiler]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[/spoiler]
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
Example

Quote from Lpfreaky90 on November 21, 2013, 6:23 pmFelixGriffin 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 <relay> cancelpending.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, <do stuff>, 0.10
ontrigger, undo_stuff_rl, cancelpending, 0.00undo_stuff_rl
ontrigger, <undo stuff>, 0.10
ontrigger, do_stuff_rl, cancelpending, 0.00
then give the button onunpressed <relay> cancelpending.

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, <do stuff>, 0.10
ontrigger, undo_stuff_rl, cancelpending, 0.00
undo_stuff_rl
ontrigger, <undo stuff>, 0.10
ontrigger, do_stuff_rl, cancelpending, 0.00
Quote from srs bsnss on November 26, 2013, 11:59 amLpfreaky90 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.
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.