Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Sun Jan 24, 2016 7:20 pm   

A better way to do things?
 
Is there a better way to prevent a trigger from firing so soon?

I currently use named triggers, and then either a wait statement(old triggers) or an alarm(which has a tendency to break) to turn the trigger back on.

Wait statements have a tendency to lag things up/cause the triggers to not fire sometimes or delay other triggers/input from happening.

Alarms can stop working if the folder or all triggers have been disabled.

So I'm curious. Is there a better way to make it so that it only fires once per every x seconds? Sometimes lag will delay several rounds of combat, and then I'll get 10 rounds all at once causing the same trigger to fire 10x and just cause more lag/unnecessary in-game resources usage or many other troubles.

Thanks for the help.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Jan 24, 2016 9:49 pm   
 
Use a second state that is either an alarm or duration, If you go with duration then you would set the pattern text to something that is impossible to match such as: "Not ^ possible" and set the time you want in the param field. Alarm is likely a better choice when the desired delay is more than a few seconds.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Sun Jan 24, 2016 10:03 pm   
 
Thanks Vijilante.

Forgive me, but I don't fully understand #state, but isn't that what I'm currently doing with the alarm? Trigger fires, #T- triggername; #ala +1 {#T+ triggername} .. Turns trigger off for 1 second and turns it back on.

Wouldn't the state be the same thing as turning it off/on with #T-/+ but without a secondary trigger to turn it back on, except I'm just using an alarm?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4702
Location: Pensacola, FL, USA

PostPosted: Mon Jan 25, 2016 4:17 am   
 
Essentially, yes.
Trigger states are added patterns that must be matched in sequence by default.
Technically the trigger is waiting for a different pattern in the interim.

Another alternative is to base the trigger script off a variable.
#IF (@testVar=1) {do something}

Then you only need to change to value of @testVar to keep the trigger from actually doing anything.
_________________
Discord: Shalimarwildcat
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Jan 25, 2016 6:23 pm   
 
Code:
#TRIGGER {example} {#SHOW I fired}
#COND {Not^Possible} {} {duration|param=1000}
#LOOP 5 {#SHOW {example}}
#ALARM +2 {#SHOW example}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net