Hi! I’m going to be blatantly ignoring that post I just made and deleted bc I’m an absolute buffoon who realized their mistake literally .2 seconds after posting. Itchy trigger finger, I guess. Also sleep deprivation.
But!! Since I haven’t seen any other clock subroutine (other than that behemoth 650 line code, rip Lordirish) I made my own for keeping track of time when YOU’RE the one adding time. or whatever. If none of this makes sense just let me know and I’ll try again when I’m not tired.
*create hour 00
*create min 00
This code uses military time, since it’ll take a better coder than me to figure out the nasty AM/PM (or maybe me when I havent been up for 28 hours straight coding) So it will display like this: hour:min. Thankfully double zeroes and numbers starting with zero display properly!
Create a scene titled clock, and paste this code (i like to label mine just to be sure or maybe you’re supposed to idk i’ve got tetris syndrome with numbers now, what do i know?)
*if min = 60
*set min 00
*set hour +1
*if min > 60
*set min ((min - 60) + 00)
*set hour + 1
*if hour = 24
*set hour 00
Then whenever you add (+) to the hour and/or minute value (with a simple *set hour +1 or *set min + 13) and use *gosub_scene clock, it will make sure you’re displaying the right time!
I hope somebody finds this useful!
And for those who has seen me flailing and asking question after question and want to know how my game’s going, I got the rough alpha of my first chapter up! Wheeee! https://dashingdon.com/go/5929 (It’s really simple, but historically I suck at coding so I’m p proud of what I have so far)
I would love any feedback or design tips if you’ve gottem!
The way you create your subroutine means that you need to always call it after changing the time to keep it up-to-date. Wouldn’t it be easier to make so that the routine updates the time, no matter how long it has been since the last routine call?
Also, was this supposed to do something else? Right now it’s adding 00 to the minutes.
I’m not an expert programmer, so there’s probably flaws, but here’s my reasoning
I was under the impression you needed to have a *gosub_scene everytime you updated something that involves your subroutine to check for flaws ¯_(ツ)_/¯
It can be changed for other people, but this was coded specifically for my game, which moves forward 6 minutes at a time, 30 minutes at most. Should have put a disclaimer this was built specifically for moving minutes at a time. I’m out atm, I’ll write something for moving past 00 hour mark.
I check for 60 specifically at the minute mark because clocks do not show 60, they automatically go from 59 to 00 (of the next hour).
So that code responds to if your minutes go over 60, which a clock cannot do.
Lets say, for instance, you’re at 59 minutes, and you add another 13 minutes
thats 72 minutes. Maaan a clock doesnt work like that! So math time! ((72-60)+00) = (12 + 00) = 12. This ensures that when you go above 60 minutes, you go up an hour, and get the correct number of minutes in the minute slot
(I’m so sorry, I could properly explain why everything is the way it is, but I got my BA in theatre and writing, math and explaining math related subjects it not my strong suit and it has been 31 hours since I last slept so I’m gonna pass out, and whatever happens while I’m gone happens)