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


Joined: 24 Aug 2002
Posts: 23
Location: USA

PostPosted: Sat Aug 24, 2002 8:42 pm   

Multiple instances on same line
 
To keep this simple I've only included the first 10 levels, which has every instance of the problems I've been having, what I am trying to do is find all percentages in my spells list and color code it, = 100% would be gold, >= 75% would be white, and < 50% would be red, I've got all that worked out, the only problem I am having is capturing multiple values on the same line.

Any thoughts would be welcomed

Level 1: magic missile 15 mana, 75% ventriloquate 5 mana, 75%
Level 2: detect magic 5 mana, 77%
Level 3: detect invis 5 mana, 80%
Level 4: chill touch 15 mana, 75%
Level 5: invisibility 5 mana, 88%
Level 6: faerie fire 5 mana, 83%
Level 7: armor 5 mana, 100% burning hands 15 mana, 75%
Level 8: refresh 12 mana, 75%
Level 9: infravision 5 mana, 75% locate object 20 mana, 76%
recharge 60 mana, 75%
Level 10: fly 10 mana, 82% shocking grasp 15 mana, 75%
sleep 15 mana, 75% word of recall 5 mana, 84%
Reply with quote
mhollis
Beginner


Joined: 24 Aug 2002
Posts: 23
Location: USA

PostPosted: Sat Aug 24, 2002 8:43 pm   
 
-grumbles about spacing being changed- -shrug- thanks again in advance for any replies
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Aug 24, 2002 9:36 pm   
 
0-49% is red, 75-99% is white, 100% is gold, you seem to have left out 50-74%. In order to keep this post to a reasonable size, I'm only doing a few values in each group but the principle should be obvious. I've included two different methods, individual triggers and list triggers.

#CW { 1~%} {red}
#CW { 2~%} {red}
#CW {{ 3| 4| 5}~%} {red}
#CW { 49~%} {red}
#CW { 75~%} {white}
#CW {{ 76| 77| 78}~%} {white}
#CW { 99~%} {white}
#CW { 100~%} {yellow}

I haven't tested this and make no guarantees.

LightBulb
Senior Member
Reply with quote
mhollis
Beginner


Joined: 24 Aug 2002
Posts: 23
Location: USA

PostPosted: Sat Aug 24, 2002 9:41 pm   
 
Ohh? Color words are actually alternate triggers?
Reply with quote
mhollis
Beginner


Joined: 24 Aug 2002
Posts: 23
Location: USA

PostPosted: Sat Aug 24, 2002 9:47 pm   
 
Hmm I just remembered why that wouldn't work, our mud makes alternative uses of percentages, I need it specifically to match those lines

Also to make things more difficult ;) I would prefer not to color the percent sign

Any thoughts?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Aug 24, 2002 10:20 pm   
 
To control the use of these triggers, move them to a class of their own, which will be disabled at logon.
#CLASS SkillColors {disable}
#CLASS 0

You can then use Level 1: as a trigger to enable the class and Level 10: (whatever your highest level is) to disable it.

#TR {^Level 1:} {#T+ SkillColors}
#TR {^Level 10:} {#T- SkillColors}

As for coloring the percent-sign, there's no way around it with this method. If you prefer to use the more complicated #SUB, %ansi() approach go ahead, but you'll have to do it yourself.
Hmmm, you could color the percent-sign itself, if you know what color it would normally be. Make sure this comes after all the other #CW triggers.
#CW {~%} {cyan} {SkillColors}

LightBulb
Senior Member
Reply with quote
mhollis
Beginner


Joined: 24 Aug 2002
Posts: 23
Location: USA

PostPosted: Sat Aug 24, 2002 10:29 pm   
 
Ohh my god how did I miss that, Thank you!
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