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


Joined: 03 Feb 2007
Posts: 62

PostPosted: Wed May 06, 2009 12:49 pm   

Using Zmud trigger parse expressions... {item|item|item}
 
is there a way to check for something like space, or no space?
I want to make triggers with optional params, but I would like to not use (*)

ie:
@leader: assist
@leader: assist joe

I would like to write something like
@leader:{ |}(%w) or @leader:{ (%w)|}
([space]word|[or nothing])
Reply with quote
Leyline
Wanderer


Joined: 03 Feb 2007
Posts: 62

PostPosted: Wed May 06, 2009 12:55 pm   
 
I guess I could settle for regex, 1 space 1 word optional...
but since I am not using any regex I wanted to keep everything uniform.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Wed May 06, 2009 5:01 pm   
 
There's an option, somewhere, to enable wildcards inside {item|item}. It's disabled by default.

However, there are some things that regex is simply better at. Why not use it where it's useful?
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Leyline
Wanderer


Joined: 03 Feb 2007
Posts: 62

PostPosted: Thu May 07, 2009 2:28 am   
 
Oh well, I've had like thousands of lines of zmud script dating all the way back to the early 90's
regex I don't know existed back then...
and I'm not so great at regex so...
I was just saying,

I don't so much need wildcards inside lists, (it should be on)
but what I want is...
a trigger, that accepts params optionally,
but if I code in for the space, the space is required...

so
@leader: heal
or
@leader: heal joe

where heal would default the spell target to myself.
the heal joe would heal joe...
if I do
#trig {@leader: heal (%w)}
the word is optional (%1 will be empty)
but the space between is not...


I said I will throw some regex in here if I have to, I just wondered if there was a zmud syntax to do it,
{ |""} doesn't work, etc.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu May 07, 2009 9:03 am   
 
{whatever|} should work - but if not, just use a regex. You can learn about them here.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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