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


Joined: 19 Nov 2006
Posts: 40

PostPosted: Sun Nov 19, 2006 6:14 pm   

Why are the wrong variables used?
 
I just acquired the new Zmud - last one I used was 6.16 a few years back. When I create objects (variables, triggers, classes, etc) I use the graphical interface and less often the actual command prompt instructions.

In the class called "VariableAssignments" I have a trigger for my prompt:

Pattern:
<%w (%d)hp (%d)mana (%d)mv

Command:
HPCur = %1
ManaCur = %2
MvCur = %3

In a seperate class called "GeneralVariables" I have the above variables defined (HPCur, ManaCur, and MvCur)

Problem - when the trigger fires, the root folder creates the variables again, so the preexisting variables are never updated.

Question - how can I point the trigger commands to the appropriate class folders to update the correct variables?

I tried changing the command line to:
GeneralVariables/@HPCur = %1

but that resulted in a syntax error.

Any ideas?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Nov 19, 2006 6:30 pm   
 
ZMud shouldn't care which class folder the variable is in, so long as the folder is enabled. If it's creating new variables and the appropriate folder is turned on, you probably are operating with a syntax error somewhere.
_________________
EDIT: I didn't like my old signature
Reply with quote
Zhiroc
Adept


Joined: 04 Feb 2005
Posts: 246

PostPosted: Mon Nov 20, 2006 5:21 am   
 
Check to see that the GeneralVariables class is enabled.
Reply with quote
apfinger
Novice


Joined: 19 Nov 2006
Posts: 40

PostPosted: Sat Dec 02, 2006 5:29 am   
 
Here's another example. I haven't resolved this issue. I verified the appropriate classes have been enabled, but for some reason Zmud is still creating variables in the root directory rather than using the existing variables.

I have a class called 'Hunger'

In that class is a variable called 'SteakTimer' with a default value of 0.

I have a trigger for the text "TICK IN 5 SECONDS" which performs the following action:

#ADD SteakTimer 1
#IF (@SteakTimer > 3) {
take steak pack
eat steak
@SteakTimer = 0
}

The #ADD function properly updates the existing 'SteakTimer' variable. However, when SteakTimer > 0, Zmud executes the code within the #IF statement and ends up creating a new variable called SteakTimer. Once the new variable is created, it stops using the original variable.
I'm a bit perplexed. If Zmud doesn't care which folder the variable resides, I see no reason in the code snippet above that should tell Zmud to create a new variable. It certainly recognizes the original variable, since #ADD increments it properly.
A large portion of my file is migrated from v6.16 - would syntax discrepencies in other parts of the file cause this, even though those other parts are completely unrelated?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Dec 03, 2006 5:24 am   
 
@SteakTimer = 0

Your problem is right there. Using the a=b syntax requires you drop the @ from the variable name or else Zmud thinks you want to create a new variable (although, actually, it usually just resets the entire variable from what I've seen rather than creating new variables).
_________________
EDIT: I didn't like my old signature
Reply with quote
apfinger
Novice


Joined: 19 Nov 2006
Posts: 40

PostPosted: Sun Dec 03, 2006 5:52 am   
 
Thanks! That resolved the issue.

I'm guessing my 6.16 files were working by coincidence, since you mentioned Zmud would usually just overwrite the old variable instead of create a new one. I'll be cleaning up those old files. The only other issue I should have is changing all of my | to /.

Thank you again.
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