 |
mjamer Newbie
Joined: 18 Jan 2002 Posts: 8 Location: USA
|
Posted: Mon May 20, 2002 5:05 pm
Colors |
Hi, I recently moved to a new mud that doesn't automatically color fight prompts, or even normal prompts. So I seek help from the experts on how to accomplish this.
My normal prompt (not in battle) is:
<hp:100 mv:100>
I would like to change this so that my numbers are divided in 3rds. For example, when my health is less 33 (67), it turns yellow. Less 33 more, and it turns red. Same goes for movement.. giving me a prompt looking like:
<hp:5 mv:100>
Next is the battle prompt, it is as follows:
<hp:100 mv:100 mob name here:superb player:superb>
The string values after mob and player are as follows: superb, v.good, good, fair, bad, v.bad, awful. I'd like to change the appearance so that superb, v.good, and good == green, fair and bad == yellow, v.bad and awful == red, as well as what we talked about for the initial prompt, giving us:
<hp: 100 mv:50 a grey squirrel:awful player:good>
Any help is appreciated, thanks!
mike |
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon May 20, 2002 7:06 pm |
There are two approaches to this, the first is a #TRIGGER that uses the #SUB command and the %ansi function. The second is a series of #TRIGGERs that use #CW. In either case, you'll need to use #IF, #CASE, %if, or %case to control which colors get used when. The second is easier to understand so I have chosen to go with that.
#TR {hp:(%d)} {#CASE %eval((%1/34)+1) {#CW red} (#CW yellow} {#CW green}} {} {nocr|prompt}
#TR {mv:(%d)} {#CASE %eval((%1/34)+1) {#CW red} (#CW yellow} {#CW green}} {} {prompt|nocr}
#TR {superb|good|very good} {#CW green} {} {prompt|nocr}
#TR {fair|bad} {#CW yellow} {} {prompt|nocr}
#TR {very bad|awful} {#CW red} {} {prompt|nocr}
NOTE: The order of the last two triggers is important. If they are in the order provided you will get "very bad", if you reverse the order you will get "very bad". It all depends on which trigger is overwriting the other.
LightBulb
Vague questions get vague answers  |
|
|
 |
mjamer Newbie
Joined: 18 Jan 2002 Posts: 8 Location: USA
|
Posted: Tue May 21, 2002 1:10 am |
Thank you for your effort LightBulb!
Unfortunately it doesn't work. for say:
<hp:100 mv:100>
It does 2 things. 1) It doesn't apply it to the prompt, but the prompt afterward. 2) it applies the color to the whole thing:
<hp:100 mv:100>
instead of:
<hp:100 mv:100>
What I mean by the prompt is, it comes out like this:
<hp:100 mv:100>hide
You crawl into a corner and remain motionless.
<hp:100 mv:100>
note how the prompt gets applied colors after it scrolls by.
The combat line:
<hp:100 mv:100 mob name here:superb player:superb>
comes out as:
<hp:100 mv:100 mob name here:superb player:superb>
Colors aren't being applied to mob/player status.
Now that I think about it, is there away to create it from the prompt, and #GAG it? say you get:
<hp:100 mv:100 mob name here:superb player:superb>
is there away to turn all that into variables? Since both the combat prompt, and the normal prompt both start with <hp:# mv:# ..., could you then, when grabbing the mob name/player name strings, see if they're non zero length, and apply rest, if not just do normal prompt? like:
<hp:(var) mv:(var) (a mob var):(var) (player):(var)>
That'd be cool.. I'm trying to get this down so I'll be less bothersome in the future. Thanks again! |
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue May 21, 2002 1:33 am |
If it's not being applied to the prompt immediately, it's because you left out the part at the end "{} {nocr|prompt}". This changes the options from the default of "trigger on newline" to "trigger on prompt".
Yes, I realize it will color "hp:" and "mv:", but I didn't think you'd want ALL numbers colored so that's as close as I could come by this method.
The problem with the other triggers is that they need more {}'s. Sorry, I forgot that. I believe 3 sets is what it takes.
#TR {{{superb|good|very good}}} {#CW green} {} {prompt|nocr}
#TR {{{fair|bad}}} {#CW yellow} {} {prompt|nocr}
#TR {{{very bad|awful}}} {#CW red} {} {prompt|nocr}
Feel free to investigate other methods. You can change the text in just about any way you can imagine with the #SUBSTITUTE command, and you can change the color in just about any way you can imagine with the %ansi function. However, as I noted before, these are considerably more difficult to use (increased flexibility = increased difficulty). There are, however, many examples of both within this forum.
LightBulb
Vague questions get vague answers  |
|
|
 |
mjamer Newbie
Joined: 18 Jan 2002 Posts: 8 Location: USA
|
Posted: Tue May 21, 2002 5:25 pm |
Nice, thanks again, that works!
I do have 2 other questions, the use of if (or any combo of), and #gag.
If i get a prompt:
<hp:100 mv:100> you are not in a group
and i'm gagging, I don't see the "you are not in a group"
How do I gag the prompt part, and only the prompt part.. everything after left justified?
Concering the use of #IF, the following is given in the help files:
#IF expression true-command [false-command]
Is there an else? or just do #IF's with no false commands? like:
...
#IF ( (%eval((%1/34)+1)) = 1 )
{ %ansi(high,red)%1 }
#IF ( (%eval((%1/34)+1)) = 1 )
{ %ansi(high,yellow)%1 }
#IF ( (%eval((%1/34)+1)) = 1 )
{ %ansi(high,green)%1 }
...
Something like that...
Thanks |
|
|
 |
Carabas GURU

Joined: 28 Sep 2000 Posts: 434 Location: USA
|
Posted: Wed May 22, 2002 6:15 pm |
#GAG, gags the entire line. For example:
#TRIGGER {Carabas} {#GAG}
This trigger would gag every line that contained Carabas, with no respect to whatever else may be on that line.
#IF syntax:
#IF (expression is true) {THEN} {ELSE}
Real world example:
#IF ("%1"="Zugg") {highfive zugg} {say Go away, %1, I don't like you}
Carabas
------
I like work; it fascinates me. I can sit and look at it for hours.
- Jerome K. Jerome
|
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed May 22, 2002 10:27 pm |
quote:
#GAG, gags the entire line. For example:
#TRIGGER {Carabas} {#GAG}
This trigger would gag every line that contained Carabas, with no respect to whatever else may be on that line.
#IF syntax:
#IF (expression is true) {THEN} {ELSE}
Real world example:
#IF ("%1"="Zugg") {highfive zugg} {say Go away, %1, I don't like you}
Carabas
------
I like work; it fascinates me. I can sit and look at it for hours.
- Jerome K. Jerome
So when one wishes to remove only a part of a line, one should use #SUBSTITUTE or possibly take the backdoor route and use #UNGAG.
li'l shmoe of Dragon's Gate MUD |
|
|
 |
|
|
|
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
|
|