Author Topic: Loading an environment through a function, on custom gamemode?  (Read 421 times)

I've been having issues, this doesn't work at all, but I don't remember how exactly it works.

function loadEnviromentFromFile(%file)
{
   if(!isFile(%file))
      return -1;
   %res = GameModeGuiServer::ParseGameModeFile(%file, 1);
   announce("Loading environment: \c4" @ fileName(%file));

   EnvGuiServer::getIdxFromFilenames();
   EnvGuiServer::SetSimpleMode();

   if(!$EnvGuiServer::SimpleMode)     
   {
      EnvGuiServer::fillAdvancedVarsFromSimple();
      EnvGuiServer::SetAdvancedMode();
   }
}


I have no idea what I am doing wrong

This is the implementation I used in this environment support script:

function loadEnvironment(%file)
{
  %res = GameModeGuiServer::parseGameModeFile(%file, 1);

  EnvGuiServer::getIdxFromFilenames();
  EnvGuiServer::setSimpleMode();

  if (!$EnvGuiServer::SimpleMode)
  {
    EnvGuiServer::fillAdvancedVarsFromSimple();
    EnvGuiServer::setAdvancedMode();
  }
}


Seems to be pretty much exactly the same (except for some capitalization differences that shouldn't matter). How are you using your function? (i.e. on what kind of file)

loadEnvironmentFromFile("saves/Map Changer/Beachland.txt");

Is Beachland.txt generated with the default saveEnvironment function?