Problem Description
When taking a number out of an array and adding a prefix and placing the number into another array the resulting number will receive a decimal point.
The numbers i am working with are a 10 digit number with values representative of an id. the first 2 digits are the item and the following are the information. All the way up to 3699999999 works without issue and the results are correct. Around 3710100100 the numbers act oddly once they are put from one array to the other while adding the needed "item" prefix.
i have created a Capx with the findings and the steps to recreate the bug.
i am using this bit of code to add the information to the new array
Parameters for new array: Set at XY
X= ItemId
Y=0
Value="Item"&StartArray.At(ItemId)
some help on this would be fantastic as this is the final available item and i would like to not cut it from the game.
Attach a Capx
https://www.dropbox.com/s/9zple3tgc8wm5 ... .capx?dl=0
Description of Capx
This Capx is a recreation of the bug i have come across while working with arrays in a larger game.
All of the ItemIds work correctly except for the numbers in 3710100101 range.
The results and findings can be found and replicated in the capx file.
Steps to Reproduce Bug
- Step 1
Run the project in debug mode. (To make the arrays more visible and easily accessible press the eye button to watch the array data for each array and then use the watch Tab.)
- Step 2
Press either the "1" or the "2" button on the keyboard. ("1" will load the starting array with numbers that are problematic) ("2" Will load the starting array with numbers that work with no problems.
- Step 2
Press the "t" button on the keyboard to activate the function that transfers the information to the new array.
- Step 3
Check the values in the arrays and see the difference in the numbers. ("Start array" is the original values, "new array" is the ones with the "item" prefix)
- Step 4
The values can be changed in the Event sheet to test further if need be.
Observed Result
The numbers recieve deciamls
e.g.
3610100101 becomes "item3610100101" Which is correct
3710100100 becomes "item3710100099.9999995" which is incorrect
3710100101 becomes "item3710100101.0000005" incorrect
interestingly with the same string using the same code these numbers work fine;
3710100102,
3710100103,
3710100104,
3710100105,
3710100106,
but these following ones will also become decimals again.
3710100107 becomes "item3710100106.9999995" which is incorrect
3710100108 becomes "item3710100108.0000005" which is incorrect
3710100109 becomes "item3710100109.0000005" which is incorrect
Expected Result
All the numbers should directly transfer without adding mystery decimals.
3710100101 becomes "item3710100101"
3710100102 becomes "item3710100102"
Affected Browsers
- Chrome: (YES)
- FireFox: (YES)
- Internet Explorer: (not tested)
Operating System and Service Pack
Windows 10 Pro
Construct 2 Version ID
R239 (64bit)