0 votes
by (140 points)
Alright... So I have stumbled upon another issue.

So, I have a InitializationPassage with the startup tag where I register all my variables, but I have noticed something just now and I don't understand why this happens.

The two variables that matter in this scenario are the following:

(set: $level to 0)

(set: $hitpoints to $level * 8)

Now, in the startup passage I modified level to be 1 (also with set) and had a print below it for the hitpoints. The hitpoints stayed at 0.

Once I changed the level variable manually in the startup passage, the hitpoints were displayed correctly, but that sadly doesn't help me much.

What am I missing? Any way to make this work?

Thank you.

1 Answer

+1 vote
by (61.3k points)
If you're expecting the $hitpoints variable to dynamically monitor and adjust to the changing value of $level, that won't happen. The value of $level was 0 when the second set was called, and 0 * 8 is 0. The $hitpoints variable therefore contains the number 0, and will continue to be 0 until you change its value with another set macro.
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.