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
nduval
Beginner


Joined: 06 Sep 2006
Posts: 10

PostPosted: Tue May 13, 2008 8:34 pm   

Rather basic variable question.
 
I'm trying to capture info from my HP bar to some variables, and I have a very limited understanding of how to do this =) though I do manage to get by for the most part. My HP looks like this:


HP[314/314] SP[312(88)/312] NP[265/265|13c] Status[w125%|pON|vOFF|r26%] Cr[25%]
Exp[7564.9k] $[37k] TG[2|5] Valpur[100%/0c]
E[none]

The only way I know how to capture these as variables is to do it like this (line 1 is the example)

HP~[&hpcur~/&hpmax] SP~[&spcur~(&spf~)~/&spmax~] NP~[&npcur~/&npmax~|&corpses~] Status~[w&worth~%~|p&protection~|&vsomething~|r&reset~%~] Cr~[&glvl~]

I'm having two issues here. First, the third line is the enemy im fighting, plus status. When I'm not in combat it looks like this:

E[none]

When I am in combat its like this:

E[badguy:scratched]

I would like to have something like E[@enemy] *and* E[@enemy:@enemystatus]. Or just the latter at least. But doing this: E~[&enemy~:&enemystatus~] does not seem to work for me... Any help on this would be fantastic!

Also, one other thing, if you see my HP bar above, and my &corpses variable, its a little annoying because in my hp bar the number has a 'c' right after it. So when I display the number it looks like 15c, and I would very much rather have the number. I'm not sure how to exclude it from the variable.

Thanks again!
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Tue May 13, 2008 9:42 pm   
 
This is going to look a little complex; it's not. Check out this.

#trig {HP~[(%d)/(%d)~] SP~[(%d)~(%d~)/(%d)~] NP~[(%d)/(%d)~|(%d)c~] Status~[w(%d)~%~|p(%w)~|v(%w)~|r(%d)~%~] Cr~[(%d)~%~]
Exp[7564.9k] $[37k] TG[2|5] Valpur[100%/0c]} {#var hpcur %1;#var hpmax %2;#var spcur %3;#var spf %4;#var spmax %3;#var npcur %5;#var npmax %6;#var corpses %7;#var worth %8;#var protection %9;#var vsomething %10;#var reset %11;#var glvl %12}

The E part seems to be on a separate line, so I suspect you'll need a separate trigger for it. In any case, something like this:

#if %pos(":",%1) {#var enemy %word(%1,1,":");#var enemystatus %word(%1,2,":")} {#var enemy %1}

will split what you already have.
_________________
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