|
Solaras Wanderer
Joined: 11 Mar 2002 Posts: 93
|
Posted: Mon Sep 26, 2005 4:40 am
Help with a prompt trigger, please |
Ok so I am working on having my prompt echo fluctuations in health, mana, and ego. Basically it captures a lasthealth/mana/ego and a currenthealth/mana/ego and then does some math. What I am having trouble with is getting them to display after the prompt in the color I wish. I can get the negative value to display red, but I can't get the positive value to display green, and the neutral value to remain grey. This is what I have so far.
Code: |
#SAYPROMPT %ansi( grey)~ (%if( @differencehealth<0, %ansi( high, red))@differencehealth~h%ansi( grey), %if( @differencemana<0, %ansi( high, red))@differencemana~m%ansi( grey), %if( @differenceego<0, %ansi( high, red))@differenceego~e%ansi( grey)) ~[%time( hh:mm:nn)] |
What I want is if my health has gone down to show it in red, as the code shows, if it goes up to show it in green, and if it remains =0 to remain grey. |
|
|
|
Vorax Apprentice
Joined: 29 Jun 2001 Posts: 198 Location: USA
|
Posted: Mon Sep 26, 2005 6:42 am |
Code: |
#FUNCTION ansicolor {%if( (@difference%{1}!=0), %if( @difference%{1}>0, %ansi( high, green), %ansi( high, red)), %ansi( grey))}
#SAYPROMPT %ansi( grey)~ @ansicolor(health)@differencehealth~h%ansi( grey), @ansicolor(mana)@differencemana~m%ansi( grey), @ansicolor(ego)@differenceego~e%ansi( grey) ~[%time( hh:mm:nn)] |
This will give you the ansicolor function. You can use that to get the appropriate color, which will shorten your #SAYPROMPT quite a bit.
I tested this by creating the variables differencehealth, differencemana, and differenceego with values of 1, 0, and -1 respectively and by using this:
Code: |
#SHOW %ansi( grey)~ @ansicolor(health)@differencehealth~h%ansi( grey), @ansicolor(mana)@differencemana~m%ansi( grey), @ansicolor(ego)@differenceego~e%ansi( grey) ~[%time( hh:mm:nn)] |
The output was:
1h, 0m, -1e [03:42:42] |
|
|
|
Solaras Wanderer
Joined: 11 Mar 2002 Posts: 93
|
Posted: Mon Sep 26, 2005 6:50 am |
Thanks! Works perfect.
|
|
|
|
Vorax Apprentice
Joined: 29 Jun 2001 Posts: 198 Location: USA
|
Posted: Mon Sep 26, 2005 7:17 am |
Perhaps a bit more easy to use...
Code: |
#FUNCTION ansicolor {%concat( %if( (@difference%{1}!=0), %if( @difference%{1}>0, %ansi( high, green), %ansi( high, red)), %ansi( grey)), @difference%{1}%copy( %1, 1, 1), %ansi( grey))} |
Used like this
Code: |
#SAYPROMPT %ansi( grey)~ @ansicolor(health), @ansicolor(mana), @ansicolor(ego) ~[%time( hh:mm:nn)] |
The output is the same. |
|
|
|
|
|
|
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
|
|