Possible Bug Thread

New releases and general discussions.

Post » Fri Mar 13, 2009 6:23 pm

Yeah, INT works, but what I couldn't understand was why it was throwing back a float when there was no divisible maths going on.

In fact, just creating a new cap with Global variables "CurrentCellX"=0 and "SizeX"=10, and the statement:

"CurrentCellX" = random ("SizeX")+1

will produce floating point numbers like 4.22801958731946 every time, without any other maths going on.
Is that expected behaviour?

I suppose as long as people are aware of it, it'll be ok, but I wouldn't have thought that floating point would have been used until it was forced to by maths that involved or resulted in a floating point value.

Sponge.
B
2
S
1
G
3
Posts: 105
Reputation: 1,310

Post » Fri Mar 13, 2009 6:41 pm

Oh, I think the initial values for global and private variables are always floats. I think you need to set them to int(current_value) on start of layout to make them integers, or just call random(int(value)).
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,610

Post » Fri Mar 13, 2009 7:30 pm

Well that makes sense of the results that I got. :)

Is this mentioned anywhere in the docs or on the wiki?
Couldn't find anything on there, but I think it needs to be.

Sponge.
B
2
S
1
G
3
Posts: 105
Reputation: 1,310

Previous

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 2 guests