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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
MisterDwooD
Novice


Joined: 04 Feb 2014
Posts: 42

PostPosted: Tue Feb 04, 2014 7:09 am   

Trigger for command on any input from user.
 
I have a need to run a script, and then have it stop when I do anything that is sent to the mud. Any command at all, but the command I enter needs to go through.
So I have tried to use the OnInput command, but that actually overrides any command I do with the command that's specified. Is there a way to mirror the command enter, which will be also be the trigger, and have it go through?

I tried it sorta like this this:

#ONINPUT {{n|e|s|w|l|stat|score}} {}

That limits the commands that I can enter that will trigger, and I'm okay with that, but I'd rather it trigger on anything.

So.. "execute script" Script continues until I enter any command into the command line, the fact that I entered in a command triggers to stop the script, but then lets the command go through.

Anyways,
Thanks in advance.

- DW
Reply with quote
shalimar
GURU


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

PostPosted: Tue Feb 04, 2014 9:16 am   
 
you can make an

#ONINPUT "anyKey" {*} {#T- anyKey}

that will trigger on anything, and turns itself off

you just need to turn it on before it will work with:

#T+ anyKey
_________________
Discord: Shalimarwildcat
Reply with quote
MisterDwooD
Novice


Joined: 04 Feb 2014
Posts: 42

PostPosted: Tue Feb 04, 2014 4:47 pm   
 
That's exactly what I do... except.

The script I'll be running is constantly triggering and inputting more commands. Not actually with me doing anything, but for example:

#ONINPUT "anyKey" {*} {#T- tempsigtrig;#T- sigwar;#T- anyKey} "Scripts|Slapsig"
#TRIGGER "tempsigtrig" {Tickle who~?} {tickle @ticklenow;#ALARM 5 {#T- "tempsigtrig"}} "Scripts|Slapsig"

That basically enters the tickle command, and if nobody is there to tickle, it enters it again until someone is there. When someone is there, it'll say something like, "You start to tickle...", and after 5 seconds, it'll stop the tickle trigger for nobody being there.

Because I want it to stop if I move a room, I want to trigger it to stop by entering a direction, or a command, but i want that command to go through, just like what you provided.

Unfortunately, the #ONINPUT is triggering off of the next tickle since nobody was there to be tickled, and then it's actually stopping the whole thing. Is there a way for it to trigger only on something that I put in and press enter? Maybe trigger off a hard return? I guess I could try to tickle a certain amount of times before moving to the next area to tickle, but, I'd rather have it go indefinitely, until I stop it.

Hopefully that's clear. Thanks Guys.
Reply with quote
MisterDwooD
Novice


Joined: 04 Feb 2014
Posts: 42

PostPosted: Tue Feb 04, 2014 10:12 pm   
 
Alright..
So the dots sorta connected and i figured I could just use this

#ONINPUT "anyKey" {{n|e|s|w|l|stat|score}} {#T- tempsigtrig;#T- sigwar;#T- anyKey} "Scripts|Slapsig"
#TRIGGER "tempsigtrig" {Tickle who~?} {tickle @ticklenow;#ALARM 5 {#T- "tempsigtrig"}} "Scripts|Slapsig"

But then that is triggering on the "e" in tickle. So, if I"m sitting there trying to tickle someone, when it's send "tickle" it stops the trigger.

Is there anyway to have it send Tickle, but only trigger on "e" when it's by itself, as if moving east? The "l" in tickle is also triggering it.


Hmm.. It looks like this would work... :)

#ONINPUT "anyKey" {^{n|s|e|w|l|look|score|stat|f|flee}$} {#T- tempsigtrig;#T- sigwar;#T- anyKey} "Scripts|Slapsig"
#TRIGGER "tempsigtrig" {Tickle who~?} {tickle @ticklenow;#ALARM 5 {#T- "tempsigtrig"}} "Scripts|Slapsig"

Any way to clean that up at all?
Reply with quote
shalimar
GURU


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

PostPosted: Tue Feb 04, 2014 11:32 pm   
 
Um... im not sure how your alarm is working usally its +5 -5 *5, not sure if jjust the number is treated a positive or what.
but otherwise... i don't see anyway to make it less verbose
_________________
Discord: Shalimarwildcat
Reply with quote
MisterDwooD
Novice


Joined: 04 Feb 2014
Posts: 42

PostPosted: Wed Feb 05, 2014 5:06 am   
 
Exactly. I ended up using +7 for the alarm. Other than that, it seems to be working perfectly. I didn't use the {+|-} at first and it was creating tons of repeating triggers.. haha. was crazy, I had to show triggers in parsing to see what it was doing. But I got it figured out.


I appreciate your help!
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Feb 05, 2014 5:51 pm   
 
Check out %q. This wildcard was designed directly to deal with the e in tickle.
_________________
EDIT: I didn't like my old signature
Reply with quote
shalimar
GURU


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

PostPosted: Wed Feb 05, 2014 7:56 pm   
 
not really needed with the anchors in place, but very useful when you want to honor whole word boundries
_________________
Discord: Shalimarwildcat
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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