Hi Everyone,
I am using Harlowe and would like to know how I can convert a number with decimal places into hours and minutes.
For example, I have the number 15.833333333333334 which would represent 15 hours and 50 minutes. Note that the 50 minutes is a rounding of the result of the decimal places multiplied by 60.
This is important to me, because in my story, different actions and passages subtract different amounts of "minutes" and I would like to display the remaining minutes as hours and minutes.
At the moment, when I have 950 minutes left, if I divide it by 60, I get the number above with decimal places. And I don't know what code I need to use for Harlowe to multiply and round only the decimal places.
Any help with this would be appreciated. Sorry for my newbiness!
Comments
Just sharing that, as that is what I am using in my game, thanks to the help I got from greyelf!
Since I am trying to move my story over to the sugarCube format (since it seems more versatile for what i want to achieve), I was wondering how to get the time thing to work.
The only part that I am having trouble with is the following:
In SugarCube, I can't get the "floor" part to work, nor know how to get it to round the resulting number.
I have this so far:
But that returns the number with the decimal places. I can't find the solution in any of the sugarCube documentation.
Any ideas?
So the final SugarCube code that works for me now is:
My above example modified for SugarCube: