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


Joined: 25 Feb 2003
Posts: 10

PostPosted: Tue Jun 15, 2004 2:56 pm   

using %1, %2 with regex's
 
Hey, I just had 2 quick questions about how to use the autoassigned variables when you have a regular expression involving a + or *. If had a trigger that fired on a regular expression like:
(?)+
The idea being, it matches on pretty much anything that has a single character or more. So let's say it recieves sometihng like "abcd". It would assign %1 = a, %2 = b, %3 = c, %4 = d. Let's say I want to loop through and make sure that each one is an 'a' (ya, i know, the regex could be changed to do that, but let's just say). Two questions here.

How do I loop through and check %1, %2, %3, %4 (ie. go through each variable, can I do like %@n and increment @n?)?
And how do I know when to stop (ie. so it doesn't go on to %5...%99)? Is there a way to tell how many variables were assigned?

Thanks guys!!+
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Jun 15, 2004 11:51 pm   
 
I believe %param and %numparams functions work during triggers. Read up on them and do a little testing.
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