HTH Dialog Developers Group

General Category => XML and technical stuff => Topic started by: 1r2k5ng09df8s3 on December 05, 2019, 03:35:53 pm


Title: Scripts
Post by: 1r2k5ng09df8s3 on December 05, 2019, 03:35:53 pm
I had a few suggestions for scripts. Posted below
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on December 26, 2019, 07:30:27 pm
Okay, so it was discussed earlier that text to speech was impossible, but is is possible to animate mouth moving for each sprite and take existing ones and manually sync the sound to the animation?
Title: Re: Scripts
Post by: Tabby on December 27, 2019, 10:07:01 pm
Yes, I can make sprite mouth to be manually synced from a dialog XML file. I already have a good idea how to implement that.
I deferred that script because it's a bit pointless when we have no source of voice. So far I could get only two volunteers to take part in this project. Chance of getting a female willing to do voice acting is pretty slim.
If you have good use for that, I can make it work next month.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on December 28, 2019, 12:29:34 am
We could pay someone?
Title: Re: Scripts
Post by: Tabby on December 28, 2019, 12:46:32 am
No way. Any money involved (paid or received) would absolutely ruin this project for me.
Also it could not be more backward if a pirate and volunteer paid own money for something, official author was paid for obtaining.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on December 28, 2019, 07:14:02 am
I see what you're saying, but on the other hand, we would be adding our own original content and this project is worth a little money. We can just agree to disagree on this one if you'd like
Title: Re: Scripts
Post by: Tabby on December 28, 2019, 11:27:19 am
I hope that this project will attract more fans and eventually some may have a good female friend willing to do some little voice acting.
Otherwise I prefer every way around, like some better text-to-speech converter for dialog and ripping voice from some regular **** for sex scene.
I would die of shame if I ever pay real money for something like that. I've been a digital pirate for my entire life, it's a matter of pride and personal standards. Also it's not easy to send or receive money really anonymously. Even Bitcoin transactions are not really anonymous.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on December 28, 2019, 11:50:33 am
I might though,
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on December 29, 2019, 08:42:39 pm
The controller for kendra’s sodeways scene is broken, I tried replacing the telltarget with references. It works in the testing environment but not in game

on(press, keyPress “ number”) {
Object(_root).focus.camera.area.char.kendra.gotoAndPlay(“a”)
Object(_root).controller.speed_status.gotoAndPlay(“a”)

}

**speed_status is referring to the green speed indicator that I’ve added.
Title: Re: Scripts
Post by: Tabby on December 29, 2019, 09:41:21 pm
There are two things wrong with that.

First, everything with round brackets is a function.
  on(...) is and event dispatcher function defining what events (listed in bracket) this particular function shall process, the function body is in { ...} brackets.
  Object() is basic function creating generic object, which is a data structure holding properties and functions (called method when attached to the object). Parameter in bracket is a data to be converted into an object, rarely used.
  So you can create an object named for example "playlist" by an expression:
var playlist = new Object();  // creates empty generic object
playlist.mainhall = "hell.mp3"; // creates new property (variable) named "mainhall" storing string value of "hell.mp3"
playlist.thetower = "dark.mp3"; // creates new property (variable) named "thetower" storing string value of "dark.mp3"
...so you can utilize object storing named list (associative array).

  The expression Object(_root) does not make a sense as it creates simple data structure converting _root pointer into object.
  The correct way of using _root pointer is _root.focus.camera.area.char.kendra.gotoAndPlay(“a”);
However that would work only if the file timeline is a root, which is only case when file is loaded standalone.

When you want the file to work regardless of on a top of what it is loaded, don't use _root pointer, refer objects relatively:
In your file, you have a "focus" object in the main timeline. That contains "camera" object, which contains "area", which contains "char", which contains "kendra".
Also you have a "controller" object in the main timeline, which contains lot of stuff including buttons and "speed_status" object.
So when you have a button script in the "controller" object and want to call a function in the "kendra" object,
you have to use a "_parent" pointer to get a level up in the hierarchy from the "controller" object to file's main timeline (which may have a name if loaded as object atop something in a game), then use object names on the path to kendra, so it is:
_parent.focus.camera.area.char.kendra.gotoAndPlay("a");  to call gotoAndPlay("a") in the kendra object.
And to control "speed_status" object, which is in the same "controller" object as the button, you call
speed_status.gotoAndPlay("a");

