Static Day and Time Clock and "Divisible By" Problems (Life Simulator)
Hello! I am working on a life simulator of sorts. Everything is going well, in terms of the character needing to do certain tasks, such as eating to replenish hunger, and sleeping to replenish fatigue. The only thing that's been bothering me is the simulated Time.
I plan that there'd be no sense of time in this game. It is static. For example: Going to Work takes 8 hours. Driving to work takes 1 hour.
While I understand the formula for going to work would go like this
Set TableCellValue (for time) to TableCellValue + 8 (hours working)
How do I make a clock that fills displays 24 hours. Once time goes beyond 23:00, it resets to 00:00 AM and adds an integer to Day Number.
And how do I get it so that every 30 days rent has to be paid. I'm lost Do i make it so that every time the number is divisible by 30 ? How do I make a behavior to trigger when an integer is divisible by a certain number?
Big thanks in advance
iTunes Developer Profile: https://itunes.apple.com/us/developer/darius-immanuel-guerrero/id1090694564
Google Play Developer Profile: https://play.google.com/store/apps/dev?id=7456293756408686489
Comments
To answer your last question, you use the mod() function in a numeric expression:
If mod(game.day,30)=0
[behavior]
Just be aware that mod returns the remainder of a division problem so when game.day is zero, the rule will also be true.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thank you so much @tatiang ! That solves my problems for days and hours too! Real excited for this.
iTunes Developer Profile: https://itunes.apple.com/us/developer/darius-immanuel-guerrero/id1090694564
Google Play Developer Profile: https://play.google.com/store/apps/dev?id=7456293756408686489