Author Topic: Scripts  (Read 5100 times)

  • Administrator
  • Sr. Member
  • *****
  • Posts: 407
    • View Profile
Re: Scripts
« Reply #15 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.
« Last Edit: January 21, 2020, 10:10:26 pm by Tabby »

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
Re: Scripts
« Reply #16 on: January 22, 2020, 12:19:40 am »
Okay, and also how many dildo types are there for female players?

  • Administrator
  • Sr. Member
  • *****
  • Posts: 407
    • View Profile
Re: Scripts
« Reply #17 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.

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
Re: Scripts
« Reply #18 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!

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
Re: Scripts
« Reply #19 on: January 24, 2020, 01:34:47 am »
Jesus F u c k i n g Christ Crow!


[ Attachment Invalid Or Does Not Exist ]

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

  • Administrator
  • Sr. Member
  • *****
  • Posts: 407
    • View Profile
Re: Scripts
« Reply #21 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.

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
Re: Scripts
« Reply #22 on: June 07, 2021, 09:43:43 pm »
Best method to delete an instance such as a button?

  • Administrator
  • Sr. Member
  • *****
  • Posts: 407
    • View Profile
Re: Scripts
« Reply #23 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.
}

  • Newbie
  • *
  • Posts: 21
  • Location: United States
    • View Profile
Re: Scripts
« Reply #24 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.
===================================================================
See ya, Bladerunner.

===================================================================

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
Re: Scripts
« Reply #25 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.

  • Administrator
  • Sr. Member
  • *****
  • Posts: 407
    • View Profile
Re: Scripts
« Reply #26 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)

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
Re: Scripts
« Reply #27 on: October 03, 2021, 05:26:52 pm »
tabby, whats the best method for saving, loading, and modifying save data?
« Last Edit: October 04, 2021, 05:03:17 am by 1r2k5ng09df8s3 »

  • Newbie
  • *
  • Posts: 21
  • Location: United States
    • View Profile
Re: Scripts
« Reply #28 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.
===================================================================
See ya, Bladerunner.

===================================================================

  • Newbie
  • *
  • Posts: 21
  • Location: United States
    • View Profile
Re: Scripts
« Reply #29 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?
===================================================================
See ya, Bladerunner.

===================================================================