ini object n lag!

Started by MEGAMIND, Jul 18, 2018, 03:28 PM

Previous topic - Next topic

MEGAMIND

hello everyone i have an issue, well it works fine i can save load objects but the problem is it lags as hell

well heres the code

autosave <- NewTimer("SaveObjects",10000,0);
LoadAllObjects();

and in functions

function LoadAllObjects()
{ local i = 0;
  while(true)
  {
    local str = ReadIniString( "objects.ini", "objects", i.tostring() );
    if(!str) break;
    else
    {
      local a = compilestring(str);
      a();

      i++;
    }
  }
  for(local a=0;a<GetObjectCount();a++)
  {
      FindObject(a).TrackingShots = true;
  }
}

function SaveObjects()
{ local n = GetObjectCount();
  for(local i=0;i<n;i++)
  {
    local o = FindObject(i);
    if(o) {
    WriteIniString("objects.ini","autosaved",i.tostring(), "CreateObject("+o.Model+","+o.World+",Vector"+o.Pos+","+o.Alpha+").RotateToEuler(Vector"+o.RotationEuler+",1);"); }
  }
}

function LoadAutoSaved()
{
  local i = 0;
    while(true)
    {
      local str = ReadIniString( "objects.ini", "autosaved", i.tostring() );
      if(!str) break;
      else
      {
        local a = compilestring(str);
        a();

        i++;
      }
    }
    for(local a=0;a<GetObjectCount();a++)
    {
        FindObject(a).TrackingShots = true;
    }
}
it lags alot when a second player either joins or not while creating object it lags too

so is there a better way to do it

NicusorN5

NEVER USE INI FOR SAVING PICKUPS AND OBJECTS AND SHIT! SERIOUSLY IT SUCKS!

MEGAMIND

anyone else there or could some one convert this shit to db or something else