That's assuming that you have your speed buttons placed in the "controller" object directly.
If you have your buttons wrapped in some object and then the object placed in the "controller", then you have to use "_parent" pointer twice - first to get from the buttom wrapper to the "controller" object and second to get from "controller" up to file's timeline:
_parent._parent.focus.camera.area.char.kendra.gotoAndPlay("a");
To control neighbor object "speed_status" you have to go one level up and then dive in and call it's function:
_parent.speed_status.gotoAndPlay("a");

That's all I can see now.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on December 29, 2019, 10:00:29 pm
Awesome I’ll definitely give it a try. I just wish that it was easier to see the hierarchy in Flash
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on December 29, 2019, 11:06:01 pm
Okay I got it to work! Thanks. Also I noticed one of your scripts in jasmin’s controller:

On(release){
Function
}

On(keyPress “2”){
Same function
}

You can condense this into:

On(release, keyPress “2”){
Function
}
Title: Re: Scripts
Post by: Tabby on December 30, 2019, 11:09:58 am
Yes, that's how I've been doing that lately. The two function, one for each event, is the way how Crow did it and how I've been doing that when I was learning Flash.
You can find much more mess in Crow's files, like two functions for the same event, each holding part of the action code, or action broken into 3 functions performed on 3 different events: on mouse over, on press and on release. Which could end up in a mess if player presses mouse outside the button, move cursor over button and releases mouse button.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on December 30, 2019, 02:24:09 pm
Lol Crow’s got that 2-dimensional coding style.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on January 21, 2020, 03:20:10 pm
Okay so I’ve been thinking about making a script that controls the player genus. I was planning on drawing one full genus (min) to add to every scene for next release. The only way I could think to do it is to add frames to the player body parts with different skins on each frame similar to the p en is. The only issue for me is controlling them to sync to the player_genus value from one script for easy implementation.

Since the frames could be named to match the genus,
Could we write a script that gets the player_genus value but instead of a bunch of if statements,

gotoandstop(player_genus)

Example:

genus = player_genus;

P e n I s.Gotoandstop(genus);
leg.Gotoandstop(genus);

Etc

would flash try to gotoandstop(“player_genus”)
And throw an error since there wouldn’t be a frame named player_genus or would it read it as Gotoandstop(“whatever the genus is”)?

I hope I haven’t confused you.


Title: Re: Scripts
Post by: Tabby on January 21, 2020, 10:06:28 pm
Yes, Crow's code is crap.

I'm already using that approach for sprite dress options.

Just for sure, test if that variable exists first

Basic idea

if (root.genus != undefined)
{
  leg.gotoAndStop(root.genus);
  pnis.gotoAndStop(root.genus);
}
else
{
  leg.gotoAndStop("default");
  pnis.gotoAndStop("default");
}


or more sophisticated, if the player segment DefineSprite does not have script in the first frame to stop in default, then make it stop in default first:


leg.gotoAndStop("default");
pnis.gotoAndStop("default");
if (root.genus != undefined)
{
  leg.gotoAndStop(root.genus);
  pnis.gotoAndStop(root.genus);
}

If the value of root.genus exists but does not match any frame label, then gotoAndStop(root.genus) does nothing and DefineSprite stays in "default" labeled frame.

Also you can do inconsistent variations, for example:

leg.gotoAndStop("default");
pnis.gotoAndStop("default"); // the first two lines are necessary only if these Sprites don't have own scripts.
var localgenus = "default";
if (root.genus != undefined)
{
  localgenus = root.genus;
  leg.gotoAndStop(root.genus);
}
if (root.gender == "female")
{
  localgenus = "female";
}
pnis.gotoAndStop(localgenus);

