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
joejoe
Newbie


Joined: 21 Sep 2002
Posts: 8

PostPosted: Fri Dec 20, 2002 8:52 pm   

trigger & patternmatching
 
hi forum,
i have a hard time doing the following:
i have a nice little trigger to put roomnames to a text file for reference, done with a trigger like (*) ~[ (*)~] - the parantheses are sent after every roomname one my mud, the first * should capture the roomname itself.
This works just fine except for cases where the name includes chars like & (the string gets cut after the &, the first part is dumped), commas aren't captured too...
I hope the problem is clear, of course the question is: what pattern would match just every char from 0 to 255 if * doesn't? :)
thanks,
joe
Reply with quote
joejoe
Newbie


Joined: 21 Sep 2002
Posts: 8

PostPosted: Fri Dec 20, 2002 9:06 pm   
 
ok - %* seems to do the job. Just saw it in another post on the board. Zugg might want to add a hint to this to the patternmatching section of the helpfiles. :]
joe
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Dec 20, 2002 9:24 pm   
 
%* is not for everyone to use. That is why it is not mentioned so much. Misuse of this wildcard may lead to people exploiting your triggers and doing bad stuff to you. For example, let's take your pattern:
#TRIGGER {(%*) ~[(*)~]} {#VAR roomname %1}

and now comes someone in the MUD and tells you this:
Kjata tells you 'nothing;remove all;drop all;quit [some more fake text]'

Your trigger will fire on this line and %1 will be:
nothing;remove all;drop all;quit

When this is replaced in #VAR, it ends up like this:
#VAR roomname nothing;remove all;drop all;quit

You can guess what will happen when zMUD executes this. For this reason, you must be extra careful when usin %* and think of any possible way that your trigger might be exploited.

Kjata
Reply with quote
joejoe
Newbie


Joined: 21 Sep 2002
Posts: 8

PostPosted: Fri Dec 20, 2002 10:38 pm   
 
thanks - thats a point.
All i need to do now is filter the ; from %1 before assigning it and it should be safe right?
joe
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Dec 20, 2002 10:52 pm   
 
That's an option. You might also want to stop your trigger from firing on output from other users by using ^ and $ to denote the beginning and ending of the line.

Kjata
Reply with quote
AzCowboy
Adept


Joined: 09 Nov 2000
Posts: 222
Location: USA

PostPosted: Sat Dec 21, 2002 2:10 am   
 
Heh.. how about in my mud where users have access to the ECHO command? *grin* Yeah, it puts the persons name at the end of the echo, to minimize abuse, but.....
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