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
sda
Wanderer


Joined: 18 Apr 2001
Posts: 55
Location: United Kingdom

PostPosted: Sat Aug 24, 2002 12:16 pm   

Matching @ in triggers
 
v6.16

I wish to capture a block of text which often contains the @ character. However, when my trigger fires, if the line contains an @ it will only match the text up to the @ character. Eg:<br>
Trigger pattern: (*)


29 @*$ Some Player 16 @ Another Player 1 and another

Will only match 29 and the following space, but if the first @ didn't exist it would match up to 16 and the following space.

I need to capture all the lines (about 10) and then parse them. Is there a way I can do this without capturing to a file?

Thanks,
Steve
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Aug 24, 2002 12:35 pm   
 
Use %* instead of *. %* matches zMUD's special characters like @ and ;

However, you must be careful and think thouroughly how you use whatever you capture with %* because if other players can make your trigger fire, they can make your zMUD do stuff. Example:
#TRIGGER {Here you see: (%*).} {#VAR line {%1}}

and then some player in the MUD does:
Player tells you 'Here you see: };remove all;drop all;quit.'

Your trigger will match this and when %1 is expanded inside the variable, the variable gets closed ("}") and then you will remove all, drop all, and quit.

So, when using %*, always anchor your triggers (use ^ to match the beginning of a line and $ to match the end) and think hard about possible ways it could be exploited.

Kjata
Reply with quote
sda
Wanderer


Joined: 18 Apr 2001
Posts: 55
Location: United Kingdom

PostPosted: Sat Aug 24, 2002 2:19 pm   
 
Thank you, it works a treat.

Incidentally, the ^ char for beginning a line is fine, but when I add $ it stops working. As this trigger is only used for a nanosecond when I activate it manually I don't think it can be abused but I am interested in what you say about closing the variable with } automatically.

Thanks,
Steve :)
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