So I am having a problem right now where code is misbehaving on me.
I have this code that tests whether or not you need to repair the ship in my game:
It doesn't work. So I decided to add a thing to print out the value of $HPmax because I had a hunch that was the problem.
All of a sudden it works fine.
I have another case where the same thing is happening (strangely enough with the same $HPmax variable.) This code sets the HP to the maximum amount of HP.
This makes $HP show up as 0 every time. But when I add a test to see what the value of $HPmax is, all of a sudden it works.
Anyone have any idea why this would happen? Why would displaying the variable change the value of that variable?
I hope I am explaining this well...
I have this code that tests whether or not you need to repair the ship in my game:
(if: $HP is $HPmax)[The Pequod does not need repairs. [[Sail forward|SailForward]] [[Sail back|SailBack]] [[Build|Build]]]
It doesn't work. So I decided to add a thing to print out the value of $HPmax because I had a hunch that was the problem.
$HPmax (if: $HP is $HPmax)[The Pequod does not need repairs. [[Sail forward|SailForward]] [[Sail back|SailBack]] [[Build|Build]]]
All of a sudden it works fine.
I have another case where the same thing is happening (strangely enough with the same $HPmax variable.) This code sets the HP to the maximum amount of HP.
{(set: $HP to $HPmax) (set: $RepairKit to $RepairKit-1)} HP: $HP Morale: $MORALE
This makes $HP show up as 0 every time. But when I add a test to see what the value of $HPmax is, all of a sudden it works.
{(set: $HP to $HPmax) (set: $RepairKit to $RepairKit-1)} Maximum HP: $HPmax HP: $HP Morale: $MORALE
Anyone have any idea why this would happen? Why would displaying the variable change the value of that variable?
I hope I am explaining this well...