|
Stregone Wanderer
Joined: 07 Aug 2001 Posts: 53 Location: USA
|
Posted: Tue Feb 18, 2003 10:20 pm
highlighting with MXP? |
Instead of #color? How do you do this? I got it to highlight a simple string (like this: #TRIGGER {Stregone} {#sub {~<color #2108E7>Stregone~</color>}} ), but how can I get it to do something like this: #TRIGGER {* says,} {#CW green} Thanks again... :)
-Stregone |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Feb 18, 2003 11:08 pm |
quote:
Instead of #color? How do you do this? I got it to highlight a simple string (like this: #TRIGGER {Stregone} {#sub {~<color #2108E7>Stregone~</color>}} ), but how can I get it to do something like this: #TRIGGER {* says,} {#CW green} Thanks again... :)
-Stregone
You need to use #SUB or #MXP (a #sub command designed specifically for MXP tag usage):
#trigger {* says,} {#sub {<color green>%trigger</color>}}
An alternate way would be to enclose the variable portions of the pattern in parentheses and then use the appropriate %1...%99 variables and text in place of %trigger. This will allow you to perform any conditional checks prior to the #sub, if needed.
li'l shmoe of Dragon's Gate MUD |
|
|
|
Stregone Wanderer
Joined: 07 Aug 2001 Posts: 53 Location: USA
|
Posted: Tue Feb 18, 2003 11:20 pm |
Spiffy, thanks :)
-Stregone |
|
|
|
Stregone Wanderer
Joined: 07 Aug 2001 Posts: 53 Location: USA
|
Posted: Tue Feb 18, 2003 11:45 pm |
When I use %trigger it colors the entire line. I did it the other way and it worked perfectly :)
-Stregone |
|
|
|
Stregone Wanderer
Joined: 07 Aug 2001 Posts: 53 Location: USA
|
Posted: Wed Feb 19, 2003 1:47 am |
BTW, would several hundred of these kinda triggers cause any noticable slowdowns or excess cpu usage?
-Stregone |
|
|
|
kilthan Wanderer
Joined: 21 Jan 2003 Posts: 76
|
Posted: Wed Feb 19, 2003 5:55 am |
Okay say I have this trigger:
#TRIGGER {rock crystal} and what i want it to do is just highlight crystal and leave rock alone. I've tried using #sub for this but I just get a huge mess. Is there anyway to just highlight crystal?
It would be nice to see #cw operate in a different way. Instead of #TRIGGER {rock crystal} {#cw crystal 13} creating #TRIGGER {crystal} {#cw 13}, it would look for crystal in the trigger pattern and just highlight that. |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Wed Feb 19, 2003 8:25 am |
#TRIGGER {rock (crystal)} {#PCOL mxpblue %x1}
Ton Diening |
|
|
|
kilthan Wanderer
Joined: 21 Jan 2003 Posts: 76
|
Posted: Wed Feb 19, 2003 10:34 am |
Finally I won't have all this other stuff highlighted, thank you.
|
|
|
|
kilthan Wanderer
Joined: 21 Jan 2003 Posts: 76
|
Posted: Wed Feb 19, 2003 11:45 am |
Everything but the crystal is colored with #cw, it works fine when other color highlighting isn't going on, but when there are more than one or two being highlighted the #pcol doesn't work right(#sub is even worse). Guess I will just use #cw for it afterall.
In the soft gem pouch you see a small rock crystal, a small red jasper, a medium red-green bloodstone, a small red-green bloodstone, a small amethyst, a small clear topaz, a small red-green bloodstone, a medium red jasper, a large star diopside, a small red-green bloodstone, a medium star diopside, a medium red-green bloodstone, a small red-green bloodstone, a small rose quartz, a small rose quartz, a medium clear topaz, a small star diopside, a small red jasper, a small green zircon, a small red-green bloodstone, a small red-green bloodstone, a small green zircon, a medium rock crystal, a medium clear topaz, a small rock crystal and a small star diopside.
If I use #pcol for all the gems, nothing at all gets highlighted. |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Wed Feb 19, 2003 1:23 pm |
I can't get it to fail. Here what I test with:
#TRIGGER {test (test1)} {#PCOL mxpblue %x1}
#TRIGGER {test (test2)} {#PCOL mxpblue %x1}
#TRIGGER {test (test3)} {#PCOL mxpblue %x1}
#SH test test1 test test2 test test3
and everything gets colored correctly.
Could you post a way to reproduce the problem? Try posting the triggers (or some of them if they are too much) that have the problem along with some MUD output that causes it to happen.
Kjata |
|
|
|
Stregone Wanderer
Joined: 07 Aug 2001 Posts: 53 Location: USA
|
Posted: Wed Feb 19, 2003 3:15 pm |
Whats the bext way to highlight something that will sometimes appear inside of another string that is also highlighted? This is giving me alot of trouble.
#TRIGGER {(*) says,} {#SUB {<color #33FF08>%1 says,</color>}}
#TRIGGER {({@friends})} {#SUB {<color #2108E7>%1</color>}}
A name in {@friends} is likely to appear in the (*) of the first trigger. When this happens it seems like the </color> tag is ignored in the first trigger, making everything on screen green.
-Stregone |
|
|
|
kilthan Wanderer
Joined: 21 Jan 2003 Posts: 76
|
Posted: Wed Feb 19, 2003 3:25 pm |
In the soft gem pouch you see a small rock crystal, a small red jasper, a medium red-green bloodstone, a small red-green bloodstone, a small amethyst, a small clear topaz, a small red-green bloodstone, a medium red jasper, a large star diopside, a small red-green bloodstone, a medium star diopside, a medium red-green bloodstone, a small red-green bloodstone, a small rose quartz, a small rose quartz, a medium clear topaz, a small star diopside, a small red jasper, a small green zircon, a small red-green bloodstone, a small red-green bloodstone, a small green zircon, a medium rock crystal, a medium clear topaz, a small rock crystal and a small star diopside.
#TRIGGER {rock (crystal)} {#PCOL mxpblue %x1}
#TRIGGER {star (diopside)} {#PCOL mxpblue %x1}
#TRIGGER {red-green (bloodstone)} {#PCOL mxpblue %x1}
#TRIGGER {green (zircon)} {#PCOL mxpblue %x1}
#TRIGGER {red (jasper)} {#PCOL mxpblue %x1}
#TRIGGER {claer (topaz)} {#PCOL mxpblue %x1}
#TRIGGER {rose (quartz)} {#PCOL mxpblue %x1}
Nothing will get highlighted |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Wed Feb 19, 2003 4:31 pm |
what version are you using, kilthan? #pcol is one of the newer commands, i believe. looking at the version history, %x1 etc. was added in 6.20, so if you are using 6.16 that would be a problem.
--------
moon.icebound.net:9000 |
|
|
|
kilthan Wanderer
Joined: 21 Jan 2003 Posts: 76
|
Posted: Wed Feb 19, 2003 4:52 pm |
#pcol works for me just not when many things are being highlighted so closely together. version 6.53 btw
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Wed Feb 19, 2003 7:26 pm |
Stregone's questions really ought to be answered first, since it's his topic.
I'd recommend using the built-in color commands, such as #CW, rather than #SUB with <color> </color>. Also, the color you'll see will be determined by the last trigger to change the color of a word.
Several hundred triggers are bound to require "some" time to process. The real question is whether it will be enough to noticeably slow things down. This will depend on many factors, including your system capabilities and the other demands (mapper, database, multiplaying, other programs running) placed on it. You'll have to answer this for yourself. As a general rule, the more specific a trigger pattern is, the faster it will process.
LightBulb
Advanced Member |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Thu Feb 20, 2003 12:36 am |
There seems to be a bug with #PCOL where it fails or works strangely when the line has been wrapped by zMUD.
Kjata |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Feb 20, 2003 12:52 am |
quote:
I can't get it to fail. Here what I test with:
#TRIGGER {test (test1)} {#PCOL mxpblue %x1}
#TRIGGER {test (test2)} {#PCOL mxpblue %x1}
#TRIGGER {test (test3)} {#PCOL mxpblue %x1}
#SH test test1 test test2 test test3
and everything gets colored correctly.
Could you post a way to reproduce the problem? Try posting the triggers (or some of them if they are too much) that have the problem along with some MUD output that causes it to happen.
Kjata
You are testing with too short of a string, Kjata. #PCOL works flawlessly when the length of the line (this is an important distinction, and it is completely irrelevent what the actual trigger pattern matches or how memory-intensive it is to figure out) containing the trigger pattern is less than or equal to 127 characters. I don't know if this is system dependent or not, but that's what I was able to narrow it down to over here. A length of 128+ characters causes the #PCOL code to not register in the refresh routine at all (meaning that what was supposed to turn blue does not turn blue and instead stays the default color). Beyond this failure to update, it seems that using quotes or other brackets to group text will cause #PCOL to color the entire line (whether it was contained in the pattern or not) the first color specified. If I remember rightly, I think using color attribute words (blink, underline, etc) will also produce this latter behavior--but I can't recall if that was every time they were used or only in conjunction with a bold color.
The same behavior was observed in both a blank character with only the one trigger using #PCOL and an active character with a large array of settings. In both cases, the trigger properly matched the pattern and all other non-#PCOL code was correctly executed. If the #PCOL command was changed to some other coloring command/function, no problems were witnessed.
At the time I discovered this problem I believe I was using 6.39a or 6.40, but Zugg said he didn't see anything wrong with the code (in response to a post of mine in Beta Forum).
EDIT: hmm, I'll have to go back and look again at this, but I do believe this problem also exists in lines without any sort of wrapping by the MUD or ZMud.
li'l shmoe of Dragon's Gate MUD |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Thu Feb 20, 2003 5:25 am |
Heh, then #PCOL is seriously bugged because I am not seeing that behavior at all. I can get #PCOL to work correctly each and every time, with no character limit on the line except that zMUD must not wrap it.
I'm using some sample triggers posted by kilthan in the Beta Forum:
#TRIGGER {rock (crystal)} {#PCOL mxpblue %x1}
#TRIGGER {star (diopside)} {#PCOL mxpblue %x1}
With test text:
#SH You find a small rock crystal, a large star diopside, 5 bronze coins, and 3 copper coins.
This works fine. However, that same test text fails as soon as I go into preferences, disable Auto Wrap, and set the Wrap Column to something like 40. I get the same problem with Auto Wrap enabled, but the window resized so the message it wrapped.
Also, I was able to have #PCOL work correctly with 155 characters in a single line by changing my screen resolution. However, those same 155 characters fail at lower resolutions where zMUD has to wrap the line.
In summary, at least for me, in 6.53, I can't get it to fail in no other way except when zMUD wraps the line.
Kjata |
|
|
|
kilthan Wanderer
Joined: 21 Jan 2003 Posts: 76
|
Posted: Thu Feb 20, 2003 5:30 am |
Not sure if this will matter, but forgot to add I have this trigger also #TRIGGER {coins} {#cw yellow}
|
|
|
|
Stregone Wanderer
Joined: 07 Aug 2001 Posts: 53 Location: USA
|
Posted: Thu Feb 20, 2003 5:34 am |
Hmm, when I first tried it I used a #CW inside of another #CW, and the inner #CW didn't do anything.
take this for example:
#TRIGGER {Also here: (*)} {#CW orange}
#TRIGGER {AFriend} {#CW blue}
will result in something like this:
Also here: Afriend, NotAFriend, and AlsoNotAfriend
when it should (or what I want it to) be like:
Also here: Afriend, NotAFriend, and AlsoNotAfriend
Oof that orange is an ugly shade
-Stregone |
|
|
|
kilthan Wanderer
Joined: 21 Jan 2003 Posts: 76
|
Posted: Thu Feb 20, 2003 7:08 am |
I have the exact same triggers basically and mine work, what do you mean by inside? Make sure the second trigger is below the first trigger so the first one triggers and highlights that line and then the second trigger highlights over that.
|
|
|
|
Stregone Wanderer
Joined: 07 Aug 2001 Posts: 53 Location: USA
|
Posted: Thu Feb 20, 2003 7:29 am |
Ahh, I see. That would explain alot. Thanks :)
-Stregone |
|
|
|
Stregone Wanderer
Joined: 07 Aug 2001 Posts: 53 Location: USA
|
Posted: Tue Feb 25, 2003 8:44 pm |
I finaly got around to actualy trying that, and it doesn't work. The entire line gets highlighted blue.
#TRIGGER {Also here: *} {#CW #FF6600}
#TRIGGER {{@friends}} {#CW #2108E7}
That is the exact order they are in, and it produces something like this:
Also here: NotAFriend, AFriend, NotAfriend
When it should be like this:
Also here: NotAFriend, Afriend, NotAfriend
-Stregone |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Wed Feb 26, 2003 2:34 am |
My guess is that this is a bug.
Kjata |
|
|
|
Stregone Wanderer
Joined: 07 Aug 2001 Posts: 53 Location: USA
|
Posted: Wed Feb 26, 2003 2:48 am |
Okay, I guess I'll post it over in the beta forum...
-Stregone |
|
|
|
|
|