Which overrides genus to female for pnis DefineSprite dildo frame labeled "female" regardless the genus.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on January 22, 2020, 12:19:40 am
Okay, and also how many dildo types are there for female players?
Title: Re: Scripts
Post by: Tabby on January 22, 2020, 10:01:46 pm
Depends on scene. Some scenes have 3 different dildos (toggled on mouse click), some scenes have no female option at all.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on January 22, 2020, 10:20:00 pm
I’ll try to find as many as possible. Already drawing up a horse skin for the default sprite!
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on January 24, 2020, 01:34:47 am
Jesus F u c k i n g Christ Crow!


[attachment deleted by admin]
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on April 26, 2021, 07:01:26 pm
Created virtual camera for use in some scenes. The issue is that when it is used on scenes that are not in 640x360 (hth2B default) subsequent calls of the _root.filename result in an offset of the _root stage. I messed around with some settings but I can't get anything to work. Here's what I did.

create a symbol with a rectangular bitmap, align to stage, set resolution to default.
insert action to frame 1 as follows:

import flash.geom.Matrix;
import flash.geom.Transform;
import flash.geom.ColorTransform;
var cameraTrans:Transform = new Transform(this);
var stageTrans:Transform = new Transform(this._parent);
var w:Number = Stage.width;
var h:Number = Stage.height;
this._visible = false;
this.onEnterFrame = function () {
this._parent.filters = this.filters;
stageTrans.colorTransform = cameraTrans.colorTransform;
var stageMatrix:Matrix = cameraTrans.matrix;
stageMatrix.invert();
stageMatrix.translate(w*.5, h*.5);
stageTrans.matrix = stageMatrix;
};

In most scenes when you move the symbol, it acts like a camera without lag that can be animated and have effects applied to it. I used the method on the cindy scene. It doesnt work on some scenes without breaking when loading another swf. That's my confusion
Title: Re: Scripts
Post by: Tabby on April 27, 2021, 03:12:30 pm
Tampering with the stage is a way to get in trouble. I discourage you from that.
It is better transform MovieClip object with the scene only. Either to transform object with entire loaded file (this in file’s main line frame script or _root.ptr from loader’s POV) or better only transform the object with animation itself, so it doesn’t affect buttons/controls of the animation.
You don’t need to use Transform class (which is for color transformation anyway) or Matrix class, you can access/change MovieClip type object offset and scale properties directly.
For example if the script is in the object you are transforming, properties are:
this._x //offset in pixels
this._y
this._xscale //scale in percents
this._yscale

