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
patryn
Apprentice


Joined: 26 Sep 2001
Posts: 124

PostPosted: 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.
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: 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 Smile
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
Reply with quote
s004geh
Newbie


Joined: 11 Aug 2003
Posts: 3
Location: USA

PostPosted: 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.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: 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.
Reply with quote
patryn
Apprentice


Joined: 26 Sep 2001
Posts: 124

PostPosted: Fri Jan 14, 2005 10:19 pm   
 
Quick. Simple. Brilliant.

Thanks for the different perspective LightBulb, it works like a charm.

Laughing
_________________
That which does not kill us, makes us stronger.
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