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
snatch.xx
Beginner


Joined: 09 Jun 2007
Posts: 19

PostPosted: Sat Jun 09, 2007 9:29 pm   

Help with a guage please.
 
Ok I'm switching from portal to Zmud and need help with a guage. Been attempting and reading through post but not having much luck yet.

Sample text " *~HP: 220/279 PP: 266/266 Chi: 86/143 G2:34362 Mind: 161 AE:4/49% CF:N T: De "

Pretty usual stuff if at all possible on the guage I was trying to put G2:34362 between "CF:N T:De" and "T:De" Only shows when I am in combat and has pe (perfect), br (bruised), bl (bleeding), em (emergency) and De (death). One more thing I was trying to do on the guage was make CF:N actually say ChiFocus:Normal ... N = Normal, S = Static, T = Thought . Hopefully I'm not asking too much lol I know someoone can do it and I will keep trying and maby get lucky.

Thanks
Reply with quote
Tech
GURU


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

PostPosted: Sat Jun 09, 2007 11:17 pm   
 
Ok... we've got a couple of things going on here.

First it looks like you want to define 3 gauges. HP, PP, and Chi.

I'm not sure I understand what G2 represents? Gold Maybe?

We can capture the T: De information and artificially make it a #GAUGE. I'll describe that more later.

It's actually probably best to have 2 triggers to capture your prompt. One for battle and the other normal.

Code:

#TR {~*~~HP: (%n)/(%d) PP: (%d)/(%d) Chi: (%d)/(%d) G2:(%d) Mind: (%d) AE:(%d)/(%d)} {
HP=%1
MxHP=%2
PP=%3
MxPP=%4
Chi=%5
MxChi=%6
G2=%7
Mind=%8
AE=%9
MxAE=%10
}

#ADDKEY ChiFocusType {T=Thought|S=Static|N=Normal}
#ADDKEY TargetHealthType {pe=perfect|br=bruised|bl=bleeding|em=Emergency|De=Death}
#ADDKEY TargetHealthNum {pe=5|br=4|bl=3|em=2|De=1}

#TR {~*~~HP: * CF:({N|S|T}) T: ({De|Pe|Br|Bl|Em}) } {
Target=%db(@TargetHealthNum, "%2")
ChiFocus=%db(@ChiFocusType,"%1")
}

#GAUGE HP "Health"@HP @MxHP (@MxHP/5) {} "high,green" "high,yellow" "white"
#GAUGE PP "PP" @PP @MxPP (@MxHP/4) {} "blue" "cyan" "white"
#GAUGE Chi "Chi" @Chi @MxChi  (@MxChi /3) {} "black" "grey" "white"
#GAUGE AE "AE" @Ae @MxAE (@MxAE/4) {} "#FF3300" "#991122" "white"
#GAUGE Target "Target" @Target 5 2 [class] "green" "red" "grey"


This is the typical format for a gauge button.
#GAUGE id caption [value] [maxvalue] [lowvalue] [class] [normcolor] [lowcolor] [backcolor]

The code's untested but it should give you the general idea. The colors especially are a little foggy so you get an odd color scheme. You can adjust visually using the settings editor though.
_________________
Asati di tempari!
Reply with quote
snatch.xx
Beginner


Joined: 09 Jun 2007
Posts: 19

PostPosted: Sat Jun 09, 2007 11:50 pm   
 
Wow a lot closer then I was I greatly apreiciate it. And if it matters any G2: # is just gxp to next level. I'll work with it some and let yah know how it works.

Thanks again
Reply with quote
snatch.xx
Beginner


Joined: 09 Jun 2007
Posts: 19

PostPosted: Tue Jun 12, 2007 10:25 pm   
 
Ok I need some help again. Seems I still dont have a good grasp of the guages yet I got all the previous one working. But now on a new one and doing this one myself just by example and its not working.

Sample text -
HP:528/560< 94%> SP:259/259<100%> C: 95.95% F: 0.00%
M:hands CH: 0% Dis:1/1<0> DF:CD Gxp: 39.11% ES:Death

Ok I think this is what I got.

