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


Joined: 09 Sep 2005
Posts: 11

PostPosted: Fri Sep 16, 2005 1:59 pm   

Conditional #if for prompt color change
 
This is probably an easy one but I'm trying to fix a trigger so the colors of my prompt change depending on how the line is parsed. Here's an example of how my prompt looks:

(174/190;177/1114;190/190)

The first 174/190 is health, the 174 being current and the 190 being max. I'd like a conditional to check that number and if it's below say 170 to turn white. if it's below 150 to turn yellow, below 130 red.

Could a guru give me an example of how my expression would look?
Reply with quote
xenapan
Wanderer


Joined: 26 May 2004
Posts: 68

PostPosted: Fri Sep 16, 2005 3:13 pm   
 
im not guru but ill have a crack at it. trigger should look like this

~(&chp/&mhp~;&cmp/&mcp~;&cmv/&mmv~)

#IF {@chp<130} {~(#SUB #pcol {red}{@chp}/&mhp~;&cmp/&mcp~;&cmv/&mmv~)}
#IF {@chp<150} {~(#SUB #pcol {yellow}{@chp}/&mhp~;&cmp/&mcp~;&cmv/&mmv~)}
#IF {@chp<170} {~(#SUB #pcol {white}{@chp}/&mhp~;&cmp/&mcp~;&cmv/&mmv~)}

ugh. ok im not sure if that even works since i never mess with coloring that doesnt affect a full line. but chances are you will need to color each of the other things individually. since they will default to the standard text color. id skip all this and use a guage <_<
_________________
Player on Realms of Despair. realms.game.org port 4000. Join us today!
Reply with quote
Mythprod
Beginner


Joined: 09 Sep 2005
Posts: 11

PostPosted: Fri Sep 16, 2005 4:24 pm   
 
xenapan wrote:
im not guru but ill have a crack at it. trigger should look like this

~(&chp/&mhp~;&cmp/&mcp~;&cmv/&mmv~)

#IF {@chp<130} {~(#SUB #pcol {red}{@chp}/&mhp~;&cmp/&mcp~;&cmv/&mmv~)}
#IF {@chp<150} {~(#SUB #pcol {yellow}{@chp}/&mhp~;&cmp/&mcp~;&cmv/&mmv~)}
#IF {@chp<170} {~(#SUB #pcol {white}{@chp}/&mhp~;&cmp/&mcp~;&cmv/&mmv~)}



Your pattern seems to work, I had to take out the tildes. I'm guessing the reason I had to do this was because I have that special character disabled in prefs because my mud uses that character a -lot-.

What I'm really having a problem with is the IF. I have to the argument to parenthesis instead of brackets and have to take out the brackets completely from the true section or I get a syntax error. I'm going through the regular trigger window so I don't know what I'm doing wrong ...
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Fri Sep 16, 2005 4:38 pm   
 
Don't combine #SUB with #PCOL. Use #PCOL to change color of part of the pattern matched, or use #SUB (or #PSUB) to change the whole line and intersperse your color codes. I recommend reading the examples in the help file to get a better idea of how each command works.
Reply with quote
Mythprod
Beginner


Joined: 09 Sep 2005
Posts: 11

PostPosted: Fri Sep 16, 2005 4:39 pm   
 
It's just not working. what's the command to print the value of the @chp variable on screen? I think it's equalling 1 and not the number it takes in from the screen ...
Reply with quote
Mythprod
Beginner


Joined: 09 Sep 2005
Posts: 11

PostPosted: Fri Sep 16, 2005 6:35 pm   
 
I've found in the test tab for the trigger that %2 gets assigned the value I'd like to check to see if it's under a certain amount. Would I use %2 as my variable?
Reply with quote
Mythprod
Beginner


Joined: 09 Sep 2005
Posts: 11

PostPosted: Fri Sep 16, 2005 7:09 pm   
 
well shoot. I figured out my problems. I had some vital special characters disabled in my prefs because my MUD uses them. So I guess my next question is how do I get around that? is there any way to reassign those special characters to something I don't use so my triggers will work? The characters I have to disable for my mud are below:

#
@
~
%
!

I see a use characters from inherited file option, is this what I want to go in and change?
Reply with quote
xenapan
Wanderer


Joined: 26 May 2004
Posts: 68

PostPosted: Fri Sep 16, 2005 7:47 pm   
 
#show @chp should show you the current hp. i wonder if #CW works if at all in this situation? you might want to look into it

as for the ~.. thats the default do not parse character for zmud so that the pattern matches () properly. you might need to put in your new char or else it may not trigger properly.
_________________
Player on Realms of Despair. realms.game.org port 4000. Join us today!
Reply with quote
Mythprod
Beginner


Joined: 09 Sep 2005
Posts: 11

PostPosted: Fri Sep 16, 2005 10:52 pm   
 
xenapan wrote:
#show @chp should show you the current hp. i wonder if #CW works if at all in this situation? you might want to look into it

as for the ~.. thats the default do not parse character for zmud so that the pattern matches () properly. you might need to put in your new char or else it may not trigger properly.


By put in my new character i assume you mean reassign the tilde to something I'm not using so zmud can parse correctly. How do I do that? Do I need to add lines to the zmud.ini file? I see there's a place to redirect the "settings" file but that seems harder than just updating the zmud.ini. I don't see the special characters options inside the zmud.ini so maybe I'm looking in the wrong place? I'd like to override but don't know how.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Sep 17, 2005 3:15 am   
 
To change the quote character:

1)Open up the character in either Connect or Offline mode.

2)Click the giant-sized button that says Prefs and has a checkbox as an image.

3)Scroll down to the Special Characters heading and click on it.

4)where it says "Quote character", which should have a tilde in the accompanying text box, type the new character you want to use (for this example, let's say you are going to use the reverse-apostrophe thing that the tilde key is on)

5)Click Apply (this applies the change while still leaving the window open for more work) or OK (applies the changes and automatically closes the window)
_________________
EDIT: I didn't like my old signature
Reply with quote
Mythprod
Beginner


Joined: 09 Sep 2005
Posts: 11

PostPosted: Sat Sep 17, 2005 3:37 am   
 
Well that was obvious, thanks.

Embarassed
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