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


Joined: 25 May 2006
Posts: 88

PostPosted: Tue Jan 02, 2007 3:55 pm   

[1.24] Variable creation paths
 
I am having diffuculties in getting variables to be created/modified where I want them to be. I have devised a small test and would like to know if I am doing something wrong or if it is a bug.

Copy the following and paste it into your command line and hit enter:
Code:
#class extender
#class test|nested
#alias test {#var test %1
#var /test1 %2
#var ./test2 %3
#var ./nested/test3 %4
#var /test/nested/test4 %5
#var /extender/test5 %6} "test"

The 'test' alias is situated in the 'test' class - it creates 6 unique variables in different locations.

Next, copy the following and paste it into the command line and press enter:
Code:
test 10 20 30 40 50 60


The Variables created are as follows:

test1 This is as expected
test|nested|test I would expect this to be created in the 'test' class
test|nested|test2 I would expect this to be created in the 'test' class
test|nested|test4 This is as expected
extender|test5 This is as expected

You may also note that the 'test3' variable was not created at all.

How can I force creation of a variable either relative to the location of the creating alias/trigger or in a subfolder of the same without having to specify the location in full?

It seems that the syntax './' is not working as it should.
Reply with quote
Zugg
MASTER


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

PostPosted: Wed Jan 17, 2007 10:33 pm   
 
When you issue the command #class test|nested, you are not only creating that class, but you are setting it as the *current* class.

So, doing #VAR test %1 is going to create /test/nested/test just like it did. That is the correct operation. Try using #CLASS 0 to return to the top level class before running your alias.

The ./ syntax refers to the *current* class. So doing ./nested/test3 is expanded to /test/nested/nested/test3 which is referencing a class that doesn't exist (so test3 isn't created). Remember that /test/nested is your current class!

If you want to perform relative access, use the ../ syntax to refer to the parent of the current class. Works just like unix file names. You just need to remember what the current class is set to.
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