Hello!
I'm experiencing some strange behavior with the global variable scope provided by DialogActions.
What I want to do:
Use an object variable to pass state between different dialogues.
I'm using the REGISTERGLOBALS / LOADGLOBALS triggers for this.
What I experience with numeric properties is that they get converted to type string.
Attached is a stripped down example which can be used to reproduce the issue.
The main dialogue initializes a numeric 'game.progress' variable with value 0 and loads another dialogue (Scene1.txt).
Here I increment the progress variable by 5 and switch to Scene2.txt, which increments progress by 1 and switches back to Scene1.txt
Before switching scenes the value of the progress variable is printed to the screen.
What I expect to see is this sequence of progress values: 0, 5, 6, 11, 12, 17, ...
What I get is: 0, 05, 051, 0515, 05151, 051515, ...
So, there's string concatenation happening instead of addition.
DialogueChecker doesn't report any problems.
It would be awesome if someone could take a look at this and tell me what I'm doing wrong.
I'm experiencing some strange behavior with the global variable scope provided by DialogActions.
What I want to do:
Use an object variable to pass state between different dialogues.
I'm using the REGISTERGLOBALS / LOADGLOBALS triggers for this.
What I experience with numeric properties is that they get converted to type string.
Attached is a stripped down example which can be used to reproduce the issue.
The main dialogue initializes a numeric 'game.progress' variable with value 0 and loads another dialogue (Scene1.txt).
Here I increment the progress variable by 5 and switch to Scene2.txt, which increments progress by 1 and switches back to Scene1.txt
Before switching scenes the value of the progress variable is printed to the screen.
What I expect to see is this sequence of progress values: 0, 5, 6, 11, 12, 17, ...
What I get is: 0, 05, 051, 0515, 05151, 051515, ...
So, there's string concatenation happening instead of addition.
DialogueChecker doesn't report any problems.
It would be awesome if someone could take a look at this and tell me what I'm doing wrong.
Attachments
TestGlobals.zip
1.3 KB · Views: 168
1.3 KB · Views: 168