How do I save a variable that is only spaces?

  • I am using text to show certain variables so I can see what's happening in my game. However, I am posting several vars in one text. ie; var1 & " " & var2 & " " & var3.

    Except I am using much more spaces to keep the text more separated. So I made a var called 'spaces', that holds on to the number of spaces I need for quick usage and not having to count say, 14 spaces each time I make a separation. It works fine, until I re load concstruct 2, then my var spaces, becomes nothing, just "", with not a single space. Anyone have any ideas?

  • Can you use dashes or periods for separation?

  • Although whitespace makes an okay separator, lamar makes a good point. You should really have a separation character, using tokenat() and trim() to retrieve. I bet if you replace spaces with the same amount of whitespace and a separator character, C2 will be more likely to remember the string.

    That aside - add an on-start function that looks something like this:

    Repeat (14) times

    • set spaces to spaces&" "
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The 14 spaces are the initial value of the text variable, right?

  • It's a bug, and here's a new report for it:

    What you can do in the meantime is set the value of the variable at the start of the layout instead of using the initial value for spaces. So for example:

    global text spaces=""

    Start of layout --- set spaces to " "

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