Can someone write me a script to help with time?

background: i'm using community lighting mz, and i am looking for an equation that will set a minutes and hours variable based off of a seconds variable. i know the math... i just dont know how to write it. 🙁

more detail: in the plugin settings for cl_mz, assigning the hours and minutes variables do not work as intended, but the seconds variable works and will count upwards. there are 84,600 seconds in one game day. I have v[2] as seconds, v[3] as minutes, and v[4] as hours. i also have v[5] for a day counter.

the meat: i'm looking for equations that will do the following;
v[3] = v[2]/60;
v[4] = v[3]/60, or, v[4] = v[2]/3600; i presume both would work the same

and if theres time, another that will count the days and assign to v[5]

thanks so much for your time
this is usually done by eventing in a common event - you rarely need a script or plugin for a time system, which is why you don't find them.
this is usually done by eventing in a common event - you rarely need a script or plugin for a time system, which is why you don't find them.

I'd like to utilize the automation that cl_mz offers. I can write it all up in a common event, but I'd rather have a quick math equation to solve a couple variables for me instead. Thank you though!

I could probably do it through a string of variables somehow I guess. I'm just not that experienced and would have to sit on it for a bit and figure it out. I wish there was an option to divide/multiply/add/sub from a variable and apply that sum directly to another in the set variable conditions, but there doesnt appear to be.
Figured I would reply here that I was able to solve this issue by asking ChatGPT, which gave me this script: $gameVariables.setValue(3, $gameVariables.value(2) / 60);

Kinda neat.
Here is a not tested Calculation, i hope i made no Errors, the Clock is calculated of a Variable that contains the total Game Seconds. If you change total Game seconds(Var1), you also change the Time.
The Mod (Modular) Math Function is realy helpful. This is just a Basic example which might need Editing depending on what exactly you need for your Game.


Var1 = Total Game Time in Seconds

Var2 = Var1
Var2 mod 60 = Clock Second (0to59)

Var3 = Var1
Var4 = Var1
Var4 mod 60
Var3 - Var4
Var3 / 60 = Total Minutes
Var3 mod 60 = Clock Minute (0to59)

Var5 = Var1
Var4 = Var1
Var4 mod 3600
Var5 - Var4
Var5 / 3600 = Total Hours
Var5 mod 24 = Clock Hour (0to24)

Var6 = Var1
Var4 = Var1
Var4 mod 86400
Var6 - Var4
Var6 / 86400 = Total Days
Var6 mod 7 = Clock Day of Week (0 to 6)

...

Original thread: https://forums.rpgmakerweb.com/threads/can-someone-write-me-a-script-to-help-with-time.153882/