GameSalad

Static Day and Time Clock and "Divisible By" Problems (Life Simulator)

dariusimmanuelguerrerodariusimmanuelguerrero Posts: 18Member, PRO
edited April 30 in Working with GS (PC)

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 :)

Comments

  • tatiangtatiang Posts: 10,709Member, Sous Chef, PRO, Senior Sous-Chef
    edited April 30

    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.

  • dariusimmanuelguerrerodariusimmanuelguerrero Posts: 18Member, PRO
    edited April 30

    Thank you so much @tatiang ! That solves my problems for days and hours too! :) Real excited for this.

Sign In or Register to comment.