OS Time Demo - 12:00 shows 00:00

sawkasteesawkastee Member Posts: 184
edited September 2013 in Working with GS (Mac)
In the os time demo when the time hits 12:00 the time displays 00:00 does anyone know how to get it to display 12:00?

First Hour number is calculated by:
(floor(( game.Clock.Hour %12)/10))..".png"

Second Hour number is calculated by:
(( game.Clock.Hour %12)%10)..".png"

Comments

  • sawkasteesawkastee Member Posts: 184
    Bumping as I still need some help with this. Here's the demo if anyone can help me deconstruct it. http://forums.gamesalad.com/discussion/50835/system-time-demo

    Basically the digital clock is showing 00:00 when it hits midnight/noon. You can change your Mac's system clock to 11:59 & wait a minute and see what I'm talking about. I want it to display 12:00 instead of 00:00. The demo is using these formulas to select a png who's name equals the formula values. e.g. if formula = 1 then 1.png will display.

    First Hour number is calculated by:
    (floor(( game.Clock.Hour %12)/10))..".png"

    Second Hour number is calculated by:
    (( game.Clock.Hour %12)%10)..".png"

    I need to find a way that when the formula equals 00 to say select images for 1 and 2 not the 0.png images.

    Thanks!
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited October 2013

    Hi @sawkastee Try something like the following; hopefully it should work although it's untested:

    Make two text attributes, let's call them firstHt and secHt

    In your first hour number actor's rules, put:

    Constrain Attribute scene.firstHt to self.Image

    Constrain Attribute self.Image to (floor(( game.Clock.Hour %12)/10))..".png"

    Rule: When scene.firstHt = 0 and scene.secHt = 0
    Change self.Image to 1.png


    And in your second hour number actor's rules, put:

    Constrain Attribute scene.secHt to self.Image

    Constrain Attribute self.Image to (( game.Clock.Hour %12)%10)..".png"

    Rule: When scene.firstHt = 0 and scene.secHt = 0
    Change self.Image to 2.png

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Here is yet another way to turn '24 hour' time into '12 hour' time:

    Make a new integer attribute called "self.TempNum"

    timer every 1 second
    --Change Attribute self.TempNum To: game.Clock.Hour %12
    --When TempNum = 0
    ----Change Attribute self.TempNum To: 12
    --Change Attribute self.Image To: (floor( self.TempNum/10))..".png"

    That's it.

    Edit: For the second number (the 2 in the '12') the last line is
    --Change Attribute self.Image To: (floor( self.TempNum %10))..".png"
Sign In or Register to comment.