Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4715
Location: Pensacola, FL, USA

PostPosted: Sat Apr 12, 2008 7:22 pm   

[2.22] $
 
Using $ in a trigger pattern to capture multiple lines will give you an error on the 'Compiled Pattern' tab, because it thinks the user is trying to use a local variable.

It still runs fine.
_________________
Discord: Shalimarwildcat
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Apr 23, 2008 7:44 pm   
 
Hmm, true. That might be a hard one to fix in the parser since it's such a special case. Especially since it's ambiguous whether you are really using a local variable or not.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4715
Location: Pensacola, FL, USA

PostPosted: Wed Apr 23, 2008 8:01 pm   
 
I don't think it should be looking for a local variable in the pattern.

At no time should it be possible for it to have a definition when the trigger fires.
_________________
Discord: Shalimarwildcat
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Apr 23, 2008 8:13 pm   
 
($localvar:test) is why it's looking for them - it needs to do so. Perhaps if it were (?$localvar:test)? Fits with the var=value syntax, too.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Apr 23, 2008 8:30 pm   
 
Shalimar: That isn't true. There are several cases where you would want a local variable in a trigger pattern if you were defining your own triggers dynamically:
Code:
$target="Zugg"
#TRIGGER {$target tells you} {#show fired}

That's just a simple case, but there is no way I can remove this since local variables are always expanded within {} and it would be a huge kludge to disable this for trigger patterns.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4715
Location: Pensacola, FL, USA

PostPosted: Wed Apr 23, 2008 9:45 pm   
 
Zugg, thats at creation.

if at some later point you saw

Zugg tells you, "Hi!"

Would $target still be defined as Zugg for it to match?

And if so, how is it the definition being retained between settings?

I though local variables were only defined for the duration of the single setting they are defined in.

Now if you could define a local variable in your room script and have that value remain in memory as long as you stay in that room, i could see it being possible.
_________________
Discord: Shalimarwildcat
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Apr 24, 2008 12:24 am   
 
Also for ($localvar:test) I would suggest just letting it go, and having the background regex system handle it. Named captures exist now, and the list of names is available after pattern compilation.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Zhiroc
Adept


Joined: 04 Feb 2005
Posts: 246

PostPosted: Thu Apr 24, 2008 2:54 am   
 
Perl lets you put a '\n' in a pattern, such as /line1\nline2/. That might be the syntax you want to support, but it doesn't work in CMUD. It does work in a zMUD REGEX trigger though.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Apr 24, 2008 5:15 am   
 
Yes, my example was only for creation. But it shows that the $ is a valid character in the trigger pattern for a local variable reference.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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