How do I set text, based on global variable?

0 favourites
  • 5 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • How would I make a global variable integer: update a text object to display text based off the current global variable number?

    For instance making a day system where ever day you advance after pressing a "sleep" button.

    1. It would advance the global variable by 1 then based on the variable amount

    2. It would display the current day setting a text object to ("Monday, Tuesday)

    Then after you have all 7 days it would reset back to 0 = Sunday

    ------------

    0 = Sunday

    1 = Monday

    So on until

    6 = Saturday

    -------------

    Thanks guys I've been struggling to figure this out.... I even had a AI bot write me JavaScript 10 million different times but none of the code would work to set the text.

  • Just need a simple system condition to compare the global like if variable = 0, set text to "Sunday", if variable =1, set text to "Monday" etc. To reset the variable the logic is with the button, so when button pressed add 1 to variable. Then a separate check if variable = 7, set variable to 0.

  • Just need a simple system condition to compare the global like if variable = 0, set text to "Sunday", if variable =1, set text to "Monday" etc. To reset the variable the logic is with the button, so when button pressed add 1 to variable. Then a separate check if variable = 7, set variable to 0.

    Thank you I'll try it. I don't know why I made it so complicated lol.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just need a simple system condition to compare the global like if variable = 0, set text to "Sunday", if variable =1, set text to "Monday" etc. To reset the variable the logic is with the button, so when button pressed add 1 to variable. Then a separate check if variable = 7, set variable to 0.

    Hey you mind if we connect?

    You seem very experienced wouldn't mind if I ask you a few other questions when I hit a road block?

    I'm grinding out a project in the next 30 to 90 days, and had I known this earlier I wouldn't have wasted 4 hours of my time trying to find a way to get a JavaScript to work.

    There's no IM or direct message on this site.

    Not sure what platforms you're on but my Reddit is No_Cockroach2259.

  • Sure <edited>

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