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
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Thu Jan 04, 2007 2:01 am   

Send command from trigger at end of line (vs. middle)?
 
Appologies and disclaimers if this information is found somewhere obvious... I did search.

I have a fairly standard expression trigger:
Code:
#TRIGGER "sipper1" (@sipbal & (@hp<@hpsip | @mp<@mpsip) & !@stunned) {#if (@hp<@hpsip) {#if (@mp<%eval( @hp/2)) {sip mana} {sip health}} {sip mana}}

The various values which power this trigger are gathered through mxp elements sent in the prompt. The problem (feature?) is that it will send the command exactly when it matches--which is in the middle of the prompt, breaking my prompt in two and looking generally ugly and difficult to read. I would prefer if I could get this to send at the end of the line, without using #send (I need the commands to be parsed for other things).

Example of what it does now:
Code:
<343/319h 319/414m 1499e 1934w <eb> <42>> focus

You focus your mind intently on curing your mental maladies.
<343/319h 297sip mana
/414m 1499e 1928w <eb> <42>> m-22
You take a drink from a cedarwood vial.

Example of what I'd like it to do:
Code:
<343/319h 319/414m 1499e 1934w <eb> <42>> focus

You focus your mind intently on curing your mental maladies.
<343/319h 297/414m 1499e 1928w <eb> <42>> m-22 sip mana

You take a drink from a cedarwood vial.
Reply with quote
Nangasaur
Newbie


Joined: 02 Jan 2007
Posts: 8

PostPosted: Thu Jan 04, 2007 2:28 am   
 
Set your trigger to look for your mana, then * (any characters including whitespace), then >>.

Wouldn't that work?
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Thu Jan 04, 2007 2:34 am   
 
I'm not sure which trigger you're talking about, but I don't think it will work.... I don't actually have -any- trigger matching on my prompt, the @hp, @mp, etc. variables are set via MXP (pushed from the game, basically). The trigger I included just matches changes in those variables, if I change them manually via #var then it will still match, no prompt necessary.
Reply with quote
Nangasaur
Newbie


Joined: 02 Jan 2007
Posts: 8

PostPosted: Thu Jan 04, 2007 3:01 am   
 
Here's what I mean:
Code:
#TRIGGER "sipper1" (@sipbal & (@hp<@hpsip | @mp<@mpsip) & !@stunned) {#if (@hp<@hpsip) {#if (@mp<%eval( @hp/2)) {#TRIGGER {~<*~>~>} {sip mana} classname} {sip health}} {#TRIGGER {~<*~>~>} {sip mana} classname}};#UNTRIGGER {~<*~>~>}

This way it waits until the end of your prompt before sending the command?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Jan 04, 2007 3:09 am   
 
It's a feature. Expression triggers fire as soon as any expression occurs (it doesn't even have to be related to the variables you are checking, either, so long as the expression returns true). If you want delayed displays, you probably will need to use a pattern trigger that matches the prompt.
_________________
EDIT: I didn't like my old signature
Reply with quote
Nangasaur
Newbie


Joined: 02 Jan 2007
Posts: 8

PostPosted: Thu Jan 04, 2007 3:12 am   
 
MattLofton wrote:
It's a feature. Expression triggers fire as soon as any expression occurs (it doesn't even have to be related to the variables you are checking, either, so long as the expression returns true). If you want delayed displays, you probably will need to use a pattern trigger that matches the prompt.

*nods* That's what I posted above for him, "should" work. Keyword, "should".
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Thu Jan 04, 2007 4:00 am   
 
OH! That's clever, I see what you mean now. That did indeed work, in a way. I just added a ReParse trigger with a * in there... the full thing looks like this now:
Code:
#TRIGGER "sipper1" (@sipbal & (@hp<@hpsip | @mp<@mpsip) & !@stunned) {}
#COND {*} {#if (@hp<@hpsip) {#if (@mp<%eval( @hp/2)) {sip mana} {sip health}} {sip mana}} {reparse}
#COND {@sipbal=0} {#state sipper2} {exp}

One problem was that if I manually set any of the variables low it breaks unless I do a #show or some other way of forcing it to match, but I'm sure I could work around it by doing a micro-alarm or something... this, however, works for me for now, I don't anticipate manually setting it off that way anyway (I usually just change my sip level). Sooo much cleaner now, though, thank you!
Reply with quote
Nangasaur
Newbie


Joined: 02 Jan 2007
Posts: 8

PostPosted: Thu Jan 04, 2007 4:14 am   
 
No, haven't messed with it yet. Our mud is running a lot of random bonuses, so I usually get about 5 minutes out of every 30-45 minutes to work on my script :) Which is rough, because I need a lot more than that to actually accomplish anything :) Most of my work I get done in the middle of the night when there's hardly anything going on.
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