By default the _root.ptr node where the file is mounted on has zero offset and 100% scale. However scene loader doesn’t reset these properties on next file load (unless you go through loader menu where _root.ptr object is deleted and recreated. To avoid mounting point properties carry over from one scene to another, update hth_beta.swf loader script in frame 2 with following code:

stop();
Mouse.show();
var file_path = "data/" + _root.filename;
if(_root.filename == "none" || _root.filename == undefined)
{
   gotoAndStop("loadmenu");
}
else
{
   var sceneListener = new Object();
   sceneListener.onLoadError = function(target_mc, errorCode)
   {
      var _loc3_ = createTextField("emsg",getNextHighestDepth(),100,100,600,40);
      _loc3_.text = "Error loading file " + file_path + "\nErrorCode " + errorCode;
      var _loc4_ = new TextFormat();
      _loc4_.bold = true;
      _loc4_.font = "Arial";
      _loc4_.color = 16777215;
      _loc4_.leftMargin = 5;
      _loc3_.setTextFormat(_loc4_);
   };
   var scene_mcl = new MovieClipLoader();
   scene_mcl.addListener(sceneListener);
   if(emsg != undefined)
   {
      emsg.removeTextField();
   }
   this.ptr.removeMovieClip();
   this.createEmptyMovieClip("ptr",2);
   scene_mcl.loadClip(file_path,"ptr");
   nextFrame();
}


There is already similar code.
Mounting point object is deleted and recreated here. (also fixes bug not printing error on file load fail)

You can use the same fluent camera move that I’ve added to many scenes in HTH Offline where I’ve replaced control buttons.
Lets the scene have to main MovieClip class objects:
this.scene in layer 1 where the background and animation are.
this.controller where all buttons are.
Inside the controller a zoom button is: this.controller.zoom_btn
Now lets create a script for main scene object to automatically follow scale and offset in command variables.

First declare command variables (note that this[/] inside function refers to scene object)

scene.onLoad = function()
{
   this.cmd_x = 0;
   this.cmd_y = 0;
   this.cmd_s = 100;
}[/]

And then each frame check these variables to current offset/scale and if it differs, move half distance from current position to commanded position. Except when the difference is less than 1 pixel (or 1% of scale), then go to the final offset because iterative halving is an infinite row.

scene.onEnterFrame = function()
{
   var difference = this.cmd_x - this._x; // check difference into local variable
   if(difference != 0)
   {
      if(difference > -1 && difference < 1) // difference is too small, go final
      {
         this._x = this.cmd_x;
      }
      else
      {
         difference = difference / 2;   // go half way
         this._x = this._x + difference;
      }
   }
   difference = this.cmd_y - this._y;  // the same for vertical offset
   if(difference != 0)
   {
      if(difference > -1 && difference < 1)
      {
         this._y = this.cmd_y;
      }
      else
      {
         difference = difference / 2;
         this._y = this._y + difference;
      }
   }
   difference = this.cmd_s - this._xscale; // the same for scale, assuming you want to keep aspect ratio, _xscale = _yscale
   if(difference_ != 0)
   {
      if(difference > -1 && difference < 1)
      {
         this._xscale = this.cmd_s;
         this._yscale = this.cmd_s;
      }
      else
      {
         difference = difference / 2;
         this._xscale = this._xscale + difference;
         this._yscale = this._xscale;
      }
   }
}


Now create scripts for control button going through 3 camera view steps sequentially, one on each click

controller.camera = 1; // declaring camera step tracking variable (not using "var" as it's not a local temporary variable
controller.zoom_btn.onRelease = function() // script for button click
{
   if(this._parent.camera == 1) // camera is currently in the first view, go to next
   {
      this._parent.camera = 2;
      this._parent._parent.scene.cmd_x = -103; // move scene left by 103 pixels
      this._parent._parent.scene.cmd_y = -80;
      this._parent._parent.scene.cmd_s = 125; // +25% zoom
   }
   else if(this._parent.camera == 2)
   {
      this._parent.camera = 3;
      this._parent._parent.scene.cmd_x = -150;
      this._parent._parent.scene.cmd_y = -100;
      this._parent._parent.scene.cmd_s = 200;
   }
   else if(this._parent.camera == 3) // camera is in the last step, go back to the first
   {
      this._parent.camera = 1;
      this._parent._parent.scene.cmd_x = 0;
      this._parent._parent.scene.cmd_y = 0;
      this._parent._parent.scene.cmd_s = 100;
   }
};


Of course you have to replace references to actual object paths in your file.
To find the right offset is just to iteratively try numbers until you find the best one.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on June 07, 2021, 09:43:43 pm
Best method to delete an instance such as a button?
Title: Re: Scripts
Post by: Tabby on June 08, 2021, 05:12:56 pm
Depends what you mean by delete.

If it means removing button from Flash File, then find and remove DefineButton instance.

If it means removing button on the run by script, then that button has to have a name identifier. (Name can be assigned in PlaceObject tag instantiating the button for instance placed in Flash file. Script generated objects, buttons included, always have a name.)
You can delete entire button object instance by calling removeMovieClip function on that.
button_name.removeMovieClip();

Or you can just disable button function if you want to keep the button and activate i later. By deleting onRelease or onPress event handler function.
button_name.onRelease = null;

Or you can move the button far outside stage view.
button_name._x = -1000;

Actually you can make button to delete itself on click.
button_name.onRelease = function()
{
   //put button function statements here
  this.removeMovieClip(); //deletes itself, it has to be the last statement in the function, Flash Player won't execute statements after this line.
}
Title: Re: Scripts
Post by: TrickyDragon on October 03, 2021, 06:10:27 am
Hey I'm curious if it is possible for the scripts to recognize the player characters' species like how it recognizes the player characters' sex.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on October 03, 2021, 06:29:06 am
the issue isnt in the code, it's in the work required to draw the character so many times and from so many perspectives.
Title: Re: Scripts
Post by: Tabby on October 03, 2021, 08:31:33 am
Hey I'm curious if it is possible for the scripts to recognize the player characters' species like how it recognizes the player characters' sex.
Do you mean in NPC dialog, or generally in the game and sex scenes?
The sex scenes got what's drawn and implemented. Which is mostly only the player's coc.k. Which is i believe two sets of coc.ks reused for all scenes.
(Sorry for this crap board word censorship, I can't do anything about that except of moving to some another free instant forum site.)

If you mean dialog, the script for parsing dialog files I've done, can compare any root level (means global) variable in the game and choose part of dialog based on that.
What it can't do, is to print variable value into dialog text (like player's name) but I can implement such function if it's really useful.
Please check XMLdialog_manual.pdf file that came in game zip archive. It describes (almost) all what the dialog parser can do. Variable usage with example on species is in section "Conditions and branching".

You can also edit dialog files directly (in data\dialog folder) to play with that and see results in the game immediately.
If you have the latest build (0.672) you can upload your XML files here on this board. Not that I mind doing that for you, but it's always better to see the result in real time and adjust text accordingly. (i.e. too long lines)
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on October 03, 2021, 05:26:52 pm
tabby, whats the best method for saving, loading, and modifying save data?
Title: Re: Scripts
Post by: TrickyDragon on October 03, 2021, 06:32:55 pm
Hey I'm curious if it is possible for the scripts to recognize the player characters' species like how it recognizes the player characters' sex.
Do you mean in NPC dialog, or generally in the game and sex scenes?
The sex scenes got what's drawn and implemented. Which is mostly only the player's coc.k. Which is i believe two sets of coc.ks reused for all scenes.
(Sorry for this crap board word censorship, I can't do anything about that except of moving to some another free instant forum site.)

If you mean dialog, the script for parsing dialog files I've done, can compare any root level (means global) variable in the game and choose part of dialog based on that.
What it can't do, is to print variable value into dialog text (like player's name) but I can implement such function if it's really useful.
Please check XMLdialog_manual.pdf file that came in game zip archive. It describes (almost) all what the dialog parser can do. Variable usage with example on species is in section "Conditions and branching".

You can also edit dialog files directly (in data\dialog folder) to play with that and see results in the game immediately.
If you have the latest build (0.672) you can upload your XML files here on this board. Not that I mind doing that for you, but it's always better to see the result in real time and adjust text accordingly. (i.e. too long lines)

I can try out the XML files and see how my work comes out. And yeah I did mean the dialog.  I figured I'd ask in case we could experiment on how the game will remember the variables of our characters. Same for how we do with menu choices if that is possible.
Title: Re: Scripts
Post by: TrickyDragon on October 04, 2021, 12:04:59 pm
Oh and does anybody got any recommendations for what program I can use to edit flash files? Since Adobe liked off flash what kind of alternatives can I use?
Title: Re: Scripts
Post by: Tabby on October 04, 2021, 01:39:05 pm
tabby, whats the best method for saving, loading, and modifying save data?
Because Flash has no file write feature (it barely has any means of file read access) the only way to save data is AS2 SharedObject class. It was originally designed for web browser flash player for online flash programs to save some little data locally in user computer the same way web page cookies are stored. Standalone Flash Projector saves the same data deep in <user>\Application_data\... folder. That way you can save and load player settings (not all) and NPC dialog progress in HTH_vT067x.

If you want to do any Flash programming seriously, check following ActionScript 2 language reference manual. It describes literally everything you could need to know about AS2.
https://anonfiles.com/N0U544Lcu2/as2-langref_pdf
However, it's in the form of reference manual. So it expects user to be somewhat experienced in programming and be familiar with programming terms to fully understand that. If you know how to program and just need to find how to do that in this particular language, a reference manual is exactly what you need.
Title: Re: Scripts
Post by: Tabby on October 04, 2021, 01:47:41 pm
Oh and does anybody got any recommendations for what program I can use to edit flash files? Since Adobe liked off flash what kind of alternatives can I use?
I use FFDec. It's really low level SWF file editor, not much user friendly. Also it has bugs because it is someone's free time project. But it can works with any obfuscation methods used by third party tools to prevent de-compilation. Crow has used these on most HTH files.
It is available also for Linux, unlike many other Flash tools which are MS Windows only. 1r2 knows more about Flash tools. That matters for me because I have no Windows OS in my computer and Wine typically doesn't work with software requiring installation or integration with OS.
Title: Re: Scripts
Post by: TrickyDragon on October 04, 2021, 01:52:42 pm
Sounds like a pain. Figured i got a Windows myself I wanted to fiddle around with the animations and coding in the game.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on October 04, 2021, 01:55:52 pm
Flash works on playonlinux im pretty sure
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on October 04, 2021, 08:56:36 pm
okay, nice to know I'm not completely stupid. the issue is that I've set a few _root variables similar to the _root.filename implementation, but when I update their values, it doesn't seem to make any changes. What gives?
Title: Re: Scripts
Post by: Tabby on October 05, 2021, 08:43:27 pm
1r2> I haven’t seen your code so I can’t tell what’s wrong.

Generally, you use SharedObject class by declaring variable of it's type, which is by default calling object’s constructor. That is a function which you pass a parameter of stored data set name.

Let’s do it at _root level. You can place it in main timeline key frame which is at _root level so you don’t need to prefix “_root.” pointer before every identifier.

var savedata:SharedObject = SharedObject.getLocal("HTHbetaSave");

This creates object _root.savedata with some functions defined by ShareObject class and named list _root.savedata.data containing all variables that Flash Player could find in HTHbetaSave storage file. These data were loaded at the time the constructor was called, i.e. the game start.

Now you need some load function for load button to assign your game variables with values found in that loaded “savedata” object. Let’s say you have _root.species and _root.dicksize :-) variables defined with some current or default values. Let’s create load function.
saveload = function()
{
  if (_root.savedata.data.species != undefined)
   {
      _root.species = _root.savedata.data.species;
   }
  if (_root.savedata.data.dicksize != undefined)
   {
      _root.dicksize = _root.savedata.data.dicksize;
   }
}

