|
apfinger Novice
Joined: 19 Nov 2006 Posts: 40
|
Posted: 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? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: Mon Nov 20, 2006 5:21 am |
Check to see that the GeneralVariables class is enabled.
|
|
|
|
apfinger Novice
Joined: 19 Nov 2006 Posts: 40
|
Posted: 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? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
apfinger Novice
Joined: 19 Nov 2006 Posts: 40
|
Posted: 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. |
|
|
|
|
|