Making a Clock Mechanic

Hey guys

My friend wants to make a game using choicescript that involves real life and juggling chores and things against time.

I said I could whip her up a working clock template!

Unfortunately, the whipping was unsuccessful.

My original plan was:

*create getup 8.00

^ You have to get up at 8:00AM

*create timeleft 2.00

^ You have two hours left for your chores

Then for example

#Make breakfast *set getup -10 *set timeleft +10

So the idea is you have ten more minutes to do things, because you got up early, but your get up time is earlier. Ergo: 7:50 and now you have 2:10 left.

The problem is this doesn’t account for the fact it goes back from 100 not from 60.

So instead of it being 7:50 it’s 790 and it loses the formatting of 7.50.

Then I thought I’d do it in minutes so it’d be 480 as the time, you take 10 away, then divide it by 60 for the get up time.

This works great as long as you have to get up at 8 and don’t want :00 or .00 after the 8.

So…

Does anyone have any suggestions on how to make a clock system? I don’t really need date (at the moment), just a simple 24hr clock will do.

I’m so lost.

Here is a link to a usable clock system by @Lordirish:

Clock-system Fixed

5 Likes

I would use the last post as it is the most stable. Any questions please hit me up. :smile:

5 Likes

Thank you so much!

eyes code

On second thought, maybe she doesn’t need a clock system…

3 Likes

How would that code be simplified for just hours and minutes? Rather than including days and months?

lol It is fairly simple to use once setup just set sec + whatever number you want then gosub_scene clock it does all the work for ya then returns.

1 Like

You only would show the the minutes and hours then in the display.

Link to a working example of the clock
https://dl.dropboxusercontent.com/u/80005171/clock_calander/web/mygame/index.html
It is not a compiled version so runs a tad slow.

Of course if that is all you want i could write it that way.

1 Like