Suggestion/Request

Started by Mötley, Mar 14, 2016, 09:02 PM

Previous topic - Next topic

Mötley

As I know not many people use WriteIniInteger but in some scripting applications people will happen to use this,

The Request is to add support for WriteIniFloat as this is extremely helpful in so many ways

It is impossible to calculate distance and positions without it in my server for writing to a players account.

I would be highly appreciated and or if this does not happen if some one could tell me ways to convert float values to  WriteIniInteger
I would highly satisfied, But I would really like to see WriteIniFloat
Sometime soon or in the near future :D

Thanks for reading ;)

Thijn

First thing that comes to mind is multiplying. 1.10 * 100 = 110. Which is an int. 110 / 100 = 1.10 which turns back into an float.
I don't know how precise the floats need to be, but positions aren't usually more then 5 (? Out of my head.) digits. So multiplying with 100000 should work :P

Mötley

#2
Quote from: Thijn on Mar 14, 2016, 09:43 PMFirst thing that comes to mind is multiplying. 1.10 * 100 = 110. Which is an int. 110 / 100 = 1.10 which turns back into an float.
I don't know how precise the floats need to be, but positions aren't usually more then 5 (? Out of my head.) digits. So multiplying with 100000 should work :P

I am lost :p care to explain just a little more?


This is how it would look with floats
  local Pos = player.Pos;
  WriteIniFloat( Path + "Data/"+player.Name+".ini", "Account", "x", Pos.x);
  WriteIniFloat( Path + "Data/"+player.Name+"ini", "Account", "y", Pos.y);
  WriteIniFloat( Path + "Data/"+player.Name+".ini", "Account", "z", Pos.z);


FIXED, I have not seen this code like this before but it appears

ReadIniNumber works. Stress tested works amazing. Is this for Float values? I thought this was for other things.?

KAKAN

  local Pos = player.Pos;
  WriteInInteger( Path + "Data/"+player.Name+".ini", "Account", "x", Pos.x*100000);
  WriteIniInteger( Path + "Data/"+player.Name+"ini", "Account", "y", Pos.y*100000);
  WriteIniInteger( Path + "Data/"+player.Name+".ini", "Account", "z", Pos.z*100000);
To get the pos back:
ReadIniInteger(....,[tt]pos/100000[/tt]);Just to give you an idea. If the Ini int thing doesn't work, try this:-
local p = ReadIniInteger(....,[tt]pos/tt]);
local pos = p/100000;
oh no