|
zlaker Newbie
Joined: 01 Apr 2003 Posts: 9
|
Posted: Tue Apr 01, 2003 10:07 pm
Questions from a new user |
I've been having some issues setting up some triggers. One goal I'm trying to meet is to set up a list of highlights. One that stores not only the strings to highlight, but the colors to highlight them in. First of all, is it possible to even store a list like this in a nice manner? As in, a list of lists. Each internal list stores the word and the color to hilight in. Or do I have to store it in a manner like the following and just assume odd indicies are color and even indicies are strings:
#VAR hilightList {One|red|Two|green}
Secondly and related, is it possible to use arbitrary colors in hex? I'd assume so, but I haven't been able to figure out how and haven't seen it in the help.
Thrid, is it possible to change the font of a certain block of text with a trigger? Certain things I would like to see in a monospace font while allowing to me to keep my non-monospace font for the rest of the text.
Thanks for any light you can shed on the situation. |
|
|
|
Anabasis Wanderer
Joined: 26 Jan 2001 Posts: 74
|
Posted: Tue Apr 01, 2003 11:50 pm |
Not exactly sure what you are asking for with the highlights, but if you are trying to highlight a list of things, you would use...
#VAR hilight {Joe|Bob|Jill}
#TR {{@hilight}} {#CW Red}
Then you can set up a trigger for each variable list.
Ana |
|
|
|
zlaker Newbie
Joined: 01 Apr 2003 Posts: 9
|
Posted: Wed Apr 02, 2003 12:20 am |
quote:
Not exactly sure what you are asking for with the highlights, but if you are trying to highlight a list of things, you would use...
#VAR hilight {Joe|Bob|Jill}
#TR {{@hilight}} {#CW Red}
Then you can set up a trigger for each variable list.
Ana
Right, and I have done that. But, I would like to dynamically hilite different things in different colors (as in use a list to store the data, not write out different triggers for each one). Say, Joe in red and Bob in green. So, instead of creating a 'blueHiliteList' and a 'redHiliteList' and so forth, I'd like to create one list which stores both the string to hilite and the color to hilite it.
This is where a list of lists would come in handy. If I could, for example create the following list:
, [Bob, green, [Billy, blue]]
Then, create a trigger that matches on the first element of each internal list (Joe, Bob, Billy). If one of those matches, it then hilites the string in the color given by the second element of the internal list (red, green, blue).
The best solution I've come up with is to create two arrays: one which stores the strings to hilite and another which stores the colors to hilite them in. If that's the way it's going to have to be then so be it, but I'm still curious if a list of lists is possible. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Apr 02, 2003 1:43 am |
Yep, you can do that. First, set up a variable:
#variable Highlights {}
Next, add an alias to handle the assignment and set up 2 parameters:
#alias AddHighlight {#if (%numparam() > 1) {#noop you have parameters;#If (%iskey(%1,@Highlights)) {#noop existing color specified;#additem Highlights.%1 %-2} {#noop new color must be created;#addkey Highlights %1 %-2;#if (%trigger(tColor%1)) {#noop do nothing, trigger already exists or is active} {#trigger "tColor%1" {{~@Highlights.%1}} {#cw %1}}}} {#noop hey, dummy, you forgot something}}
A similar alias can be set up to remove or edit items.
As this project currently stands, you are now able to create a data record called Highlights whose keyfields are names or RGB values of colors (ie, mxpblue or 0000FF). Each key will contain a stringlist of words and phrases that you can evaluate in triggers, and when necessary these triggers will be created programmatically through the AddHighlight alias:
#trigger {@Highlights.mxpblue} {#cw mxpblue}
If you wanted to limit yourself to a finite set of colors, the above code would have to be modified to reflect that.
As for the font question, I believe you can do that with MXP.
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
|
|