|
patryn Apprentice
Joined: 26 Sep 2001 Posts: 124
|
Posted: Fri Jan 14, 2005 1:42 pm
#cw Trigger |
Having a bit of trouble with the following trigger:
#trig {(%q{@playernames}%q)} {#if %ismember(%1,@wizards) {#cw blue} {#cw orange}}
It works beaut about 95% of the time. The time that it doesnt work so well is when i do a 'qwho' list of the players currently online. The MUD sends all of the player names to the client in one line. Names are separated by spaces.
The problem is that the trigger seems to only process the first name. Then it uses that colour to colour all of the names in the list.
There is a similar command 'who' which gives out the same information. But seemingly a lot slower, and in many separate lines. The trigger works 100% at those times.
Considering this, Im at a loss as to how to get around this problem. |
|
_________________ That which does not kill us, makes us stronger. |
|
|
|
megamog75 Enchanter
Joined: 20 Nov 2002 Posts: 627 Location: USA
|
Posted: Fri Jan 14, 2005 2:24 pm |
I personally don't usually get a #trig to work more than once per line makeing a #trig for Multiple lines is another task altogether
for multiple lines you generally need and opening and closing
have the trig %q whatever
have it turn on another trig that captures everyting that follow until the end of that list then turn off
remove the space replace it with "|"
#forall and your if with maybe a #sub and there you go.
More work then you need
if it's working95% leve it alone :) |
|
_________________ megamog75
I will do this.Nothing in my life matters except this.No moment in my life exists except this moment.I am born in this moment, and if I fail, I will die in this moment. Raistlin Majere |
|
|
|
s004geh Newbie
Joined: 11 Aug 2003 Posts: 3 Location: USA
|
Posted: Fri Jan 14, 2005 3:03 pm |
If the names are separated by spaces, wouldn't you need %s instead of %q? Currently your trigger goes off, captures the whole line because %q does the beginning and ending of the line. Then just works on the first word because of the #CW.
Because the pattern you'd need would probably be something along the lines of (%s{@playername}%s) and this could be set off just about any time a player name occurs, you're probably want to make qwho an alias that turns the trigger on, sends qwho to the mud, and then turns the trigger back off. You could put the trigger in it's own class and turn the class on and off using th #T + annd #T - commands. There may be a more efficient way to accomplish the same effect with trigger states or something, but I haven't kept up with the cutting edge of Zmud technology. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Jan 14, 2005 6:22 pm |
This is an easy problem. You already have a separate variable for wizards, so remove them from the playernames variable and give them a separate trigger.
#TR {%q{@playernames}%q} {#CW orange}
#TR {%q{@wizards}%q} {#CW blue}
Most triggers are only checked once per line. #CW and #SUB create special triggers which are checked multiple times per line. Because they require special processing to work correctly, they should not be combined with other commands. |
|
_________________ LightBulb
Senior member
Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious. |
|
|
|
patryn Apprentice
Joined: 26 Sep 2001 Posts: 124
|
Posted: Fri Jan 14, 2005 10:19 pm |
Quick. Simple. Brilliant.
Thanks for the different perspective LightBulb, it works like a charm.
|
|
_________________ That which does not kill us, makes us stronger. |
|
|
|
|
|