Author Topic: Scripts  (Read 5100 times)

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
Re: Scripts
« Reply #45 on: October 12, 2021, 02:43:14 pm »
Startpoint was never fully implemented. Jezzel's sprite was not kept because lf quality issues. If you want to switch it go for it.

  • Administrator
  • Sr. Member
  • *****
  • Posts: 407
    • View Profile
Re: Scripts
« Reply #46 on: October 13, 2021, 05:55:55 pm »
Back to my first question. I would fix the save/load script, but I could not find any. In what file it is? Which variables do you want to save & load?

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
Re: Scripts
« Reply #47 on: October 13, 2021, 07:48:48 pm »
It should all be in the hth-launch.swf
I never loaded it anywhere else

  • Administrator
  • Sr. Member
  • *****
  • Posts: 407
    • View Profile
Re: Scripts
« Reply #48 on: October 14, 2021, 06:30:58 am »
There is no file of such name in the zip you uploaded for me.
The closest is Projectors/hth2FlashFile.swf which is a launcher, but I couldn't find anything save/load related in it. Perhaps it's an older version of launcher.

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
Re: Scripts
« Reply #49 on: October 14, 2021, 02:29:41 pm »
I may have figured it out on my end

  • Administrator
  • Sr. Member
  • *****
  • Posts: 407
    • View Profile
Re: Scripts
« Reply #50 on: October 15, 2021, 07:48:11 pm »
OK.
If you want me to check that, just send me the file.

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
Re: Scripts
« Reply #51 on: October 15, 2021, 08:03:48 pm »
Is it good practice to save directly to so.data

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
Re: Scripts
« Reply #52 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");

  • Administrator
  • Sr. Member
  • *****
  • Posts: 407
    • View Profile
Re: Scripts
« Reply #53 on: October 16, 2021, 08:58:04 am »
I guess that the code you have pasted is in the loader file in main timeline frame script. That is the only way it landed at _root level and the only way to make it right.

Then NEVER reference the data by creating new SharedObject in Northernfalls or any other file by caling
var so = SharedObject.getLocal("HighTailHall2");
That way you have you have multiple objects conflicting over one save file data. It's like opening one file with multiple editors at the same time. Except these editors always writes file on editor close, each holding different data sets overwriting each other.
The only way to reference these data in level files is by calling the loader function by _root.saveData(); after modifying a root variable you want to save.

BTW, that line  so.data.voyeurlevel = Number(so.data.hall1) + Number(so.data.hall2) + Number(so.data.vlnf); will end up by NaN (Not a Number) stored in so.data.voyeurlevel because so.data.vlnf is not created yet. It's likely just a variable name typo.

Also so.data.voyeurlevel is not assigned in your _root.saveData() function. The game scripts should use _root.voyeurlevel variable instead and there should be something like following included in saveData() function.
so.data.voyeurlevel = 0;
if (_root.voyeurlevel != NaN)
{
so.data.voyeurlevel = _root.voyeurlevel;
}

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
Re: Scripts
« Reply #54 on: October 16, 2021, 03:03:42 pm »
From the documentation I found, declaring another so variable references a preexisting save file, or creates one if not present. I'll give this a try.
also note that voyeur level doesn't need to be saved, it's just collecting data from the three number variables.
« Last Edit: October 16, 2021, 03:06:07 pm by 1r2k5ng09df8s3 »

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
Re: Scripts
« Reply #55 on: October 19, 2021, 05:41:56 am »
I figured it out