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
Babyl
Beginner


Joined: 15 Oct 2000
Posts: 24
Location: USA

PostPosted: Sat Jul 19, 2003 11:25 pm   

Question about semi-colon in a trigger
 
trigger is this

#tri {(%w) (%w) '(*)'} {#cap chatter}

if i get this from the mud....

Jobob narrates 'i l;ike this mud!'

the trigger does not match, is this a bug, or is there a way around this?

thanx,
Babyl
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Jul 19, 2003 11:41 pm   
 
It's not a bug, it's intentional. Since ; is the command separator, matching this character and using what was matched in the trigger might allow others to execute code in your zMUD. There is a way around this. First, if you are not doing anything with what a wildcard matches, then there is no need to surround it in parenthesis. You pattern now becomes:
%w %w '*'

Next, since * will not match a ;, you need to use a wildcard that does match it. %* is the one that does this. This is not easily found in the help file because it is a possible security risk. However, if you are not doing anything with what it matches, then it is safe to use it. Your pattern would then be:
%w %w '%*'

If you do need to use what this wildcard matches, you must never surround it in parenthesis and use %1..%n to access it. The only safe way to this would be like:
%w %w '&%*{message}'

which would save what %* matches to variable named @message and you would access it with:
%expand(@message, 1)

So basically, you can match ;'s, but you must be very careful how you do it.
Reply with quote
Babyl
Beginner


Joined: 15 Oct 2000
Posts: 24
Location: USA

PostPosted: Thu Jul 24, 2003 5:26 am   
 
Thanks a lot, this is a big help! One more question, is capturing to a seperate window considered, using? Or is that a safe command to use on it?
Babyl
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jul 24, 2003 10:41 am   
 
#CAPTURE captures the entire line, not just the part of it that matches the trigger. This means your trigger pattern doesn't need to match the entire line, so you don't need to use * at all.
#TR {^%w %w '} {#CAP chatter}
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