Twine 2.0.11, Sugarcube 2
Hi, new here, have been using Twine 2.0 desktop version for almost a month now.
Recently came across a tutorial for object oriented programming for Twine and followed a couple more online resources to update my Twine code.
I am having a problem with "non-updating" properties. Consider the following code in my "StoryInit" passage:
And then I do some changes to the total properties in other passages.
My problem is the $crystal.total still remains zero rather than "auto-calculated" with new values in red, yellow, etc.
Thanks in advance for your help.
Hi, new here, have been using Twine 2.0 desktop version for almost a month now.
Recently came across a tutorial for object oriented programming for Twine and followed a couple more online resources to update my Twine code.
I am having a problem with "non-updating" properties. Consider the following code in my "StoryInit" passage:
<<set $crystal to { red: 0, yellow: 0, white: 0, black: 0, green: 0, get total(){return this.red +this.yellow +this.white +this.black +this.green;}, }>>
And then I do some changes to the total properties in other passages.
<<set $crystal.green+=1>>
My problem is the $crystal.total still remains zero rather than "auto-calculated" with new values in red, yellow, etc.
Thanks in advance for your help.