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
Qiz
Novice


Joined: 14 Aug 2006
Posts: 34
Location: Sweden

PostPosted: Mon Aug 14, 2006 8:37 am   

#VAR has varying behaviour, zMud v7.21
 
First, consider:
#VAR testVar 1
Now, there's a variable, testVar, belonging to no class and having the value 1

#VAR testVar 2
Now, there's a variable, testVar, belonging to no class and having the value 2


Now, consider:
#VAR classVar 1 "" TestClass
Now, there's a variable, classVar, belonging to TestClass having the value 1

#VAR classVar 2 "" TestClass
Now, there are TWO variables, classVar1, belonging to TestClass. One is having the value 1, the other is having the value 2

By checking either #VAR or bringing up the variable window and navigating to the TestClass, zMud shows the two different variables with the same name.
By entering @classVar as a command, zMud evaluates it to NULL, or possibly an empty string.


Am I missing something here? I'd rather not be forced to have all variables belonging to no class if it's unavoidable.

/qiz
Reply with quote
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Mon Aug 14, 2006 11:35 am   
 
I only get one variable of testVar (equal to 2) in no class and one variable of classVar in TestClass, being equal to two. I don't know why you are getting two separate variables.
Reply with quote
Qiz
Novice


Joined: 14 Aug 2006
Posts: 34
Location: Sweden

PostPosted: Mon Aug 14, 2006 9:51 pm   
 
Thanks for your input. It made me go back and recreate the code which solved the problem... sort of.

The above was just an example, what I actually have is an alias setAdeptSpells like this:
#VAR firstSpell %1 "" AutoAdeptClass
#VAR secondSpell %2 "" AutoAdeptClass

Now, the above is a fully working version, which modfies any existing firstSpell and secondSpell variables with new values, or create new ones.
Below is the initial alias which was also called setAdeptSpells looking like this:
#VAR firstSpell %1 "" AutoAdeptSpell
#VAR secondSpell %2 "" AutoAdeptSpell

And this second version does not modify existing variables, it creates a second copy. Yup, it sure does look to be the exact same thing as the working version. This second alias is now stored in a new alias called "unsafe" and created by copy-pasting from the original alias. The problem remains with this one. While it has no "lasting effect" as I simply solved it by typing the code anew, I find it damn annoying to not know what's wrong here. Both of the above versions have been copy pasted, so there is no possibility of a typo in this post either.

Any suggestions on what's up?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Aug 14, 2006 10:04 pm   
 
I've never, ever seen this behavior before. Unless there's some other portion of your alias that's causing the error, my guess would be that your problems exist because %1 and %2 aren't in proper quotes or brackets. Spaces within those variables can mess with the execution of the command and produce unexpected behavior.
_________________
EDIT: I didn't like my old signature
Reply with quote
Qiz
Novice


Joined: 14 Aug 2006
Posts: 34
Location: Sweden

PostPosted: Tue Aug 15, 2006 12:42 am   
 
Thanks, I'll see if adding brackets around that will help. The new, and previously working, alias has started acting up in the same way as well. And there is no other code in this alias than what is posted above.
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Tue Aug 15, 2006 3:20 am   
 
#VAR firstSpell %1 "" AutoAdeptClass

Should be

#VAR firstspell {%1} "" {AutoAdeptClass}

i would think
_________________
Confucious say "Bugs in Programs need Hammer"
Reply with quote
Qiz
Novice


Joined: 14 Aug 2006
Posts: 34
Location: Sweden

PostPosted: Tue Aug 15, 2006 8:02 am   
 
Well, adding {} does not sort the problem. It actually creates problem instead as firsSpell then gets assigned things like "{'continual light'}" which ends in my trigger ends up with "cast {'continual light'}" instead of "cast 'continual light'". Besides, curly brackets or not, I still get multiple copies of the variables in the AutoAdeptClass.

I finally resorted to changing the alias to:
#UNVAR firstSpell AutoAdeptClass
#UNVAR secondSpell AutoAdeptClass
#VAR firstSpell %1 "" AutoAdeptClass
#VAR secondSpell %2 "" AutoAdeptClass

That solves my problem, though I still don't understand the why of it.
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