"Double" problem #1266
Replies: 2 comments 1 reply
-
Perhaps this helps :https://docs.textadventures.co.uk/quest/using_doubles.html |
Beta Was this translation helpful? Give feedback.
-
I have wondered if it might make sense for the Quest scripting language to have some bignum decimal type; to make it easier for beginners without programming experience (who seem to be the target audience). I know that in Perl, if I want to play around with arbitrary decimals and not worry about rounding errors, I can just put |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
So I have double-type attribute as the player status attribute, but when it changes, there will be too many decimal numbers for some reason.
Setup:
player.changedhealth:
Timer (1 second):
The result:
100
99.82
99.64
99.46000000000002
99.28000000000002
or
99.289999999999999
99.109999999999998
98.929999999999997
or
99.28000000000001
and so on
I've tried to do add this after deduction:
but it would trigger the game mechanic (if player.health >= 200) since 99 * 100 is 9900 which is undesirable.
I could add a bool player.triggerallowed to it:
but what if the player is in a hazardous area and at the same time tries to get to >200 health while player.triggerallowed = false?
Is there any other solution beside mine that could work?
Beta Was this translation helpful? Give feedback.
All reactions