Variable not posting properly?

0 favourites
  • 2 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I have a variable "flop" it's a global number variable with the value as repeating 1's with a 16 digit length. "1111111111111111"

    I goto display it to the screen via a text object called "Display".

    So it's set up like this in the event sheet.

    Every Tick -> "Display"-> Set text to "CC: "&ccn

    With this code the number displays as "1111111111111111.1"

    However if I do it this way

    Every Tick->"Display"->Set text to ccn

    It displays the number as intended "1111111111111111"

    I don't understand why adding a string before the number variable would cause it to turn into a float all of a sudden and tag an extra .1 to the end of the number. Has anyone else run into this problem or is there something obvious I'm looking over here?

    I've done some testing and if the length of the "11111..." number is equal to 15 it works fine. If it is equal to 17 it tags a 2 at the end instead of a .1

    So it seems like it has something to do with the length of the number and the way it is being displayed?

    Also I've checked in the debugging that the variable is in fact the right assigned value. It never changes value while in the debugger that I can tell.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Its a bug in C2 it seems. Pretty weird one, but I guess its because of the type of variable that is used by the global number and it probably goes out of range or something like that. For instant if you add 18 "1" it changes the last two numbers to 00 instead of 1's. And if you add 19 "1" the last 3 are changes to "200" inside C2 You should post this in the bug section, it doesn't have anything to do with your code.

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