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


Joined: 17 Oct 2002
Posts: 26
Location: USA

PostPosted: Thu Oct 17, 2002 9:23 am   

Saving MXP string with #VAR
 
Ok. I have my HP/Mana/MV set in the status bar. I want it to color my HP red when it gets below 150. I've written the following trigger to save the @var's for it, though I can't seem to make the #VAR store the "<" or ">" in that string.

- Trigger -
Pattern: <(%d)hp (%d)m (%d)mv>
Value:
#VAR hp %1
#IF (%1<=150) {#VAR hp {<b><color red>@hp</color></b>}}
#VAR mn %2
#IF (%2<=50) {#VAR mn {<b><color blue>@mn</color></b>}}
#VAR mv %3
#IF (%3<=100) {#VAR mv {<b><color yellow>@mv</color></b>}}

- Status Bar -
Status Line: Hp: @hp Mana: @mn Mv: @mv

When the variable gets stored it looks like this:
Name: HP
Value: bcolor red433/color/b

How do I get the variable to store as:
Name: HP
Value: <b><color red>433</color></b>

Thanks,
MadBomber
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Oct 17, 2002 11:30 am   
 
#IF (%1<=150) {#VAR hp {%concat("<b><color red>",@hp,"</color></b>")}}
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Oct 17, 2002 5:09 pm   
 
Put the colors in the status line instead of the variable.

#ST {Hp: %if(@hp < 151, ~<b~>~<color red~>)@hp%if(@hp < 151, ~<~/color~>~<~/b~>) Mana: @mn Mv: @mv}

I'll leave you to figure out the others, assuming it works.

Alternate method:
#ST {Hp: %if(@hp < 151, %ansi(high,red))@hp%if(@hp < 151, %ansi(black)) Mana: @mn Mv: @mv}

NOTE: < and > are special characters which zMUD uses as delimiters. If you want zMUD to treat them as characters, you have to preface them with the ~ character.

LightBulb
Senior Member
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Oct 17, 2002 11:43 pm   
 
quote:

Put the colors in the status line instead of the variable.

#ST {Hp: %if(@hp < 151, ~<b~>~<color red~>)@hp%if(@hp < 151, ~<~/color~>~<~/b~>) Mana: @mn Mv: @mv}

I'll leave you to figure out the others, assuming it works.

Alternate method:
#ST {Hp: %if(@hp < 151, %ansi(high,red))@hp%if(@hp < 151, %ansi(black)) Mana: @mn Mv: @mv}

NOTE: < and > are special characters which zMUD uses as delimiters. If you want zMUD to treat them as characters, you have to preface them with the ~ character.

LightBulb
Senior Member



ZMud uses < and > to force expansion. Quoting them when this option is turned on will not work in variables. It can be disabled by unchecking the "Allow <> for expansion" option in the Script Parser Preferences.

li'l shmoe of Dragon's Gate MUD
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