Variable not posting properly?

Get help using Construct 2

Post » Wed Mar 25, 2015 8:47 pm

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.
Posts: 209
Reputation: 5,532

Post » Thu Mar 26, 2015 12:35 am

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 :D You should post this in the bug section, it doesn't have anything to do with your code.
Posts: 1,209
Reputation: 7,537

Return to How do I....?

Who is online

Users browsing this forum: mattshallow and 16 guests