Author Topic: ship save/load script  (Read 10422 times)

0 Members and 1 Guest are viewing this topic.

Okay thanks guys, had a feeling that may have been the way to solve it.
Is there a way to make the Yarra's warp dissapear (does set arrival info do that) or would it be easier to just have it warp in after a fade out and fade back in to start the next part?
You see that "( true )" at the bottom of the set-arrival-info SEXP? Set it to "( false )" and there won't be a warp effect.

Thanks, I suspected it would be as such.  :yes:
Too many ideas.....not enough FREDing time!

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Anims: 418, Cutscenes: 8, Mainhalls: 7, Logos: 52
    • Steam
    • Twitter
    • Mix-Hai Productions
Generally, I find it good form to fade to black when a checkpoint is chosen. Then perform all the setup stuff (ship arrivals, ship removals, skybox changes, whatever) and then fade back in.
Cutscene Upgrade Project - Mainhall Remakes - MixaelANITools - Between the Ashes - MjnMixael's Render Boutique - Mix-Hai Productions
Youtube Channel - P3D Model Box - Photobucket Albums - Model Releases - Downloads
Between the Ashes is looking for committed testers, PM me for details.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!

 
Yeah it doesn't look very nice if you don't fade to black. Its smoother when it is done behind the black screen.
Too many ideas.....not enough FREDing time!

 
You guys are fast answering any questions before I even get around reading the thread. Anyway, I'm happy that people are using my script and that it brings some life into this forum ;)
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

 
No worries Admiral MS, your script is very good and in my opinion very powerful for not only checkpoints.  :yes:
Keep up the good work mate.

EDIT: All good guys, the adding the extra event for the other ships to enter to make the checkpoint work plus the set-arrival info plus the fade out has got the checkpoint system work all properly now. Thanks for the help.
« Last Edit: November 06, 2014, 08:54:49 pm by Boomer20 »
Too many ideas.....not enough FREDing time!

 
Re: ship save/load script
Hello,
I am now trying to create a checkpoint system using your script. The script itself is great and its standard functions are working well, but I encountered a problem when trying to read long ship names from a variable.

I have variables saveexist, filename and loadship defined.

My ship-saving event looks like this:

Code: [Select]
$Formula: ( when
   ( true )
   ( script-eval
      "saveship('shipname1',3,3)"
      "saveship('shipname2',3,3)"
      ...
   )
   ( modify-variable
      "@loadship[a]"
      "longshipname1"
   )
   ( script-eval "saveship('var',3,3)" )
   ( modify-variable
      "@loadship[a]"
      "longshipname2"
   )
   ( script-eval "saveship('var',3,3)" )
   ...
)

During the mission, when the event is run, all data is written in file correctly, but I'm getting this exception (the same one goes when I load ship data from file):

Code: [Select]
LUA ERROR: [string "?"]:1: ')' expected near 'at'

------------------------------------------------------------------
ADE Debug:
------------------------------------------------------------------
Name: (null)
Name of: (null)
Function type: (null)
Defined on: 0
Upvalues: 0

Source: (null)
Short source:
Current line: 0
- Function line: 0
------------------------------------------------------------------


------------------------------------------------------------------

stack traceback:
------------------------------------------------------------------

------------------------------------------------------------------

It looks like there is a bug in your script somewhere after saving/loading data. I looked through your code, but I couldn't find any missing closing brackets. Do you have any idea what can be wrong here?


EDIT: problem solved. The reason was a ' sign in ship name that was treated by LUA as string's end.
« Last Edit: March 10, 2015, 06:12:03 pm by Macielos »

 

Offline Shivan Hunter

  • 210
  • FRED needs lambdas!
