Hey there;
Here's some trouble I have been unable to think through.
So I have a clock mechanic; afaik, it works like a typical RM day/night system. 1 day lasts 3 minutes, turns night, screen fades out, things reset, new day starts.
I have used a "Show Picture" and "Move Picture" command to display a clock HUD element to help player's determine the "time of day". This clock moves perfectly in sync with the actual clock logic. Here's the problem though; the movement is totally independant of the logic itself. For a strange analogy, think of it as 2 different dancers; both of them are dancing in sync, but since they are two independant people, nothing is forcing them to stay in sync if one decided to get jazzy with their dance.
Here's what I want to do:
First, let's define some things to make this easier:
Let's call the variable running in the parallel process that controls the clock the clock's logic.
Let's call the picture of the clock moving the clock's animation.
Finally, due to the low-priority of the clock, it actually runs at 2 second intervals instead of 1 second intervals (or in other words, 120 wait frames between each tick of the clock) equating the "start of the day" time to the value of 90 (the variable is set to 90 at the start of the day, since each tick is 2 seconds, that means 180 seconds which means: 3 minutes) this obsessive, overly optimized 2 second intervals can be adjusted to 1 second intervals if that makes things easier
The loop for the clock works subtractively. At the start of the day, the clock is set to 90, and each pass of the loop subtracts 1 until it reaches 0, which then resets the day. (I bring this up, because upon writing this whole post, I realize it might be easier to invert this and work additively; starting at 0, adding 1 until the value reaches 90 - if you think that would make this math formula easier, let me know, just say "work additively.")
Basically, I have things that will adjust the clock logic; for example, each turn in battle will pass 2 seconds of time (or -1 to the clock's logic). Other mechanics related to the map will subtract from the set value of the day (90), resulting in shorter days.
The challenge is that, basically the clock's logic is getting jazzy with it's dance. So while the logic is working just fine (days are shorter, battle's take away time from the clock), the clock's animation does not accurately reflect this change; suddenly these 2 dancers are out of sync.
The clock's animation is handled by a small "clock hand" (we'll call it that, I suppose) that starts at the top of the screen, and will move down the screen's vertical axis (720px) until the day ends. In the loop that controls the clock's logic is a "move picture" command. It uses the "move picture with variable" control, and each loop of the clock's logic will add 8 to the Y Axis (8x90=720).
Basically, I'm just trying to figure out how can I get the clock's animation to account for any changes in the clock's logic so that at the start of the day, the clock's animation will always start at the top of the screen, and at the end of the day the clock's animation will always end at the bottom of the screen no matter how jazzy the clock's logic gets.
I'm really bad at trying to think of math formula's. I see I have all the variables to do it, I just can't seem to figure out the formula to get this to work. My toilet times, shower times, and sleeping times have been spent with a lot of time trying to conceive how to do this, but I've come up short. Which is why I am making this post.
Also, I'm at work, so that's why there are no pictures to better explain things. If you need them (either because my explanation is poor or you just feel like you'd be able to better understand this eventing with a picture) then I'll try to post some when I have time.
Your help is appreciated.
Here's some trouble I have been unable to think through.
So I have a clock mechanic; afaik, it works like a typical RM day/night system. 1 day lasts 3 minutes, turns night, screen fades out, things reset, new day starts.
I have used a "Show Picture" and "Move Picture" command to display a clock HUD element to help player's determine the "time of day". This clock moves perfectly in sync with the actual clock logic. Here's the problem though; the movement is totally independant of the logic itself. For a strange analogy, think of it as 2 different dancers; both of them are dancing in sync, but since they are two independant people, nothing is forcing them to stay in sync if one decided to get jazzy with their dance.
Here's what I want to do:
First, let's define some things to make this easier:
Let's call the variable running in the parallel process that controls the clock the clock's logic.
Let's call the picture of the clock moving the clock's animation.
Finally, due to the low-priority of the clock, it actually runs at 2 second intervals instead of 1 second intervals (or in other words, 120 wait frames between each tick of the clock) equating the "start of the day" time to the value of 90 (the variable is set to 90 at the start of the day, since each tick is 2 seconds, that means 180 seconds which means: 3 minutes) this obsessive, overly optimized 2 second intervals can be adjusted to 1 second intervals if that makes things easier
The loop for the clock works subtractively. At the start of the day, the clock is set to 90, and each pass of the loop subtracts 1 until it reaches 0, which then resets the day. (I bring this up, because upon writing this whole post, I realize it might be easier to invert this and work additively; starting at 0, adding 1 until the value reaches 90 - if you think that would make this math formula easier, let me know, just say "work additively.")
Basically, I have things that will adjust the clock logic; for example, each turn in battle will pass 2 seconds of time (or -1 to the clock's logic). Other mechanics related to the map will subtract from the set value of the day (90), resulting in shorter days.
The challenge is that, basically the clock's logic is getting jazzy with it's dance. So while the logic is working just fine (days are shorter, battle's take away time from the clock), the clock's animation does not accurately reflect this change; suddenly these 2 dancers are out of sync.
The clock's animation is handled by a small "clock hand" (we'll call it that, I suppose) that starts at the top of the screen, and will move down the screen's vertical axis (720px) until the day ends. In the loop that controls the clock's logic is a "move picture" command. It uses the "move picture with variable" control, and each loop of the clock's logic will add 8 to the Y Axis (8x90=720).
Basically, I'm just trying to figure out how can I get the clock's animation to account for any changes in the clock's logic so that at the start of the day, the clock's animation will always start at the top of the screen, and at the end of the day the clock's animation will always end at the bottom of the screen no matter how jazzy the clock's logic gets.
I'm really bad at trying to think of math formula's. I see I have all the variables to do it, I just can't seem to figure out the formula to get this to work. My toilet times, shower times, and sleeping times have been spent with a lot of time trying to conceive how to do this, but I've come up short. Which is why I am making this post.
Also, I'm at work, so that's why there are no pictures to better explain things. If you need them (either because my explanation is poor or you just feel like you'd be able to better understand this eventing with a picture) then I'll try to post some when I have time.
Your help is appreciated.
