How do I Fix My Clock!?

1 favourites
  • 4 posts
From the Asset Store
75 power-up sound effects; bonus and notification sounds, fanfares, harp glissandi, stabs, clock ticks, etc.
  • Something in this code is making my "sleep" variable count off by -60 instead of -2 when the clock minutes hit 20 and 40. When the clock hits 60 minutes, sleep registers as -2 as expected.

    It's driving me nuts!

    P.S. The actual seconds counter is disabled as I have it set to count by 10 minutes every second.

    [Clock]

    ----+ System: Every tick

    -----> Text_Clock_Hours: Set text to "0" & ClockHours

    -----> Text_Clock_Minutes: Set text to "0" & ClockMinutes

    -----> [DISABLED] Text_Clock_Seconds: Set text to "0" & ClockSeconds

    -----> Text_Clock_Week: Set text to "WEEK" & " " &ClockWeekTracker

    ----+ System: Every 1.0 seconds

    ----+ System: [X] Is ClockPause

    -----> System: Add 10 to ClockMinutes

    ----+ System: Else

    -----> (no actions)

    ----+ System: Every .5 seconds

    -----> Text_Clock_Colon: Set visibility Toggle

    ----+ [DISABLED] System: ClockSeconds ≥ 10

    -----> [DISABLED] Text_Clock_Seconds: Set text to ClockSeconds

    ----+ System: ClockMinutes ≥ 10

    -----> Text_Clock_Minutes: Set text to ClockMinutes

    ----+ System: ClockHours ≥ 10

    -----> Text_Clock_Hours: Set text to ClockHours

    ----+ [DISABLED] System: ClockSeconds = 60

    -----> [DISABLED] System: Set ClockSeconds to 0

    -----> [DISABLED] System: Add 1 to ClockMinutes

    ----+ System: ClockMinutes = 20

    -----> System: Subtract 2 from Sleep

    -----> Score_Sleep: Set text to int(Sleep)

    ----+ System: ClockMinutes = 40

    -----> System: Subtract 2 from Sleep

    -----> Score_Sleep: Set text to int(Sleep)

    ----+ System: ClockMinutes = 60

    -----> System: Subtract 2 from Sleep

    -----> Score_Sleep: Set text to int(Sleep)

    -----> System: Set ClockMinutes to 0

    -----> System: Add 1 to ClockHours

    -----> System: Add 1 to ClockHoursPM

    ----+ System: ClockHours = 13

    -----> System: Set ClockHours to 1

    ----+ System: ClockHoursPM = 24

    -----> System: Add 1 to ClockDayTracker

    ----+ System: ClockHoursPM = 24

    -----> System: Set ClockHoursPM to 0

    ----+ System: ClockHoursPM ≥ 12

    -----> Text_Clock_am_pm: Set text to "pm"

    ----+ System: ClockHoursPM ≤ 11

    -----> Text_Clock_am_pm: Set text to "am"

    ----+ System: ClockDayTracker = 1

    -----> Text_Clock_Day: Set text to "SUNDAY"

    ----+ System: ClockDayTracker = 2

    -----> Text_Clock_Day: Set text to "MONDAY"

    ----+ System: ClockDayTracker = 3

    -----> Text_Clock_Day: Set text to "TUESDAY"

    ----+ System: ClockDayTracker = 4

    -----> Text_Clock_Day: Set text to "WEDNESDAY"

    ----+ System: ClockDayTracker = 5

    -----> Text_Clock_Day: Set text to "THURSDAY"

    ----+ System: ClockDayTracker = 6

    -----> Text_Clock_Day: Set text to "FRIDAY"

    ----+ System: ClockDayTracker = 7

    -----> Text_Clock_Day: Set text to "SATURDAY"

    ----+ System: ClockDayTracker = 8

    -----> System: Add 1 to ClockWeekTracker

    ----+ System: ClockDayTracker = 8

    -----> System: Add 1 to ClockDayTracker

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Can you post a screenshot? That wall of text is impossible to understand.

    You probably need Date plugin:

    construct.net/en/make-games/manuals/construct-3/plugin-reference/date

    Using "every X seconds" to track hours and even days is a very bad idea.

  • Here are three screenshots. I wasn't aware of a clock plug-in, but I'll check it out if you think it'll help.

    Also, here's a preview of the (not fully functional) activity/game.

    preview.construct.net

  • You can add 10*60*1000 to the clock variable every 1 second - this will equal to 10 minutes in milliseconds.

    Then convert that value to days/hours/minutes using Date expressions. For example Date.GetHours(clockVar) will return the number of hours.

    See the official example for the Date plugin.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)