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
deggenbe
Newbie


Joined: 11 Jan 2005
Posts: 8

PostPosted: Tue Jan 11, 2005 6:22 pm   

Capturing my HP SP and MP into variables
 
I've read several pther posts to give me some idea on how this could be done. After spending almost tha last 36 hours trying to get it to work, i'm giving up trying to figure it out myself.

I want my HP SP and MP values to be put into a variable and sent to a guage button.
I can manually setup the guage button with, what seems to be no problems at all.

The line i need to obtain the variables from looks like this..

HP: 718/753 | SP: 278/589 | MP: 400/418

When I set up the trigger like so...

#TR HP: %d/%d | SP: %d/%d | MP: %d/%d
#VAR hp %1;#VAR hpmax %2;#VAR sp %3;#VAR spmax %4;#VAR mp %5;#VAR mpmax %6

I'm not really sure what else to do after this, so i have tested commands in the command line to see if the variables are actually catching information.

#show @hp
or
#show @hpmax
etc etc
and none of them return any information.
so regardless of trying to throw the info to a guage, should the variables be reflecting the information i've sent into them?

I cannot seem to get past this point, any help would be great
Also, I will read up on what I can about guages, but if anyone wants to throw that info in there also, that would be great.

I think its...

#guage HPINF HPINF (@hp) (@hpmax) (@hpmax/20)
but thats just a rough estimate.
Reply with quote
deggenbe
Newbie


Joined: 11 Jan 2005
Posts: 8

PostPosted: Tue Jan 11, 2005 6:35 pm   
 
Well, i think i got the variable part to work...

I changed the #TR to this

#TR {HP: (%d)/(%d) | SP: (%d)/(%d) | MP: (%d)/(%d)};#VAR hp %1;#VAR hpmax %2;#VAR sp %3;#VAR spmax %4;#VAR mp %5;#VAR mpmax %6

I guess the {}'s is what i was looking for all this time, now I regret pulling all that hair out of my head.
Anyway, i'll start messing with the guage and see if I can get it to work.
Reply with quote
deggenbe
Newbie


Joined: 11 Jan 2005
Posts: 8

PostPosted: Tue Jan 11, 2005 8:07 pm   
 
Figures i'd work it out sooner or later.


#TR {HP: (%d)/(%d) | SP: (%d)/(%d) | MP: (%d)/(%d)}
#VAR hp %1
#VAR hpmax %2
#VAR sp %3
#VAR spmax %4
#VAR mp %5
#VAR mpmax %6
#gauge HPINFO "HPINFO" (@hp) (@hpmax) (250)
#gauge SPINFO "SPINFO" (@sp) (@spmax) (100)
#gauge MPINFO "MPINFO" (@mp) (@mpmax) (100)

Seems to work perfect for me.

I want to take this moment to thank myself for my help.
LOL being sarcastic.
Reply with quote
deggenbe
Newbie


Joined: 11 Jan 2005
Posts: 8

PostPosted: Tue Jan 11, 2005 8:15 pm   
 
Though, I could not get the third part of the gauges to work properly
(@hpmax/20) or (@spmax/20) or (@mpmax/20)

i.e...
#gauge HPINFO "HPINFO" (@hp) (@hpmax) (@hpmax/20)
would just never seem to work, any idea on this would help greatly.
Reply with quote
deggenbe
Newbie


Joined: 11 Jan 2005
Posts: 8

PostPosted: Tue Jan 11, 2005 8:15 pm   
 
p.s. if I enter a raw number in the third column of the guage, it does work, just the MATH part doesn't seem to.
The color never changes using /20
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Jan 12, 2005 2:47 am   
 
The #GAUGE command doesn't need to be in your trigger, the gauges only need to be made once. Try this:
Code:

#TR {HP: (%d)/(%d) | SP: (%d)/(%d) | MP: (%d)/(%d)} {
#VAR hp %1
#VAR hpmax %2
#VAR sp %3
#VAR spmax %4
#VAR mp %5
#VAR mpmax %6}
#GAUGE HPINFO "HPINFO" (@hp) (@hpmax) (@hpmax/20)
#GAUGE SPINFO "SPINFO" (@sp) (@spmax) (@spmax/20)
#GAUGE MPINFO "MPINFO" (@mp) (@mpmax) (@mpmax/20)

Keep in mind that 1/20 is fairly small. With the maxes in your example (753, 589, 418) the thresholds would be around 37, 29, and 20 which is much lower than the 250, 100, and 100 you chose manually. The color change occurs when the value drops below the threshold so you should get red whenever the stats are at or below 36, 28, and 19.
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
deggenbe
Newbie


Joined: 11 Jan 2005
Posts: 8

PostPosted: Wed Jan 12, 2005 5:23 am   
 
ahh thanks, i bet that is it, i'll try it now.
guess i just wasn't in the right state of mind when i was first trying it.
Reply with quote
deggenbe
Newbie


Joined: 11 Jan 2005
Posts: 8

PostPosted: Thu Jan 13, 2005 3:13 am   
 
OK
all that is working now, and thanks for the tip.

I have another question though.

I use a trigger to capture this number, here is the line as it comes fromt he mud

You have 847,853 experience points to spend.

I use this trigger

#TR You have (%d) experience points to spend.
#VAR exp %1

now i use it in a gauge also to have a physical representation of my experience points gained so far..
However. sometimes my MUD will change the output of the line to this.

You have 847853 experience points to spend.

Notice is does not have a comma, i can only get the gauge to work when it does not use the comma.

How can I capture this number and use it like my hp counter but with the comma? or somehow extract it out, but yet keep the same value?

in the gauge i set the value to @exp
and the max to whatever i need to level for that specific level -
for our level 33 to level to 34 is 2320000. si i set the max to that.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Jan 13, 2005 9:53 am   
 
Use the %n wildcard instead of %d.
#TR {You have (%n) experience points to spend.} {#VAR exp {%1}}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
deggenbe
Newbie


Joined: 11 Jan 2005
Posts: 8

PostPosted: Thu Jan 13, 2005 7:46 pm   
 
WOOT, thanks, works like a charm.

#tr XP Needed: (%n)
#var expneed %1;#math explevel (@expneed+@exp)
works perfect commas or not, :) thanks alot.
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