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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
werepixie
Newbie


Joined: 04 Apr 2007
Posts: 5

PostPosted: Sun May 11, 2008 7:43 pm   

[2.25] Local Variable issue
 
Ok I have an alias that is set up to create a trigger with specific settings. This worked just fine in the 2.18 version however since upgrading to 2.25 when I try this instead of creating the trigger on what should be the value of local variable of $Name it creates a trigger called $Name. Has something changed that I'm not aware of and there is an easy fix or is this a bug?


alias AHU with a parms set for $Name

#TRIGGER {$Name} {cHunters} {colours.Hunters} 645


I did also try changing {$Name} to {%1} and it just created a trigger called %1 with as the pattern and cHunters as action in the colours.Hunters class folder.

Any help would be appreciated
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sun May 11, 2008 8:44 pm   
 
Confirmed. I expect it's a bug.

What's the 645 at the end for, btw?
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
werepixie
Newbie


Joined: 04 Apr 2007
Posts: 5

PostPosted: Sun May 11, 2008 8:53 pm   
 
It's to set the check boxes like Case Sensitive, Trigger on Trigger, and Trigger on New Line
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Mon May 12, 2008 12:19 am   
 
I don't know whether it worked on 2.18 or not, I'll take your word for it. However, the correct syntax would be:
Syntax: #TR id {pattern} {commands} classname options
So the trigger should be coded like so:
Code:

#TRIGGER $Name {cHunters} {colours.Hunters} 645


I disagree that it is a bug. There is no particular reason to enclose the ID in brackets and doing so makes CMUD think that there is no ID. It places the trigger with pattern $Name in the folder colours.Hunters. If you'll notice, the Editor colors it in the way I suggest CMUD understands what you are saying.

I am sure that you people can read better than I because from reading the help file I don't see how your syntax is correct. Of course, it could be the case that the writer of the help file forgot to indicate that brackets around the ID were optional.
_________________
Sic itur ad astra.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Mon May 12, 2008 12:56 am   
 
His syntax doesn't specify an ID, Anaristos, and it does so deliberately - the intention, I think, is to have the alias define the pattern of the trigger. The bug is that the $Name variable (because it is one) isn't expanded when the trigger's created.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Mon May 12, 2008 1:36 am   
 
OK This Works:
Code:

#VAR Name "This is a test pattern"
#TRIGGER {@Name} {cHunters} {colours.Hunters} 645

Maybe the bug is not with the trigger but with CMUD not wanting to interpret the local variable.

EDIT: Come to think of it, why is it a bug that you have to use an external variable? I mean, a local variable would resolve the trigger pattern at compile time, IMO. While with the #VAR you can modify the trigger dynamically. If CMUD 2.18 allowed this, then maybe the bug was in that version.
_________________
Sic itur ad astra.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon May 12, 2008 2:09 am   
 
Actually, what also works (so that you can continue to use local variables) is this:

#EXEC {%concat("#TRIGGER {",$Name,"} {cHunters} {colours.Hunters} 645")}

*shrug*

Charneus
Reply with quote
werepixie
Newbie


Joined: 04 Apr 2007
Posts: 5

PostPosted: Mon May 12, 2008 5:22 am   
 
Thank you Charneus. That does at least let it function.

Just kind of annoying that this is the third incarnation of that same alias.

Code:

ZMud
#TRIGGER {%1} {cHunters} {colours.Hunters} 645

CMud < 2.25
#TRIGGER {$Name} {cHunters} {colours.Hunters} 645

CMud 2.25
#EXEC {%concat("#TRIGGER {",$Name,"} {cHunters} {colours.Hunters} 645")}


This is an alias that I typically use multiple times daily so it most definitely worked fine in 2.18 with that syntax. Easy enough to update to the syntax that you gave though if that's the proper fix.


Also Anaristos using the syntax of #TRIGGER $Name {cHunters} {colours.Hunters} 645 caused it to do absolutely nothing. Thank You though.


Thanks to all for the help.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Mon May 12, 2008 5:46 am   
 
If you don't want to use the #EXEC {%concat("#TRIGGER {",$Name,"} {cHunters} {colours.Hunters} 645")}, you can switch from a local variable to standard variable and just do #TRIGGER {@Name} {cHunters} {colours.Hunters} 645.
_________________
Sic itur ad astra.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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