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
symposes
Novice


Joined: 26 Apr 2006
Posts: 34

PostPosted: Sat Dec 20, 2008 1:54 am   

glitchy if statement
 
HP:%1/%2 SP: %3/%4 Psi: %5/%6 DT:&dtime Focus:%8~% D: %9~% E: &econ

that is my pattern, its my combat hud actually.
i use the & capture for words

my if is

#if ((@cpsi < 1300) && (@econ != None)) {
dra
#t- dra
}

What my problem is, is that the econ check is to prevent this if from executing when i am outside of combat.
However, even when i contain it as @econ != "None" it still fires every time that hud shows up. which is also outside of combat.

A friend of mine, who plays the same class, has a very similar trigger. It works in the same fashion. and even when i change mine to be just like his. it still fires every time the hud shows, instead of when im in combat.

When i first wrote this, it worked just fine, just like it is shown above, with exception to the & operator, as i wrote this in zmud originally.
but even then it would "break" on me.

any ideas how i can change this around to make it actually work?

HP~:%1~/%2%sSP~:%s%3~/%4%sPsi~:%s%5~/%6%sDT~:&dtime%sFocus~:%8~%%sD~:%s%9~%%sE~:%s&%wecon

I am not entirely sure which part of this new hud pattern fixed my problem...but it did. haha if anyone wants to shed some light, ill be happy to listen.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sat Dec 20, 2008 2:20 am   
 
What different values can the Econ variable on your prompt take? The simplest answer is probably simply that the variable @econ will never equal "None" because something is being captured into the variable that you don't want - probably a space, but it could be anything. Show us some example lines with different values of Econ and we can give you some suggestions.

Simplest way, if it has a small number of possible values, would be to use ({val1|val2|val3}) and then refer to it using the %nn variables. In fact, that's something you should take a look at in general - using proper wildcards in your patterns, I mean. You should use %1-%99 in the script to refer to captures, but not in the trigger patterns.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Sat Dec 20, 2008 6:18 pm   
 
You could also looking in to using the pattern matching Expressions and us something like
Code:
&& !(@econ =~ "None")

_________________
Asati di tempari!
Reply with quote
symposes
Novice


Joined: 26 Apr 2006
Posts: 34

PostPosted: Tue Dec 23, 2008 4:27 pm   
 
its been a habit of mine to use %1, etc in the trigger and script.

ie

HP : %1/%2

#var hpc %1
#var hpm %2


I did learn about %n though, when a mud i played actually put commas in large numbers.

as for econ

perfect, bruised, bleeding, emergency, death, or None. and that is the right case.


when i changed the econ capture to %s&%wecon the if began to behave correctly. i also did it in zmud with %s&%w(econ) i think it was, maybe {} instead of (). sorry ,but im not looking at it currently

Only thing i can figure, is perhaps it was catching that space. even though the pattern allowed for there to be a space. *shrug*
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Tue Dec 23, 2008 11:42 pm   
 
Mmm, these things happen. This is the downside of using * (and by extension, &varname and %1-%99 in patterns, which both use *) - it can sometimes capture things you didn't expect it to.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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