Author Topic: Scripts  (Read 5083 times)

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
Re: Scripts
« Reply #45 on: October 16, 2021, 04:42:11 am »
okay nevermind, it was working partially, but now it doesn't function at all and I'm confused to why. I have script with 2 functions in  hth_launch

 var so = SharedObject.getLocal("HighTailHall2");
saveData = function ()
{
   so.data.loaded = true;
   so.data.filename = _root.filename;
   so.data.zone = _root.zone;
   so.data.activescene = _root.activescene;
   so.data.npcstate = _root.npcstate;
   so.data.npc = _root.npc;
   so.data.area = _root.area;
   so.data.varient = _root.varient;
   so.data.location = _root.location;
   so.flush();
};
newGame = function ()
{
   so.clear();
   so.data.loaded = true;
   so.data.filename = "none";
   so.data.zone = "hth2_main_map.swf";
   so.data.activescene = "hth2_main_map.swf";
   so.data.npcstate = 1;
   so.data.npc = "none";
   so.data.area = "none";
   so.data.varient = "none";
   so.data.location = 4;
   so.data.hall1 = 0;
   so.data.hall2 = 0;
   so.data.vltv = 0;
   so.data.tanyastate = 0;
   _root.filename = so.data.filename;
   _root.activescene = so.data.activescene;
   _root.npcstate = so.data.npcstate;
   _root.npc = so.data.npc;
   _root.area = so.data.area
   _root.varient = so.data.varient;
   _root.location = so.data.location;
   so.data.voyeurlevel = Number(so.data.hall1) + Number(so.data.hall2) + Number(so.data.vlnf);
   so.flush();
};
stop();
if (so.data.loaded == false or so.data.loaded == undefined)
{
   newGame();
}

I want to load 4 variables to and from the shared object but the values are always undefined. I don't quite understand what I'm supposed to do.
I reference the shared object with this line in the northernfalls area file and the main hall lobby file with this line of code:
var so = SharedObject.getLocal("HighTailHall2");