Note1: You can omit _root. if function is defined at root level, because in Flash function has scope of place where it's defined, not from where it's called.
Note2: You have to always check that variable is defined in save data before overwritting your variable.
Now create a button (see another page of this thread on how to) and define it's action:
loadbutton.onRelease = function()
   {
     _root.saveload();
   }

... or you can paste previous function body into button function directly.

Then you need some save function for save button to get your game variables to savedata object. It's opposite of above, just you don't need to check anything, list items are created simply by assignment.
savesave = function()
{
    _root.savedata.data.species = _root.species;
    _root.savedata.data.dicksize = _root.dicksize ;
}

You don't need to call anything to actually write the data to the disk, the Flash Player does that automatically on program exit. (Now I actually don't know if AS2 has object destructor functions as it doesn't have a delete operator to explicitly undo data structures and to free memory. If it does, that would be logical place for file save.)
If you want to force Flash Player write data to the disk on button press anyway, you can add statement
_root.savedata.flush();
on the end of that savesave function. But there is no reason to unless your player usually terminates by crashing.
Now create save button calling (or containing) that function and it's done.

I don't guarantee that this works, I didn't test that. It's just a quick idea.
Title: Re: Scripts
Post by: Tabby on October 06, 2021, 10:18:47 pm
I'm technically wrong in my previous post. Shared object data are loaded from disk storage not by SharedObject class constructor upon object declaration, but by calling it's getLocal(...) function which is practically used as an additional object constructor.
SharedObject is otherwise static class so it's formal constructor is most likely empty.
I'm sorry for confusion. I shouldn't post such things tired late in the night.

