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


Joined: 21 Oct 2003
Posts: 21
Location: USA

PostPosted: Tue Oct 28, 2003 6:03 am   

Setting specific language to a color
 
Hello everyone.

Thanks for the help on the last topic, I appreciate it.

I'm back with another question, though.

I know it can be done..I just don't know how...

Using ANSI colors, how can I get specific text to show up in specific colors?

I have my prompt setup to look like this:

H:80/81 Ma:33/128 Mv:95/200 Mob: wounded >

What I'd like to do is have the mob status show in different colors as it gets progressively..um..dead-er :)

For example..it would start off green at "few scratches"..get do, say, yellow, for "wounded" and red for "badly wounded" / "awful".

Thanks so much for the help!
Reply with quote
IceChild
Magician


Joined: 11 Oct 2000
Posts: 419
Location: Post Falls, ID, USA

PostPosted: Tue Oct 28, 2003 6:42 am   
 
First, a trigger on your prompt:

Pattern:
Mob~: @(*)MobStatus ~>

Then, a simple little check:

#IF (@MobStatus = "few scratches") { #cw %color(green,black) } { #IF(@MobStatus = "wounded") { #cw %color(yellow,black) } { #IF((@MobStatus = "awful") or (@MobStatus = "badly wounded")){ #cw %color(red, black) } {}}}

Something like that should work (warning, I just pulled this outta nowhere, it's not debugged, but it should work unless my brain is hosed.)
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Oct 28, 2003 9:53 am   
 
#TR {H:%d/%d Ma:%d/%d Mv:%d/%d Mob: (*) ~>} {#IF ("%1" = "few scratches") {#PCOL hi,green %x1};#IF ("%1" = "wounded") {#PCOL yellow %x1};#IF (("%1" = "badly wounded") OR ("%1" = "awful")) {#PCOL hi,red %x1}} {} {prompt}

Editor Version
Pattern:
H:%d/%d Ma:%d/%d Mv:%d/%d Mob: (*) ~>
Value:
#IF ("%1" = "few scratches") {#PCOL hi,green %x1}
#IF ("%1" = "wounded") {#PCOL yellow %x1}
#IF (("%1" = "badly wounded") OR ("%1" = "awful")) {#PCOL hi,red %x1}
Options:
Prompt
Reply with quote
Garrison
Beginner


Joined: 21 Oct 2003
Posts: 21
Location: USA

PostPosted: Tue Oct 28, 2003 11:28 pm   
 
Well...chalk this up to being a noob with zMUD..

But what's the #TR ?

Where would I put that info?

Do I actually put all of that info into the Pattern as well, just as you typed it?

I figured out the Value and the Options alright...that was pretty self explanatory :)

Thanks again for the help!
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Oct 29, 2003 1:40 am   
 
#TR is the shortened name of #TRIGGER. If you use that, all that's needed is to copy the entire line (from #TR to {prompt}) to the command line.

If you use the editor, the pattern is the line under Pattern:. I thought that was just as obvious as the Value and Options.
Reply with quote
Garrison
Beginner


Joined: 21 Oct 2003
Posts: 21
Location: USA

PostPosted: Wed Oct 29, 2003 2:33 am   
 
I figured that's what you meant...but I just wanted to make sure :)

So..I go in and try the Editor route:

Triggers button
New
Pattern:
H:%d/%d Ma:%d/%d Mv:%d/%d Mob: (*) ~>
Value:
#IF ("%1" = "few scratches") {#PCOL hi,green %x1}
#IF ("%1" = "wounded") {#PCOL yellow %x1}
#IF (("%1" = "badly wounded") OR ("%1" = "awful")) {#PCOL hi,red %x1}
Options:
checked "Prompt" (fyi, New Line was already checked)
Saved

Went and attacked something...but no colors.

So where did I go wrong?

Thanks again for helping the noob! :)
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Oct 29, 2003 5:56 am   
 
Yes, I knew that Newline was already checked, that's a default condition. I meant for it to stay that way since I didn't say to change it.

I can't tell where you went wrong, it works for me. Some possibilities are:
You didn't put in enough spaces between items
You changed the Newline option
You have an earlier version which doesn't include #PCOL

The Newline option comes into play when the prompt appears on the same line with other MUD output.
Reply with quote
Garrison
Beginner


Joined: 21 Oct 2003
Posts: 21
Location: USA

PostPosted: Tue Nov 04, 2003 6:23 pm   
 
This is rather weird...

The colors and coding works (cheers LightBulb!)...but it doesn't work every time..which is odd.

Any thoughts as to why?
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