Re: ship save/load script
I just downloaded the script from the first post in this thread, and the test missions included don't work. I play saveload1.fs2 and it seems to do what it's supposed to (though I didn't notice any loading going on). I then play saveload2.fs2 and it says the savefile doesn't exist. After running both missions, the scripts folder contains a file called saveload1.txt with the contents "§third,n,1213" and two newlines. This occurs on 3.7.2 RC5.

[EDIT] Can confirm script works properly on 3.7.0.
[EDIT] Does not work in Swifty's new shadows/bloom/awesome-pixels build.
[EDIT] Tested with various nightlies. Seems to be broken on anything past 11223, and not broken on 11221 and previous.

[EDIT] Indeed, r11222 changed the cf_exists(const char *filename, int dir_type) function, and based on how the script fails (loading does nothing, saveexist() always returns false) it seems that FS's cf.fileExists() lua function always returns false.

[EDIT] r11222 is a fix for mantis 3036. As chief1983 said in the notes for that bug, there are issues with lua's cf.fileExists(). Setting the third argument to true wherever it appears in the shipsaveload-sct.tbm causes the script to work properly.
« Last Edit: April 08, 2015, 12:49:45 am by Shivan Hunter »

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Anims: 418, Cutscenes: 8, Mainhalls: 7, Logos: 52
    • Steam
    • Twitter
    • Mix-Hai Productions
Re: ship save/load script
Awesome... Can you show me an example of what to change? I'm no scripter, but I can find and replace! :)
Cutscene Upgrade Project - Mainhall Remakes - MixaelANITools - Between the Ashes - MjnMixael's Render Boutique - Mix-Hai Productions
Youtube Channel - P3D Model Box - Photobucket Albums - Model Releases - Downloads
Between the Ashes is looking for committed testers, PM me for details.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: ship save/load script
Since r11222, the behavior of cf_exists() and cf_exists_full() should be identical in this scenario, meaning that it failing to find the file with the third argument not set to true makes absolutely no sense whatsoever. Unfortunately, I have to go to bed at this exact moment, but I'll be looking into this after I wake up.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Anims: 418, Cutscenes: 8, Mainhalls: 7, Logos: 52
    • Steam
    • Twitter
    • Mix-Hai Productions
Re: ship save/load script
Something has definitely changed... but it's been so long since I updated the builds I was using with BtA, that I couldn't tell you where the problem is. I'll have to confirm with Admiral MS to see if we can nail down what's going on.
Cutscene Upgrade Project - Mainhall Remakes - MixaelANITools - Between the Ashes - MjnMixael's Render Boutique - Mix-Hai Productions
Youtube Channel - P3D Model Box - Photobucket Albums - Model Releases - Downloads
Between the Ashes is looking for committed testers, PM me for details.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!

 

Offline Shivan Hunter

  • 210
  • FRED needs lambdas!
Re: ship save/load script
Awesome... Can you show me an example of what to change? I'm no scripter, but I can find and replace! :)

Missed this post before, sorry - the temporary fix (content of shipsaveload-sct.tbm) is here. Basically all "cf.fileExists(*,*)" was changed to "cf.fileExists(*,*,true)".

 

Offline chief1983

  • Still lacks a custom title
  • 212
  • ⬇️⬆️⬅️⬅️À➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: ship save/load script
Sorry about this guys.  I dropped the ball on the file exists fix in cfile, and my broken fix ended up making it into the 3.7.2 release.  The fix for this is already in 3.7.3 but unfortunately that means anyone wanting to avoid custom builds or nightlies would have to put a workaround in their script or wait for the next release (I'm actually hoping to speed the pace of that now that we're on git though).
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 
Re: ship save/load script
Updated download with the fix for 3.7.2!

Might revert it when 3.7.4 is available.
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

 

Offline Goober5000

  • HLP Loremaster
  • Administrator
  • 214
    • Goober5000 Productions
Re: ship save/load script
I'm running into a problem using this script.  I have used it successfully for implementing checkpoints twice before, but now I'm using it on a really complex checkpoint and it seems to be choking.  It saves all the ships, but it forgets all but one of the variables.

Here is the sexp that calls the scripts:
Code: [Select]
$Formula: ( when
   ( and
      ( is-event-true-delay
         "mark clusters"
         0
      )
      ( is-event-true-delay
         "Zeta Target Miners"
         0
      )
      ( is-event-true-delay
         "Zeta Target SAC 3"
         0
      )
      ( is-event-true-delay
         "phase 2 time limit"
         0
      )
      ( not
         ( is-event-true-delay
            "unsuccessful phase 2"
            0
         )
      )
   )
   ( modify-variable
      "@filename[unset]"
      "sa_m1_03_checkpoint1"
   )
   ( script-eval "saveship('Alpha 1')" )
   ( script-eval "saveship('Beta 1')" )
   ( script-eval "saveship('Gamma 1')" )
   ( script-eval "saveship('Delta 1')" )
   ( script-eval "saveship('Zeta 1')" )
   ( script-eval "svar('random-seed')" )
   ( script-eval "svar('proximity_state')" )
   ( script-eval
      "svar('AkihamCargoScanned')"
   )
   ( script-eval
      "svar('FighterProxBitfield')"
   )
   ( script-eval-block
      "svar('"
      "ShipRecordBitfield_0_31')"
   )
   ( script-eval-block
      "svar('"
      "ShipRecordBitfield_32_63')"
   )
   ( script-eval-block
      "svar('"
      "ShipRecordBitfield_64_95')"
   )
   ( script-eval-block
      "svar('"
      "ShipRecordBitfield_96_127')"
   )
   ( script-eval
      "svar('StealthStateInAsteroids')"
   )
   ( script-eval "svar('StealthFlank')" )
   ( script-eval "svar('StealthFront')" )
   ( script-eval "svar('StealthScene')" )
   ( script-eval "svar('TargetACGLV')" )
   ( script-eval "svar('TargetAS')" )
   ( script-eval
      "svar('TargetBhavisal')"
   )
   ( script-eval "svar('TargetCP')" )
   ( script-eval "svar('TargetErebos')" )
   ( script-eval
      "svar('TargetFreighters')"
   )
   ( script-eval "svar('TargetMiners')" )
   ( script-eval "svar('TargetPCargo')" )
   ( script-eval "svar('TargetSCargo')" )
   ( script-eval "svar('TargetTotal')" )
   ( modify-variable
      @sa_m1_03_checkpoint1[0]
      1
   )
   ( show-subtitle-text
      "Checkpoint Reached!"
      0
      20
      ( true )
      ( false )
      2000
      2000
   )
   ( script-eval "saveship('Akiham',3)" )
   ( script-eval "svar('AkihamState')" )
   ( script-eval
      "saveship('Tauros 1',3)"
   )
   ( script-eval "svar('Tauros1State')" )
   ( script-eval
      "saveship('Tauros 2',3)"
   )
   ( script-eval "svar('Tauros2State')" )
   ( script-eval
      "saveship('Tauros 3',3)"
   )
   ( script-eval "svar('Tauros3State')" )
   ( script-eval
      "saveship('Tauros 4',3)"
   )
   ( script-eval "svar('Tauros4State')" )
   ( script-eval
      "saveship('Marduk 1',3)"
   )
   ( script-eval "svar('Marduk1State')" )
   ( script-eval
      "saveship('Marduk 2',3)"
   )
   ( script-eval "svar('Marduk2State')" )
   ( script-eval
      "saveship('Marduk 3',3)"
   )
   ( script-eval "svar('Marduk3State')" )
   ( script-eval
      "saveship('Marduk 4',3)"
   )
   ( script-eval "svar('Marduk4State')" )
   ( script-eval
      "saveship('Auroch 1',3)"
   )
   ( script-eval "svar('Auroch1State')" )
   ( script-eval
      "saveship('Auroch 2',3)"
   )
   ( script-eval "svar('Auroch2State')" )
   ( script-eval
      "saveship('Auroch 3',3)"
   )
   ( script-eval "svar('Auroch3State')" )
   ( script-eval
      "saveship('Auroch 4',3)"
   )
   ( script-eval "svar('Auroch4State')" )
   ( script-eval "saveship('Nandi 1',3)" )
   ( script-eval "saveship('Nandi 2',3)" )
   ( script-eval "saveship('Nandi 3',3)" )
   ( script-eval "saveship('Nandi 4',3)" )
   ( script-eval
      "saveship('Gugalana 1',3)"
   )
   ( script-eval
      "saveship('Gugalana 2',3)"
   )
   ( script-eval
      "saveship('Gugalana 3',3)"
   )
   ( script-eval
      "saveship('Gugalana 4',3)"
   )
)
+Name: end of phase 2
+Repeat Count: 1
+Interval: 1

But here is the resulting save file.  Note that it has forgotten all but the Auroch4State variable.

Code: [Select]
§§§§§§§§§Auroch4State,n,1
Alpha 1,Beta 1,Gamma 1,Delta 1,Zeta 1,Akiham,Tauros 1,Tauros 2,Tauros 3,Tauros 4,Marduk 1,Marduk 2,Marduk 3,Marduk 4,Auroch 1,Auroch 2,Auroch 3,Auroch 4,Nandi 1,Nandi 2,Nandi 3,Nandi 4,Gugalana 1,Gugalana 2,Gugalana 3,Gugalana 4
1,GVF Ptah,Friendly,220,220,40,300,150,330,82.5,82.5,82.5,82.5,:5&22§-1,-1,-2&22§-1,-1,-2&22§-1,-1,-2&22§-1,-1,-2&77§-1,-1,-2&:1,0,0,Mekhu HL-7,1,0,-1,2,0,1,Harpoon,1,8,8,Hornet,0,10,10,-1:1749.4664306641,1945.6525878906,-6681.3193359375,0.2119675129652,0.84559243917465,0.4899420440197,-0.9258154630661,0.33428671956062,-0.17640353739262,-0.3129466176033,-0.41620409488678,0.85372048616409,-26.920928955078,-31.220394134521,80.040863037109,0.028319850564003,-0.20697958767414,0.10348979383707
-1,:::
-1,:::
-1,:::
-1,:::
1,SFr Asmodeus,Hostile,8000,8000,0,-1,-1,0,0,0,0,0,:9&160§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&160§1,0,0,Standard Flak,0,0,-1,-1,-2&160§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&160§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&800§-1,-1,-2&800§-1,-1,-2&2800§-1,-1,-2&1200§-1,-1,-2&400§-1,-1,-2&:-1,-1,-1:2015.7319335938,2416.9699707031,-6971.810546875,0.76672065258026,0.0030975113622844,0.64197355508804,-3.1947376555763e-05,0.99998861551285,-0.0047867726534605,-0.64198106527328,0.0036496073007584,0.76671189069748,-9.9432001113892,0.056258119642735,12.779983520508,-7.8788480095682e-06,-0.052359879016876,-1.0372954420745e-05
1,SG Rahu,Hostile,15000,15000,0,-1,100,0,0,0,0,0,:9&8250§-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&750§-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&:-1,-1,-1:-387.93002319336,2683.7058105469,141.72229003906,0.022241676226258,0.99865698814392,0.046793092042208,0.92409145832062,-0.0026743800844997,-0.38216230273247,-0.38152387738228,0.051741026341915,-0.92290979623795,-9.7253007888794,1.5225415229797,-22.98059463501,-0.0098177222535014,-0.013089870102704,-5.3543990361504e-06
1,SG Rahu,Hostile,15000,15000,0,-1,100,0,0,0,0,0,:9&8250§-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&750§-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&:-1,-1,-1:-371.04776000977,1029.3172607422,1891.2720947266,-0.74798130989075,0.01705326884985,-0.66350078582764,-0.14498016238213,0.97133135795593,0.1884049475193,0.6476919054985,0.23711779713631,-0.7240651845932,2.0399961471558,17.785364151001,-1.8436107635498,0,0,0
1,SG Rahu,Hostile,15000,15000,0,-1,100,0,0,0,0,0,:9&8250§-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&750§-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&:-1,-1,-1:-697.95867919922,1355.4770507813,3.6695795059204,0.99060279130936,-0.055693596601486,0.12491779029369,0.056748703122139,0.99837654829025,-0.0049011660739779,-0.12444201111794,0.011944029480219,0.9921550154686,0,0,0,-2.8025969286496e-45,2.8025969286496e-45,2.8025969286496e-45
1,SG Rahu,Hostile,15000,15000,0,-1,100,0,0,0,0,0,:9&8250§-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&750§-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&:-1,-1,-1:414.72634887695,556.40447998047,-84.58536529541,0.98482799530029,0.020200338214636,-0.17235386371613,0.011632325127721,0.98328328132629,0.18171043694019,0.17314326763153,-0.18095837533474,0.96812987327576,0,0,0,-2.8025969286496e-45,2.8025969286496e-45,2.8025969286496e-45
1,SG Rahu,Hostile,15000,15000,0,-1,100,0,0,0,0,0,:9&8250§-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&750§-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&:-1,-1,-1:-252.92047119141,1966.3835449219,1017.5070800781,-0.50716537237167,0.81865471601486,0.26942130923271,0.81662517786026,0.35653561353683,0.45387834310532,0.27551129460335,0.45020759105682,-0.84935653209686,2.225492477417,3.4630470275879,-6.3334193229675,0.039269909262657,8.3833304742598e-09,4.8773788563494e-08
1,SG Rahu,Hostile,15000,15000,0,-1,100,0,0,0,0,0,:9&8250§-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&750§-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&:-1,-1,-1:1389.0887451172,985.52075195313,1873.6368408203,-0.68945723772049,-0.024940863251686,0.7238963842392,0.1892569065094,0.9584869146347,0.21327394247055,-0.69916516542435,0.28404608368874,-0.65611606836319,0,0,0,0,0,0
1,SG Rahu,Hostile,15000,15000,0,-1,100,0,0,0,0,0,:9&8250§-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&750§-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&:-1,-1,-1:497.95657348633,980.94219970703,-236.01528930664,0.99938416481018,0.03196494281292,0.014573499560356,-0.026034750044346,0.95242595672607,-0.30365744233131,-0.023587238043547,0.30309188365936,0.95267045497894,0,0,0,0,0,0
1,SG Rahu,Hostile,15000,15000,0,-1,100,0,0,0,0,0,:9&8250§-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&750§-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&:-1,-1,-1:502.50012207031,444.89120483398,1783.6767578125,-0.99976217746735,-0.0013449247926474,0.021768424659967,0.016912292689085,0.58241301774979,0.81271719932556,-0.013771256431937,0.81289196014404,-0.58225172758102,-0.079322904348373,-9.1715831756592,-8.3134927749634,-0.02126107364893,-0,-0
1,SG Rahu,Hostile,15000,15000,0,-1,100,0,0,0,0,0,:9&8250§-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&750§-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&:-1,-1,-1:1560.4761962891,1216.4621582031,-134.83256530762,-0.44461166858673,0.033565573394299,0.89509433507919,0.079608127474785,0.99682402610779,0.0021626011002809,-0.89217889308929,0.072218306362629,-0.44587162137032,-12.260375022888,0.99243462085724,-6.1271953582764,0,0,0
1,SG Rahu,Hostile,15000,15000,0,-1,100,0,0,0,0,0,:9&8250§-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&750§-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&:-1,-1,-1:1967.5775146484,1490.1624755859,967.74774169922,-0.015821624547243,0.0021374630741775,0.99987250566483,0.011283962056041,0.9999343752861,-0.0019590419251472,-0.99981111288071,0.011251525953412,-0.015844708308578,-16.519058227539,0.56184715032578,-0.63938641548157,0.039267908781767,0.039271909743547,-2.2700987756252e-09
1,SG Rahu,Hostile,15000,15000,0,-1,100,0,0,0,0,0,:9&8250§-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&750§-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&:-1,-1,-1:2555.3361816406,1438.9107666016,905.05975341797,0.55889397859573,-0.18078395724297,0.80929273366928,0.63395726680756,0.72226411104202,-0.2764650285244,-0.53454262018204,0.66757160425186,0.51827836036682,-13.367321014404,16.685007095337,12.958599090576,0.00056615460198373,-4.3055409980897e-16,-6.3940339134483e-11
1,SG Rahu,Hostile,15000,15000,0,-1,100,0,0,0,0,0,:9&8250§-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§1,0,0,Shivan Heavy Laser,0,0,-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&750§-1,-1,-2&750§-1,-1,-2&300§-1,-1,-2&:-1,-1,-1:2628.9907226563,914.78259277344,1227.3508300781,-0.38969203829765,-0.085560120642185,0.91696220636368,-0.35064280033112,0.9344664812088,-0.061823315918446,-0.85158079862595,-0.34561821818352,-0.39415517449379,-21.289522171021,-8.6404581069946,-9.8538846969604,0,0,0
1,SFr Dis,Hostile,7000,7000,0,-1,-1,0,0,0,0,0,:9&140§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&140§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&140§1,0,0,Standard Flak,0,0,-1,-1,-2&140§1,0,0,Standard Flak,0,0,-1,-1,-2&700§-1,-1,-2&700§-1,-1,-2&2450§-1,-1,-2&1050§-1,-1,-2&350§-1,-1,-2&:-1,-1,-1:-12692.14453125,1075.083984375,-9313.240234375,-0.00013404585479293,0.99796831607819,0.063713036477566,0.00105993647594,0.063713148236275,-0.99796783924103,-0.99999952316284,-6.62416787236e-05,-0.0010663233697414,-42.00297164917,-0.0027823492418975,-0.044788770377636,-0,-0,-0
1,SFr Dis,Hostile,7000,7000,0,-1,-1,0,0,0,0,0,:9&140§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&140§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&140§1,0,0,Standard Flak,0,0,-1,-1,-2&140§1,0,0,Standard Flak,0,0,-1,-1,-2&700§-1,-1,-2&700§-1,-1,-2&2450§-1,-1,-2&1050§-1,-1,-2&350§-1,-1,-2&:-1,-1,-1:-12335.026367188,1074.5417480469,-8114.462890625,-0.00015267438720912,0.9978329539299,0.065798848867416,0.0013103621313348,0.065798997879028,-0.99783211946487,-0.99999916553497,-6.6123095166404e-05,-0.0013175681233406,-42.00297164917,-0.0027773682959378,-0.055341817438602,-0,0,-0
1,SFr Dis,Hostile,7000,7000,0,-1,-1,0,0,0,0,0,:9&140§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&140§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&140§1,0,0,Standard Flak,0,0,-1,-1,-2&140§1,0,0,Standard Flak,0,0,-1,-1,-2&700§-1,-1,-2&700§-1,-1,-2&2450§-1,-1,-2&1050§-1,-1,-2&350§-1,-1,-2&:-1,-1,-1:-12071.549804688,1073.9110107422,-6917.3559570313,-0.00016516138566658,0.99799358844757,0.063314735889435,0.001561131211929,0.06331492215395,-0.99799239635468,-0.9999988079071,-6.5987194830086e-05,-0.0015684560639784,-42.002956390381,-0.0027716606855392,-0.065879851579666,0,0,-0
1,SFr Dis,Hostile,7000,7000,0,-1,-1,0,0,0,0,0,:9&140§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&140§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&140§1,0,0,Standard Flak,0,0,-1,-1,-2&140§1,0,0,Standard Flak,0,0,-1,-1,-2&700§-1,-1,-2&700§-1,-1,-2&2450§-1,-1,-2&1050§-1,-1,-2&350§-1,-1,-2&:-1,-1,-1:-11681.903320313,1078.8231201172,-6319.19921875,-0.00018842735153157,0.99741989374161,0.071788139641285,0.0016845333157107,0.071788363158703,-0.99741852283478,-0.99999862909317,-6.7011424107477e-05,-0.0016937139444053,-42.002952575684,-0.0028146819677204,-0.071141093969345,-0,0,-0
1,SFr Dis,Hostile,7000,7000,0,-1,-1,0,0,0,0,0,:9&140§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&140§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&140§1,0,0,Standard Flak,0,0,-1,-1,-2&140§1,0,0,Standard Flak,0,0,-1,-1,-2&700§-1,-1,-2&700§-1,-1,-2&2450§-1,-1,-2&1050§-1,-1,-2&350§-1,-1,-2&:-1,-1,-1:-2279.6684570313,1432.3571777344,-5967.4145507813,0.0037887820508331,0.00094227399677038,-0.99999243021011,-0.00079163914779201,0.99999934434891,0.00093928113346919,0.9999925494194,0.00078807427780703,0.003789525013417,42.00269317627,0.033102300018072,0.15917903184891,0,0,0
1,SFr Dis,Hostile,7000,7000,0,-1,-1,0,0,0,0,0,:9&140§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&140§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&140§1,0,0,Standard Flak,0,0,-1,-1,-2&140§1,0,0,Standard Flak,0,0,-1,-1,-2&700§-1,-1,-2&700§-1,-1,-2&2450§-1,-1,-2&1050§-1,-1,-2&350§-1,-1,-2&:-1,-1,-1:-2695.1577148438,1432.0119628906,-6573.1518554688,-0.0044539640657604,0.00052171957213432,-0.99998992681503,-0.00079270644346252,0.99999958276749,0.00052525533828884,0.99998980760574,0.00079503800952807,-0.0044535486958921,42.002578735352,0.033392697572708,-0.18706528842449,0,0,0
1,SFr Dis,Hostile,7000,7000,0,-1,-1,0,0,0,0,0,:9&140§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&140§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&140§1,0,0,Standard Flak,0,0,-1,-1,-2&140§1,0,0,Standard Flak,0,0,-1,-1,-2&700§-1,-1,-2&700§-1,-1,-2&2450§-1,-1,-2&1050§-1,-1,-2&350§-1,-1,-2&:-1,-1,-1:-3007.9592285156,1431.8013916016,-7171.7045898438,-0.012268927879632,0.0037197540514171,-0.99991780519485,-0.00073440955020487,0.99999284744263,0.0037290442269295,0.99992454051971,0.00078010058496147,-0.012266108766198,41.999839782715,0.032766491174698,-0.51521396636963,-0,-0,-0
1,SFr Dis,Hostile,7000,7000,0,-1,-1,0,0,0,0,0,:9&140§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&140§1,0,0,Shivan Light Laser,0,0,-1,-1,-2&140§1,0,0,Standard Flak,0,0,-1,-1,-2&140§1,0,0,Standard Flak,0,0,-1,-1,-2&700§-1,-1,-2&700§-1,-1,-2&2450§-1,-1,-2&1050§-1,-1,-2&350§-1,-1,-2&:-1,-1,-1:-3320.037109375,1431.6094970703,-7765.5537109375,-0.020158337429166,0.0045972722582519,-0.99978625774384,-0.0006685794214718,0.9999892115593,0.0046116858720779,0.99979662895203,0.00076140038436279,-0.020155046135187,41.994464874268,0.031982272863388,-0.84656834602356,0,0,0

I looked in fs2_open.log and the script seems to know about the variables, at least.  (I wish the logging used newlines here, but at least I can follow what it's doing):

Code: [Select]
random-seed,n,698random-seed,n,698&proximity_state,n,1random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288&ShipRecordBitfield_0_31,n,-2129657859random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288&ShipRecordBitfield_0_31,n,-2129657859&ShipRecordBitfield_32_63,n,2147438863random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288&ShipRecordBitfield_0_31,n,-2129657859&ShipRecordBitfield_32_63,n,2147438863&ShipRecordBitfield_64_95,n,1010270175random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288&ShipRecordBitfield_0_31,n,-2129657859&ShipRecordBitfield_32_63,n,2147438863&ShipRecordBitfield_64_95,n,1010270175&ShipRecordBitfield_96_127,n,968random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288&ShipRecordBitfield_0_31,n,-2129657859&ShipRecordBitfield_32_63,n,2147438863&ShipRecordBitfield_64_95,n,1010270175&ShipRecordBitfield_96_127,n,968&StealthStateInAsteroids,n,0random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288&ShipRecordBitfield_0_31,n,-2129657859&ShipRecordBitfield_32_63,n,2147438863&ShipRecordBitfield_64_95,n,1010270175&ShipRecordBitfield_96_127,n,968&StealthStateInAsteroids,n,0&StealthFlank,n,200random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288&ShipRecordBitfield_0_31,n,-2129657859&ShipRecordBitfield_32_63,n,2147438863&ShipRecordBitfield_64_95,n,1010270175&ShipRecordBitfield_96_127,n,968&StealthStateInAsteroids,n,0&StealthFlank,n,200&StealthFront,n,300random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288&ShipRecordBitfield_0_31,n,-2129657859&ShipRecordBitfield_32_63,n,2147438863&ShipRecordBitfield_64_95,n,1010270175&ShipRecordBitfield_96_127,n,968&StealthStateInAsteroids,n,0&StealthFlank,n,200&StealthFront,n,300&StealthScene,n,1random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288&ShipRecordBitfield_0_31,n,-2129657859&ShipRecordBitfield_32_63,n,2147438863&ShipRecordBitfield_64_95,n,1010270175&ShipRecordBitfield_96_127,n,968&StealthStateInAsteroids,n,0&StealthFlank,n,200&StealthFront,n,300&StealthScene,n,1&TargetACGLV,n,9random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288&ShipRecordBitfield_0_31,n,-2129657859&ShipRecordBitfield_32_63,n,2147438863&ShipRecordBitfield_64_95,n,1010270175&ShipRecordBitfield_96_127,n,968&StealthStateInAsteroids,n,0&StealthFlank,n,200&StealthFront,n,300&StealthScene,n,1&TargetACGLV,n,9&TargetAS,n,4random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288&ShipRecordBitfield_0_31,n,-2129657859&ShipRecordBitfield_32_63,n,2147438863&ShipRecordBitfield_64_95,n,1010270175&ShipRecordBitfield_96_127,n,968&StealthStateInAsteroids,n,0&StealthFlank,n,200&StealthFront,n,300&StealthScene,n,1&TargetACGLV,n,9&TargetAS,n,4&TargetBhavisal,n,1random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288&ShipRecordBitfield_0_31,n,-2129657859&ShipRecordBitfield_32_63,n,2147438863&ShipRecordBitfield_64_95,n,1010270175&ShipRecordBitfield_96_127,n,968&StealthStateInAsteroids,n,0&StealthFlank,n,200&StealthFront,n,300&StealthScene,n,1&TargetACGLV,n,9&TargetAS,n,4&TargetBhavisal,n,1&TargetCP,n,4random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288&ShipRecordBitfield_0_31,n,-2129657859&ShipRecordBitfield_32_63,n,2147438863&ShipRecordBitfield_64_95,n,1010270175&ShipRecordBitfield_96_127,n,968&StealthStateInAsteroids,n,0&StealthFlank,n,200&StealthFront,n,300&StealthScene,n,1&TargetACGLV,n,9&TargetAS,n,4&TargetBhavisal,n,1&TargetCP,n,4&TargetErebos,n,0random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288&ShipRecordBitfield_0_31,n,-2129657859&ShipRecordBitfield_32_63,n,2147438863&ShipRecordBitfield_64_95,n,1010270175&ShipRecordBitfield_96_127,n,968&StealthStateInAsteroids,n,0&StealthFlank,n,200&StealthFront,n,300&StealthScene,n,1&TargetACGLV,n,9&TargetAS,n,4&TargetBhavisal,n,1&TargetCP,n,4&TargetErebos,n,0&TargetFreighters,n,4random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288&ShipRecordBitfield_0_31,n,-2129657859&ShipRecordBitfield_32_63,n,2147438863&ShipRecordBitfield_64_95,n,1010270175&ShipRecordBitfield_96_127,n,968&StealthStateInAsteroids,n,0&StealthFlank,n,200&StealthFront,n,300&StealthScene,n,1&TargetACGLV,n,9&TargetAS,n,4&TargetBhavisal,n,1&TargetCP,n,4&TargetErebos,n,0&TargetFreighters,n,4&TargetMiners,n,6random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288&ShipRecordBitfield_0_31,n,-2129657859&ShipRecordBitfield_32_63,n,2147438863&ShipRecordBitfield_64_95,n,1010270175&ShipRecordBitfield_96_127,n,968&StealthStateInAsteroids,n,0&StealthFlank,n,200&StealthFront,n,300&StealthScene,n,1&TargetACGLV,n,9&TargetAS,n,4&TargetBhavisal,n,1&TargetCP,n,4&TargetErebos,n,0&TargetFreighters,n,4&TargetMiners,n,6&TargetPCargo,n,16random-seed,n,698&proximity_state,n,1&AkihamCargoScanned,n,1&FighterProxBitfield,n,12288&ShipRecordBitfield_0_31,n,-2129657859&ShipRecordBitfield_32_63,n,2147438863&ShipRecordBitfield_64_95,n,1010270175&ShipRecordBitfield_96_127,n,968&StealthStateInAsteroids,n,0&StealthFlank,n,200&StealthFront,n,300&StealthScene,n,1&TargetACGLV,n,9&TargetAS,n,4&TargetBhavisal,n,1&TargetCP,n,4&TargetErebos,n,0&TargetFreighters,n,4&TargetMiners,n,6&TargetPCargo,n,16&TargetSCargo,n,14Frame 5462 too long!!: frametime = 1.335 (1.335)
It looks like it's saving variables just fine up until it gets to TargetTotal.  Then, at least, it stops writing to the log.  It still saved Auroch4State despite this variable not appearing in the log.

 
Re: ship save/load script
This is strange. Besides the fact that only the last variable is properly saved, the script tried to save maybe half of the variables you actually wanted to save.
I'll fix the problem later today.

Edit: Looking at my script I think I have an idea why this happens. The script didn't have variable saving at first. To be able to use old files with a newer script version I added some compatibility functions that also convert old files. This somehow deletes the saved variables when saving a ship and corrupts the savefile  :banghead:
« Last Edit: June 30, 2017, 03:09:41 am by Admiral MS »
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

  
Re: ship save/load script
Updated first post with a download link to the new version that should fix this issue.
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

 

Offline Goober5000

  • HLP Loremaster
  • Administrator
  • 214
    • Goober5000 Productions
Re: ship save/load script
Indeed, it fixes it.  Thanks!

 

Offline Goober5000

  • HLP Loremaster
  • Administrator
  • 214
    • Goober5000 Productions
Re: ship save/load script
Actually, one additional question.  How well does this script handle loading the status of docked ships?

 
Re: ship save/load script
Back when I made the script it was not possible to properly detect the docking status of ships so the script ignores it. If you load two ships that were docked it will position them as if docked but they might bounce off each other afterwards...
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

 

Offline Goober5000

  • HLP Loremaster
  • Administrator
  • 214
    • Goober5000 Productions
Re: ship save/load script
Ok, no worries, I realized that I can check the mission variables and then call set-dock on the proper ships.

One suggestion for a possible future version: separate the table creation and population from the file saving.  That way, rather than writing the file to disk every time saveship or sval is called, you would just defer that and have the FREDder call a savefile function at the end.

Another suggestion is to specify the filename and other parameters in the script parameters rather than in sexp variables.  The new(ish) script-eval-block lets you make longer function calls.