Maybe I should note short dictionary:
Object = data structure, like variable, but more complex, holding multiple variables and also functions for operations with that data.
Objects are dynamically created and removed in the dynamic data part of program memory (heap) during program run.
Class = sort of static template for object of particular type. Also contains function for creating object (constructor) and removing object (destructor), both called automatically. It is located in the fixed part of program memory and it cannot hold any data.
There are some language dependent exceptions.
Anyway, I'm doing the same mistake again by pulling this form my ... late in the night, so it may be inaccurate. After all I'm even not a programmer.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on October 07, 2021, 03:45:59 am
I'm already pretty accustomed to actionscript 2
I just couldn't get the data to override. I'll get it working as soon as possible.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on October 07, 2021, 04:18:28 pm
The data stored in so.data appears to be a table. Can I reference the values by index?
Title: Re: Scripts
Post by: TrickyDragon on October 10, 2021, 02:42:53 am
Sorry I haven't been active as much. Had like my first set of exams last week.

The data stored in so.data appears to be a table. Can I reference the values by index?

I mean, you should. Its the root data is it not? I've been learning coding recently so I'm not entirely too sure
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on October 10, 2021, 04:22:08 am
I figured, but the values don't update when I run tests. I need to make sute I'm clearimg data correctly. Will have to implement soon
Title: Re: Scripts
Post by: TrickyDragon on October 10, 2021, 05:38:10 pm
I figured, but the values don't update when I run tests. I need to make sute I'm clearimg data correctly. Will have to implement soon

