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
Exodus Kaelbohr
Newbie


Joined: 23 May 2002
Posts: 2

PostPosted: Thu May 23, 2002 4:10 am   

HPbar matching
 
Okay, I play on a mud where i have to manage mutiple summons, and thought it would be nifty if i could set up little hp bars for each summon I have... below my main HP bar, i have something like this:
.. btw, for some reason, the plus character wont display on this board, so i replaced them with (plus) :)
--> Clay golem:(plus), Giant centipede:A, Lemure:~B

or, depending on the # of summons i have it may like this:

--> Clay golem:(plus)

basically, each summon is just tacked on to the end of hte line with a comma, the summon's name, then a one or two letter status description (their hp status) as such: ~E, E, ~D, D, ~C, C, ~B, B, ~A, A, ~(plus), (plus)
.. I then use a really long string of #IFs to set a numerical variable for their health (in orther words, if they have ~E life left, they are at about 10%, if they are at A, they are at 100%)

I have tried various triggers to try capturing all of the information, but because i have to use a crap load of general wildcards (*), the trigger will almost always get messed up... worse yet, i have to have multiple triggers depending on how long my line is (have to have one trigger for one summon, one trigger for two summons, et cetera)...

my triggers end up looking something like this: (this one is for three summons)
~-~-~> &golem golem~:(*)~, (*)~:(*), (*)~:(*)$

my first question is, is there any way to combine all of this crap into one trigger? the comma is throwing me off, along with the varied string length

second q is, how can I limit the status capture thingy to one or two characters, or to specifically look for a tilde (~)?


would appreciate any help/suggestions/samples from you guys, this one has been bugging me for the longest time :( :(
Reply with quote
Pega
Magician


Joined: 08 Jan 2001
Posts: 341
Location: Singapore

PostPosted: Sat May 25, 2002 3:54 am   
 
Hope this helps.

Try to first capture all the data into a string. After that you can sort out what goes where. Trigger pattern:
--> (%*)$

From a string like:
Clay golem:+, Giant centipede:A, Lemure:~B

You can turn it into an item list using a replace function. For example:
#var summonslist {%replace("%1", ", ", "|")}


You can match a tilde using [~~] or ~~ as your pattern

Okay, now you have each summon stored as an item in the summonslist string list. You can now grab each one and sort out its stats.
#var summonscode {~E|E|~D|D|~C|C|~B|B|~A|A|~+|+}

#var summonsgrade {very bad|bad|fairly bad|fair|fairly decent|decent|good|very good|almost excellent|excellent|below +|+++}
#forall @itemslist {#if ("%i" =~ "(*):(*)") {#show {%%1 %case(%ismember("%%2", @summonscode), @summonsgrade)}}}
I haven't tested any of this, it's just off the top of my head. Your solution may look slightly or very different.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sat May 25, 2002 4:15 am   
 
How about grab the whole line then make sense out of it. The only issue I see is
speed if you get your summon creature status every prompt.

It appears that you always have this but I fear that it may not be so:

^~-~-~> (*)$

Delimiter that can be used is the , . I wonder if %numwords(string,", ") and
%word(string,number,", ") would be useful here to quickly parse.

%word("Clay golem:+, Giant centipede:A, Lemure:~B",3,", ")
Issue I see is the above which will parse the ~

Trigger: ^~-~-~> (*)$
Value:


#VAR V_summon_num %numwords("%1",", ")
#LOOP @V_Summon_num {
#VAR V_Summon_num_%i %word(%word("%1",%i,", "),1,":")
#VAR V_Summon_num_hp_%i %word(%word("%1",%i,", "),2,":")
}


You then refer to your creatures as @{V_Summon_num_%i} where you only care when %i is
less than or equal to @V_Summon_Num.

You could modify the V_Summon_num_hp_%i into a numerical value which reflects the 0-100%

Let me scour the forums for a nice way to grab the ~ and play with it.

TonDiening
Beta Upgrading to 6.26
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sat May 25, 2002 4:16 am   
 
What Pega said

TonDiening
Beta Upgrading to 6.26
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