About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 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
Varazet
Newbie


Joined: 05 Aug 2004
Posts: 5

PostPosted: Wed Mar 02, 2005 9:03 pm   

Word Coloring, Multi-Line Lists and Interuptions, oh my?
 
Alright folks. I am making a two part system for monitoring my skills and spells.


The first part is a simple #PICK, which allows me to check my knowledge tree in categories, or the whole thing.

EX:

Code:
#ALIAS know {#PICK {p:Which Knowledge?:} {o:1} {Skills:~know skills} {Spells:~know spells} {Language:~know language} {All:~know all}}


Upon choosing, say "Skills" for this example I would recieve a list of my skills for that character.

EX:

Code:
Expert mace    master    Expert polearm expert    Expert spear   skilled   
Expert staff   sliver    Expert sword   master    Expert whip    sliver   
Master axe     master    Master dagger  master    Master flail   sliver

Etc.

Now, what I wish to do is color the skill levels (master, expert, sliver, etc.)


Also, a few known issues. Depending on the person's choice in # of scroll lines, their list may be interupted like such:

Code:
Drink mixing   sliver    Draco biology  sliver    Dual wield     expert   
Enhanced damag master    Envenom        sliver    Fire building  sliver   
[Hit Return to continue] <-----Return Prompt
                         <-----Blank Line
Guarding       sliver    Hand to hand   sliver    Unarmed combat sliver   
Hunt           sliver    Kick           sliver    Parry          sliver   


and from time to time a mob will walk through while that idles...



Code:
Enhanced damag master    Envenom        sliver    Fire building  sliver   
[Hit Return to continue]<-----Return Prompt
                                  <-----Blank Line
A Novice of Guerrellewyn leaves west.<---NPC
[Hit Return to continue]<-----Return Prompt
                                  <-----Blank Line
Guarding       sliver    Hand to hand   sliver


So, my questions are these: How can I have it color the words, case sensitive (So Master in Master dagger isn't also colored) and then stop when each listing is done? Also, how can I have it continue through interuptions like Return Prompt, Blank Line or mobs and stop at the right point? Let me know if you need any clarification, I can be neglectful and vague at times.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Mar 02, 2005 11:37 pm   
 
This is a classic case for #PSUB or even a full #SUB.

#trigger {(&14) ({master|sliver|other titles})} {#sub {%1 %ansi(color)%2}}

To make it even more specific, change &14 to a list of all the skills as they appear on on the KNOW list. You can use a stringlist variable if you want so you don't have to include every skill in a miles-long trigger pattern.

I'm not sure if #SUB affects every match in a line so you might need to triple the pattern in order to color everything correctly.
_________________
EDIT: I didn't like my old signature
Reply with quote
Varazet
Newbie


Joined: 05 Aug 2004
Posts: 5

PostPosted: Thu Mar 03, 2005 5:28 am   
 
Alright, I don't quite follow. While trying to understand the formula you have posted, I made a few plugins to see the difference. However, to me it looks the same as if I were to put...

#Trigger {master} {#CW red} {case}

In exception that your formula changes several words the same color. This could have been a problem with my wording. The words, master, sliver etc will have varying colors. Master - red, sliver - yellow for example. The other problem is that the trigger continues to highlight any phrase with "master" in it as opposed to stopping at the end of the list. My main issue is that there is nothing to anchor the end of the list except for a blank line and sometimes that isn't even the case if things are going on.

The only solution I can think of in that sense is if it realized there wasn't anymore sliver, expert, master and the end of the next line. Also, with those return and blank line interupts that can get screwed up. I am not sure how to fix this or if it really can be fixed.

Hope that clears things up a bit. Thank you for the suggestion however. If you have any further suggestions, I am eager to learn.
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Mon Mar 07, 2005 10:53 pm   
 
This solution requires you to know all the skills ahead of time.
Add them to the skillz list variable.
the proficiency variable contains all the possible skill levels.
and the proftocolor record variable maps the proficiency to a specific color.
This trigger is case sensitive so Master will not match master.
It matches when an item of the skillz variable is followed by one or more spaces and then a proficiency word sliver,master etc
we capture the proficiency word which we use to both lookup the correct color and to specify the word to color.


Code:
#CLASS {Test}
#VAR skillz {Expert mace|Master axe|Expert staff}
#VAR proficiency {master|skilled|expert|sliver}
#VAR proftocolor {}
#ADDKEY proftocolor {master=red|sliver=orange|expert=green|skilled=blue}
#TRIGGER {{@skillz}%s({@proficiency})} {#PCOL @{proftocolor.%1} %x1} "" {case}
#CLASS 0
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
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