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


Joined: 07 May 2003
Posts: 8
Location: USA

PostPosted: Wed May 07, 2003 10:55 pm   

Coloring prompts
 
Here is my situation.. I'd like to create a set of variables and triggers that would color my HP prompt to certain colors if it's a certain percentage of my total health.. for example:
Health from 150 to 200 would be blue.
Health from 100 to 150 would be green.
Health from 50 to 100 would be yellow.
Health from 0 to 50 would be red.
Reading the other topics regarding HP guages I assume I need to make a variable with my maxhp and then a trigger on my prompt.. but I don't know exactly what needs be done.. Thanks in advance.

Gharbage
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed May 07, 2003 11:13 pm   
 
Something like this:

#TRIGGER {(%d)/%dHp} {#IF (@Hp > 150) {#PCOL blue %x1} {#IF (@Hp > 100) {#PCOL green %x1} {#IF (@Hp > 50) {#PCOL yellow %x1} {#PCOL red %x1}}}}

Change the trigger to reflect your prompt. I'm assuming that if you are using 200 that it does not reflect percentage of Hp but absolute Hp.

Ton Diening
Reply with quote
gharbad
Newbie


Joined: 07 May 2003
Posts: 8
Location: USA

PostPosted: Wed May 07, 2003 11:20 pm   
 
Thanks for the speedy reply..
but;
It appears I've left out a bit of important information.. I've defined variables with
#VAR maxhp {200}
and
#VAR maxep {200}
My prompt comes up as
*~HP:200 EP:200~*

The trigger that you supplied did not color my prompt accordingly.. also, I'd like the coloring of the HP and EP values to be independent of each other, while coloring only the numerical values and not the HP: and EP: prefixes.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed May 07, 2003 11:25 pm   
 
#TRIGGER {^~*~~HP~:(%d) EP~:(%d)~~~*} {#VAR Hp %1;#VAR Ep %2;#IF (@Hp > 150) {#PCOL blue %x1} {#IF (@Hp > 100) {#PCOL green %x1} {#IF (@Hp > 50) {#PCOL yellow %x1} {#PCOL red %x1}}};#IF (@Ep > 150) {#PCOL blue %x2} {#IF (@Ep > 100) {#PCOL green %x2} {#IF (@Ep > 50) {#PCOL yellow %x2} {#PCOL red %x2}}}} "" {prompt}

Edited: made it a prompt trigger

Ton Diening
Reply with quote
gharbad
Newbie


Joined: 07 May 2003
Posts: 8
Location: USA

PostPosted: Wed May 07, 2003 11:50 pm   
 
This doesn't appear to be working.. the pattern isn't matching. Is there a way to fire the trigger solely on the HP:XXX EP:XXX ? Or should I change my prompt to something that would give zmud less trouble, such as (HP:200 EP:200)?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Thu May 08, 2003 12:55 am   
 


My prompt comes up as
*~HP:200 EP:200~*


Sounds like your reported pattern is false? I test it with #SH and have no issue.
Cut and paste your prompt into that trigger. Replace the numbers with (%d) and put a ~ in front of all the weird characters.

Ton Diening
Reply with quote
gharbad
Newbie


Joined: 07 May 2003
Posts: 8
Location: USA

PostPosted: Thu May 08, 2003 3:57 am   
 
Well this is getting frustrating.. it seems so easy, yet it's still not working.

The pattern is matching, but now it appears that it's not saving the values of Hp and Ep to the variables, or the trigger isn't querying the values when it goes to set the color of the prompt.. any ideas?

Pattern: ~~~* HP:(%d) EP:(%d) ~*~~

#VAR HP %1
#VAR EP %2
#IF (@HP > 45) {#PCOL blue %x1} {#IF (@HP > 30) {#PCOL 10 %x1} {#IF (@HP > 15) {#PCOL 14 %x1} {#PCOL 12 %x1}}}
#IF (@EP > 45) {#PCOL blue %x2} {#IF (@EP > 30) {#PCOL 10 %x2} {#IF (@EP > 15) {#PCOL 14 %x2} {#PCOL 12 %x2}}} {PROMPT}

Do you see any errors on my part?

#SH is not returning colors, either.
Reply with quote
trackmike
Newbie


Joined: 13 Sep 2001
Posts: 8
Location: USA

PostPosted: Thu May 08, 2003 4:50 am   
 
Well, This is a kinda nit-picky answer, but it may well be your problem... ;)

Mud prompt: *~HP:200 EP:200~*
Your trigger: ~* HP:200 EP:200 *~
Reply with quote
gharbad
Newbie


Joined: 07 May 2003
Posts: 8
Location: USA

PostPosted: Thu May 08, 2003 4:57 am   
 
I made a mistake in relaying my prompt in the first few posts.. my triggers and prompt are in sync, but the problem seems to be in the trigger getting the values from the variables, or perhaps sending the values to the variables, thus not allowing the coloring to take effect, as the variables are =0?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu May 08, 2003 1:28 pm   
 
Are you completely sure that the trigger is firing? Try putting a #SH with some message inside the trigger's commands to see if it gets executed.

If your prompt is:
*~HP:200 EP:200~*

then the pattern should be:
~*~~HP:(%d) EP:(%d)~~~*

Kjata
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu May 08, 2003 4:05 pm   
 
Pattern: ~~~* HP:(%d) EP:(%d) ~*~~

#VAR HP %1
#VAR EP %2
#IF (@HP > 45) {#PCOL blue %x1} {#IF (@HP > 30) {#PCOL 10 %x1} {#IF (@HP > 15) {#PCOL 14 %x1} {#PCOL 12 %x1}}}
#IF (@EP > 45) {#PCOL blue %x2} {#IF (@EP > 30) {#PCOL 10 %x2} {#IF (@EP > 15) {#PCOL 14 %x2} {#PCOL 12 %x2}}} {PROMPT}

Delete the part in red. It's not supposed to be part of the trigger Value. Switch to the Options tab. Check the box next to Prompt. You should probably also uncheck the box next to Newline.



LightBulb
Advanced Member
Reply with quote
gharbad
Newbie


Joined: 07 May 2003
Posts: 8
Location: USA

PostPosted: Thu May 08, 2003 9:43 pm   
 
Here is the trigger script:

#VAR HP %1
#VAR EP %2
#SH TRIGGER!!
#IF (@HP > 45) {#PCOL 11 %x1}
#IF (@HP > 30) {#PCOL 10 %x1}
#IF (@HP > 15) {#PCOL 14 %x1}
#IF (@HP < 16) {#PCOL 12 %x1}
#IF (@EP > 45) {#PCOL 11 %x2}
#IF (@EP > 30) {#PCOL 10 %x2}
#IF (@EP > 15) {#PCOL 14 %x2}
#IF (@EP < 16) {#PCOL 12 %x2}

Pasting my prompt into the test field it shows that it matches, but the #SH doesn't show in my output window, and still the colors aren't working.. ideas?

Edit:
Pattern matches! Matching portion is highlighted above.
%1: 44
%2: 50
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