I wonder if it is something hard-coded related in the data file. Idk I could be wrong, but would have to code in a new save method either to an external file to manually load but that would be us having to comb through the menu and UI stuff.
Title: Re: Scripts
Post by: Tabby on October 10, 2021, 06:26:32 pm
1r2> Please send me the files and tell me what is supposed to do. I believe I can figure it out.
I really busy IRL but I hope I can squeeze it in a week.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on October 10, 2021, 08:35:10 pm
Ok cool. You can also test the build I have in place. I already am aware of most of the bugs, I just need the save/ load function to work.
Title: Re: Scripts
Post by: Tabby on October 12, 2021, 07:11:24 am
1r2> I can't find any attempt to save or load anything in the scripts. Also I can't find any save or load button. Where it is supposed to be?

My other notes:
1. Character chat exit should return player on the place where he entered the chat = level file should jump to the frame where the character is.
Didn't I implemented something like start point in previous version?
Means that for example MainHall floor 2:
Rio button should have also statement:
_root.startpoint = "mh2_rio";
Tanya button should contain
_root.startpoint = "mh2_tanya";

The first frame of the level should have frame script:
if (_root.startpoint == "mh2_rio")
{
  gotoAndStop("2c");
}
else
{
  gotoAndStop("2a");
}
Tanya is right in the "2a"  frame so no need for condition for her.
Map button for any level using start points should clear the variable by _root.startpoint = "none"; just for sure that old value doesn't interfere.

2. Main Hall levels could have "Back to elevator" button jumping player in front of elevator for easier navigation.

3. Previous HTH beta Jezzel sprite looked better than current version. I hoped she could be saved.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 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.
Title: Re: Scripts
Post by: Tabby 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?
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on October 13, 2021, 07:48:48 pm
It should all be in the hth-launch.swf
I never loaded it anywhere else
Title: Re: Scripts
Post by: Tabby 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.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on October 14, 2021, 02:29:41 pm
I may have figured it out on my end
Title: Re: Scripts
Post by: Tabby on October 15, 2021, 07:48:11 pm
OK.
If you want me to check that, just send me the file.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on October 15, 2021, 08:03:48 pm
Is it good practice to save directly to so.data
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 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");
Title: Re: Scripts
Post by: Tabby 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;
}
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 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.
Title: Re: Scripts
Post by: 1r2k5ng09df8s3 on October 19, 2021, 05:41:56 am
I figured it out