arjay 7 Posted September 7, 2013 Ok heres a weird one.. _objID = parseNumber("1620035"); // will return 1.62004e+006 Can anyone explain why parseNumber is returning this weird number, and also how to make it stop? eg this breaks some code (run on altis) _objID = parseNumber("1620035"); // will return 1.62004e+006 _pos = [22980.9,18883.5,-0.458173]; _obj = _pos nearestObject _objID; // will find: 62a1eb00# 1620035: shed_big_f.p3d _objID = 1.62004e+006; _obj = _pos nearestObject _objID; // will find: 1620040: b_ficusc1s_f.p3d as you can see on that last line above the object id has rounded up?? to 1620040 Share this post Link to post Share on other sites
sergeant rock 3 Posted February 25, 2014 Sorry to resurrect an old thread, but I have been experiencing this same issue and am unable to find a resolution. I have created an array of editor objects (actually they are what I call building "profiles" which contain quite a bit of useful information about the buildings such as the number of positions inside, classname, number of doorways, number of windows, coordinates of all entries and exists, etc) which I then plan to call random elements from and perform some random operations specific to the mission. For arguments sake, lets say this: aoHouses = [1081388,1081509,1080931,1081274]; The problem is that these editor objects are 7 digits, 1 digit longer than what is allowed and therefore results in a float being returned when you select an element from the array. For example: hint format ["The selected building ID is %1",aoHouses select 0]; Will return: The selected building ID is 1.08139e+006 I've tried some workarounds with strings and parseNumber, but with the same result. I also tried to modify a similar issue as described by KillzoneKid here but without any luck. For a simple example, let's say I want to name a building: House1 = (getpos player nearestObject (aoHouses select 0); Does anyone have any ideas on how I can select these elements and pass the proper numeric representation to a script? Share this post Link to post Share on other sites
fusion13 11 Posted February 25, 2014 Well in arma the number behavior is a bit annoying and so forth, but you cant get around it, the e+006 is just a fancy way of saying 1 million. and further more you means the amount of 0's after Share this post Link to post Share on other sites
MulleDK19 21 Posted February 26, 2014 _objID = parseNumber("1620035"); // will return 1.62004e+006 No. parseNumber returns 1620035, but whatever you're using to read the value converts it to a string using scientific notation, and loses some of the precision. 1.62004e+006 is 1620040. Just wrote a simple function that converts to string without using scientific notation. MTP_fnc_numberToString = { _number = _this; _str = ""; if (_number % 1 == 0) then { while { _number > 0 } do { _digit = floor (_number % 10); _str = (str _digit) + _str; _number = floor (_number / 10); }; } else { _decimals = _number % 1; _decimals = _decimals * 1000000; _number = floor _number; _str = _number call MTP_fnc_numberToString; _str = _str + "." + str _decimals; }; _str; }; Usage: 1620035 call MTP_fnc_numberToString Returns: "1620035" Share this post Link to post Share on other sites
z0kng 10 Posted May 21, 2014 I have a similar question, but i can't open a thread so I ask it here. My problem is i want to save the fuel in my data base. Saving works fine but if i load it get it as string so i wanted to use parseNumber to convert it in a number. And the problem is if for e.g my string is "0.5125"then parseNumber gives me 0 back. and also for "0,5125". Since i couldn't find i solution in this forum i ask it here. Sincerely yours z0Kng Share this post Link to post Share on other sites