#TR {HP:(%n)/(%d)<(%d)> SP:(%d)/(%d)<(%d)> C: (%d) F: (%d)} {
HP=%1
MxHP=%2
PHP=%3
SP=%4
MxSP=%5
PSP=%6
Con=%7
For=%8
}

#TR {M:(%w) CH: (%d) Dis:(%d)/(%d)<(%d)> DF:(%w) Gxp: (%d) ES: (%w)} {
Mod=%1
CH=%2
Dis=%3
MxDis=%4
SEnergy=%5
DF=%6
Gxp=%7
ES=%8
}

Ok thats what I have as a pattern and value setup and in Variables I have all the matching Vars but thier not picking up the values ie @HP shows blank and not 528 like it should. Not sure what I am doing wrong. If someone could help please. Get the Vars working and I should be able to setup the guages.

Thanks
Reply with quote
snatch.xx
Beginner


Joined: 09 Jun 2007
Posts: 19

PostPosted: Tue Jun 12, 2007 11:14 pm   
 
Ok I am seeing my problem its the special characters <, >, %, . , etc... I'm playing around with different wild cards but not having much luck.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Wed Jun 13, 2007 12:52 am   
 
You have to quote out special chars in a trigger pattern with ~

~< will match <
~~ will match ~
~% will match %
~? will match ?
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Daagar
Magician


Joined: 25 Oct 2000
Posts: 461
Location: USA

PostPosted: Wed Jun 13, 2007 1:00 am   
 
#TR {HP:(%n)/(%d)<(%d)> SP:(%d)/(%d)<(%d)> C: (%d) F: (%d)}

should I think be this:


#TR {HP:(%d)/(%d)~<( %d)~%~> SP:(%d)/(%d)<(%d~%)> C: (%d)~% F: (%d)~%}

Note the use of "~" to escape special characters.

I also forget if zmud captures floating point values correctly with %d. I typically use regex expressions, so to capture:
50.95%

you would use (\d)+.(\d)+\%

and then set your variable like so:
myVar = %1+(%2/100.0)

=============

An unrelated tip for playing on 3-Kingdoms: Make a prompt trigger
#tr {~>} {#echoprompt %cr}

(be sure to turn on the 'Trigger on Prompt' option for the above)

This will force new lines that come from the mud to _always_ start on the next line, so any triggers you create can use '^' anchors correctly. I have no clue why 3k works this way and I had all sorts of elaborate triggers to parse out the prompt, until I realized the above works.
Reply with quote
snatch.xx
Beginner


Joined: 09 Jun 2007
Posts: 19

PostPosted: Wed Jun 13, 2007 1:57 am   
 
Alright sweet I got it fixed thanks for the help everyone. One last question.

Can I force this to be hidden from the screen but still receive the data from it?

HP:528/560< 94%> SP:259/259<100%> C: 95.95% F: 0.00%
M:hands CH: 0% Dis:1/1<0> DF:CD Gxp: 39.11% ES:Death

I can color it black but I end up with 2 blank spaces on the screen.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Jun 13, 2007 4:43 am   
 
Just add the #gag command to the trigger.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
snatch.xx
Beginner


Joined: 09 Jun 2007
Posts: 19

PostPosted: Thu Jun 14, 2007 12:31 am   
 
I almost got it all figured out and so far kicking arse. Got all kinds of stuff setup now with everyones help. Still having a little trouble with my guages for my hpbar though. I was able to edit the bar to show differently to take out some of those special characters hopefully making it easier. Alright new bar.

Sample:

HP:487/560 HP2: 86% SP:259/259 SP2:100% Con: 94.17% For: 0.00%
M:hands CH: 0% Dis:1/1 Dis2:0 Def:CD Gxp: 86.26% ES:Death


Almost everything I got setup right but I am still not able to get my variables for " HP2: 86% , SP2:100%, Con: 94.17% For: 0.00%, CH: 0% and Gxp: 86.26%" to return correct values.

Example HP2: 86% would work anytime my hpbar would pop up but never return the value of 100% always 97,08,or 99 or sometimes a lower value even when it's 100%. And I have tried quite a few different ways searching through help and the fourms to correctly capture "100.00% , 94.17% etc.. anything 000.00%"

This should be the last thing I need and I will be able to stop buggin you all with this :) hehe been a great help though I appreiciate it a lot.

Thanks
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