Hard Light Productions Forums

FreeSpace Releases => Scripting Releases => Topic started by: Axem on July 15, 2018, 02:03:25 pm

Title: Axem's Script & Lua SEXP Collection
Post by: Axem on July 15, 2018, 02:03:25 pm
I've finally put together some of my scripts and lua sexp creations for public consumption, so everyone can share in the wonderment of near effortless use of lua scripts!

I've put them all on GitHub, so you can download them from there, report issues, or create PRs if you want to fix my bad scripting. I'm only going to post in this thread about new scripts that get added, smaller updates will just be committed without much comment.

The README has a basic overview of what each script does. The Lua SEXP documentation gets into a bit more detail. There are sample missions in some of the folders were applicable.

https://github.com/AxemP/AxemFS2Scripts

In progress right now are:
Collection of miscellaneous Lua SEXPs Released!
Item Drop script as seen in JAD
Infinite Ship spawning system as seen in JAD
Turret Control script that allows fine control of turrets (a lua-fire-turret sexp will be included!)
Title: Re: Axem's Script & Lua SEXP Collection
Post by: wookieejedi on July 15, 2018, 04:04:39 pm
Awesome to see these in one easy to get place! Great for folks who want to use them and who want to learn from them (like me).
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Novachen on July 18, 2018, 10:35:54 am
Well, i think, that it is possible, that i will report issues sometimes  :D
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Nightmare on July 18, 2018, 12:06:15 pm
Would it be possible to extend the scripting to other authors as well? Axem made a lot of fine scripts, but there are others too. Most scripting examples on the wiki are broken AFAIK, and the scripting release board is too chaotic to be sure to get the latest (or even only a working) version. To show what I mean, I made that Ships DB from all FS related community-made ships, not only those from Esarai or Nyctaeus.  Single source seems more useful than many tiny.
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Axem on July 18, 2018, 11:12:41 pm
That is actually an interesting idea. An HLP Community FS Script github would be a good place that all scripts could be in one place and... hopefully in rather well enough maintained state. Anyone could become a contributor and add their scripts to it too.

The only concern I'd have is the really old scripts that no longer work because of API changes or were in pretty rough shape to begin with and only the original author knew how it worked exactly...
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Axem on July 22, 2018, 10:31:20 pm
Just added a new script, an Extended Loading Screen script!

Quote
This script will allow the modder to more finely customize mission loading screens. Added features include customizeable loading bars, randomized loading images, ability to automatically draw the mission's title, and random text (for tips or lore, as well as associated images). Care must be taken with the placement of the loading bar, random text and images, since they will not scale with the game's resolution (however, the background does have the ability to scale). This script only overrides missions that are inside the loading screen table. (A nightly after July 23, 2018 is needed to use this script)

The best part about this script is you can now use loading screens of any resolution, and they'll look great!

(https://cdn.discordapp.com/attachments/223511363807346691/470677200052420619/Clipboard01.jpg)
(https://cdn.discordapp.com/attachments/223511363807346691/470677286132121600/Clipboard02.jpg)

This is also the first script to use the brand new tbl parser now available to lua scripting, no more needing to use JSON for the config files now!
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Nightmare on June 09, 2019, 07:28:31 am
I have a feature request on behalf of the INF team, which also goes as bug report: Using the In-mission jump script for capital ships is... troublesome. The warp-in part and damage application is fine; but while jumping out the ship (a corvette) reaches only 3 m/s, and during the part where it is supposed to be in subspace it produces a clearly visible warp in the distance. Could you do something about it?
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Axem on June 09, 2019, 05:13:34 pm
The in mission jump script is only meant for fighters, not capital ships. Cap ships should use the techniques that I have here in my tutorial about in mission jumps. (https://wiki.hard-light.net/index.php/In-Mission_Jump)

Why doesn't the script work with capital ships? Because the script solves a problem that's more unique to fighters. The methods to do it with a capital ship are quite simple without any scripts. You tell the ship to warp out, copy the damage to the new unarrived ship, and cue the new ship to arrive. It's 3 small things and we're done.

What do I need to do for my wingmen or the player? I can't tell any of them to depart. For the player the mission would end, and for the wingmen; the wingman gauge is now going to be incorrect. (And the comm menu isn't going to work right if I cue in some fake Alpha wingmen) So I need to fake the warp. This means telling all ships to play dead for a bit and cut to 1/3 throttle (thats why the corvette is going so slow), figuring out where to place warp portals, stash the ships somewhere far for transit time, then make a new warp portal, place the ships at the portals*, and restore the AI. The script automates all of that because I was super tired of doing that.

* Actually the scripting system has a :warpin() function that basically makes the ship redo its warp in effect which is why capital ships would redo that part correctly. But there's no simple way to make them "fake depart". I mean I coooould, but I think the way the game could do it now is good enough.
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Nightmare on June 09, 2019, 05:55:55 pm
Well my understanding of LUA is near 0, but I know how to help myself with SEXPs, so here's a part of the solution I was thinking of (I did this when I actually ran into the fighter issue, with comm menu and wingmates being depicted as departed by the HUD):

   ( set-object-position
      "Alpha 2#Replacement"
      ( get-object-x "Alpha 2" )
      ( get-object-y "Alpha 2" )
      ( get-object-z "Alpha 2" )
   )
   ( set-object-position
      "Alpha 3#Replacement"
      ( get-object-x "Alpha 3" )
      ( get-object-y "Alpha 3" )
      ( get-object-z "Alpha 3" )
   )
   ( set-object-orientation
      "Alpha 2#Replacement"
      ( get-object-pitch "Alpha 2" )
      ( get-object-bank "Alpha 2" )
      ( get-object-heading "Alpha 2" )
   )
   ( set-object-orientation
      "Alpha 3#Replacement"
      ( get-object-pitch "Alpha 3" )
      ( get-object-bank "Alpha 3" )
      ( get-object-heading "Alpha 3" )
   )
   ( set-object-position
      "Alpha 2"
      70000
      70000
      70000
   )
   ( set-object-position
      "Alpha 3"
      70000
      70000
      70000
   )
   ( add-goal
      "Alpha 2#Replacement"
      ( ai-warp-out 89 )
   )
   ( add-goal
      "Alpha 3#Replacement"
      ( ai-warp-out 89 )
   )
   ( friendly-stealth-invisible
      "Alpha 2"
      "Alpha 3"
   )
   ( ship-stealthy "Alpha 2" "Alpha 3" )

3 things remain that are not included in this:
-the ship that jumps out as decoy has to be created first (like ship create, which would take the place of set-object-position and set-object-orientation)
-the decoy needs to receive proper speed (i.e. taking over the values of the actual ship) - this could be done via ship-maneuver.
-the visible warp could simply be fixed by sending the ship 1000km away. That's not a problem EXCEPT for the player ship, which then self destructs in such cases.

Also, this script has the advantage that you can easily define the position and vector where a ship is supposed to re-arrive through waypoints, something that is elseway only possible through using an invisible blip, having it face away from the target, and than spetting the ship#2's arrival parameters to "in front of", what is mildly said not user-friendly.

The way it works for fighters is fine for me, though.
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Nightmare on June 09, 2019, 07:20:18 pm
It's not like I wouldn't value the script as it is. Think about the way "it's so useful, I want more of that ;7 ". :) Sure I have my own ideas about it - like that one could add a "proper" event as cue for the ships' re-arrival (like you can with normal ships) instead of a fixed delay and specify "no arrival warp" as flag, so you could set up an event like "Stage 2 Start", on which all ships from Stage 1 re-appear. Some directly at the beginnig without warp, some arrive a couple moments later with warp; while in the meantime all ships that weren't present in Stage 1 arrive due to having this Event as arrival condition.

But that's all out of my formal INF request, and just my thoughts of what I think what could be a useful feature - but perhabs somebody reads and does actually make it reality. Who knows. :)
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Axem on June 09, 2019, 10:14:59 pm
What you mention would be handy but out of scope for what the script was designed for, which is a very simple intersystem jump script system that just automates the tedious sexps I got tired of writing. What you want to do might be possible with scripts right now... maybe (with ugly hacks or other ugly things), but I think anything advanced like that would be best served by being implemented in the game itself.
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Nightmare on June 10, 2019, 06:15:47 am
Well it was an attempt. :)

BTW, when do you upload the rest of your scripts to GitHub? Searching this board for scripts is a waste of time aside this single thread, with most of the other things just being broken or chaotical spread over several pages.
Title: Re: Axem's Script & Lua SEXP Collection
Post by: wookieejedi on June 10, 2019, 11:24:52 am
There was been a bit of brainstorming in collecting all the modern scripts, like Axem's, the ship-save script, and custom wingmen/mission rols script (shameless plug). It would definitely be nice to have a one-stop shop for them.
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Nightmare on June 10, 2019, 01:11:15 pm
Yeah, that was the idea, but nothing came out of it so far.
Title: Re: Axem's Script & Lua SEXP Collection
Post by: wookieejedi on June 10, 2019, 02:27:32 pm
Yeah, in talking with ngld he said a Knossos mod might be most useful, because then the modders wouldn't even have to worry about manually updating the scripts, their mods would just require the script mod.
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Nightmare on June 10, 2019, 03:11:14 pm
Interesting take on it. Possibly just add them to the MVPs?
Title: Re: Axem's Script & Lua SEXP Collection
Post by: wookieejedi on June 10, 2019, 05:00:19 pm
Probably best to have them as their own separate mod, as the mvps are visual based. Also if the scripts were in their own mod then that would ensure a much smaller file size, so it would be far quicker to upload changes and new scripts, also for total conversions that use the scripts may not need the mvps (like Fate of the Galaxy).

I just posed this question on the discord so we can continue discussion there.

Sorry to Axem  for getting off topic on his thread!
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Nightmare on June 12, 2019, 12:57:39 pm
2 bug reports I have for this script:
-1: the script adds AI-Play-Dead for all ships using it but does not remove it at the end, which condemns all non-player ships using it to a live in eternal smugness;
-2: fighters jumping in appear outside the warphole when the waypoints (used for arrival and orientation) are placed along the Y-axis (that's a problem that already exists in the original script).
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Axem on June 12, 2019, 06:50:49 pm
Okay so 1, I see you fixed in your other thread. Would it be okay to take your fix (the other other few ones you had) there and apply it? :)

2, I can reproduce it and I've discovered the issue. It's a tricky one to fix. Basically there's some weird physics or momentum stuff going on. If you reduce the warpout speed factor to 0, the problem goes away. I will have to think of the best way to fix this without overcomplicating everything. :blah:
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Nightmare on June 12, 2019, 07:08:02 pm
Okay so 1, I see you fixed in your other thread. Would it be okay to take your fix (the other other few ones you had) there and apply it? :)

All I did was adding
Code: [Select]
mn.runSEXP("( clear-goals !" .. name .. "! )")
mn.runSEXP("( ship-lat-maneuver !" .. name .. "! 1000 0 0 " .. IMJump.Speed * 100 .. "( true ) )")

at the bottom of the script (below the last "scripted SEXP" column). The second one was there because the arriving ships (at least, the corvette I tested it on) also continued to move at 10 m/s due to another ship-lat-maneuver at the begining of the script, where the movement lasted for 60 seconds. The rest is related to my custom edit, which turned out to be a mess but atleast works the way I intended.

1 tiny thing in terms of nitpicking: I can target the arriving fighter while it's still cloaked (about 1/3 second before it is decloaked). I don't know but this ship-stealthy flag behaves weird. :doubt:
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Axem on June 16, 2019, 12:50:28 pm
Dunno what's up with that early targeting. I can't reproduce it and the script says it should be unstealthed when its warping in. For a third of a second I don't think it's worth it too much to dive into since it doesn't look like anything super obvious.

So I've committed some new lua sexps as well as updates to a few other scripts.

New:
Misc Functions: A variety of misc lua sexps that can aid a FREDder to do some neat stuff. Like forcing a target for the player, getting the player's target, reversing waypoints and other fun stuff.
Scroll Write: Add cheesy one character at a time subtitle reveals, complete with sound effects!
Waypoint Assist: A system to help guide the player through waypoints with a pointer object. FREDder can keep track of which waypoint the player is at or if waypoints are completed.

Updated:
Cloak: Forcing the cloak now works properly
In Mission Jump: For the AI, play dead orders now cleared after jumping, the ship-maneuver lasts shorter, which in conjunction with a now 2 second minimum transit time, allows the AI ship to slow down to zero before jumping back in without any odd orientation errors when the ship is pointing up on the y-axis. The player is not bound by these restrictions. (I hope this solves your issues with fighters jumping, Nightmare!)
Loading Screen: Added a scale zoom option so backgrounds will be intelligently scaled for the resolution being used. Intelligently scaled means no stretching or skewed aspect ratio. Portions of the background may be clipped to fit.
Prompt Box: When using repeating events, stuff can get screwed up because the last answer to a reference is always kept. So 'lua-clear-prompt' was added to clear the reference can be cleared.
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Nightmare on June 16, 2019, 05:22:55 pm
Quote
In Mission Jump: For the AI, play dead orders now cleared after jumping, the ship-maneuver lasts shorter, which in conjunction with a now 2 second minimum transit time, allows the AI ship to slow down to zero before jumping back in without any odd orientation errors when the ship is pointing up on the y-axis. The player is not bound by these restrictions. (I hope this solves your issues with fighters jumping, Nightmare!)

That works now, thanks! :nod:
However... there are some things that work (different):
-most importantly, when I have a ship jumping out with the player following a couple seconds later into subspace, the game now throws out a debug warning:
Code: [Select]
LUA ERROR: [string "imjump-sct.tbm - On Game Init"]:81: attempt to index local 'entry' (a nil value)

------------------------------------------------------------------
ADE Debug:
------------------------------------------------------------------
------------------------------------------------------------------


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

stack traceback:
[C]: ?
[string "imjump-sct.tbm - On Game Init"]:81: in function 'Monitor'
[string "imjump-sct.tbm - On Frame"]:265: in main chunk
------------------------------------------------------------------

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

Aside the debug warning, it does not seem to have any other negative side effects. I compared it with the old script; the error only occurs with the new version. To make sure it isn't the result of some other broken script in my mod I tested it with WoD - it worked fine with the original, but again errors with the new one.

-Probably a minor thing: since the player won't move anymore inside of the subspace tunnel, the warp just forms in front of the player without moving towards it.
-Just an idea: maybe run the set-motion-debris-override SEXP when the player is inside the tunnel?


Regarding the Scroll Write script: it's a super neat thing, but could you add some documentation (and a sample) for showing the fiction files with lua-scroll-write-file? In my cluelessness I tried to feed it with the next best fiction file I had and it crashed immediatly... :(
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Axem on June 16, 2019, 06:55:30 pm
Kay, I think I fixed the issues.

Not sure why that entry is nil error started popping up. It might have to do with how the player and AIs now will be forced to do things a little differently. I just did a simple check to see if the entry is valid or not. 99% of the time that solves the issue, but if it looks like something weird is happening let me know. I also made the player continue on the ship-maneuver thing for longer so you should hit the warp portal.

The scroll write file thing I also fixed (and added an example mission and fiction file). There is no special syntax or format. Just any text file will work. I hadn't actually tested it recently. I wrote the script over a year ago and it worked then, but since then the file handling with lua has gotten stricter and the script did not keep up. My bad on that one. :blah: (I did test it so it's all good now!)
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Nightmare on June 16, 2019, 07:23:52 pm
Beautiful work you did there! :) :yes:
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Axem on November 17, 2019, 11:02:27 am
Posted some updates, bug fixes for some, and some new stuff.

There's a "GetClosest' script which will find you the closest ship from a given team from a given origin. That ship is put into a sexp string variable. Use that for mines or something.

Misc-functions got an update with some stuff that BtA was using. If you want a quick way to make stuff untargetable or lock keys for cutscenes, check that out. There's also some other misc BtA scripts that I just added a LuaSEXP passthrough basically.

I also made a new version of the turret hotkey script. It's pretty much a straight rewrite of the one that MadProf made in 2011. There are now better ways to call it and better hooks to make things reliable. But it's still very low key. tcrayford's Critical Subsystem Script (https://www.hard-light.net/forums/index.php?topic=95919.0) is much more flashy and neato so really, use that one. :cool:

The next big script I'm slowly working on is an update to the save-load script. I never used it because it seemed like a giant pain, and I preferred to be softer with checkpoints, not really wanting to doom the player to 4% hull left after a checkpoint if they are that unlucky. Then mjn showed me what his missions look like with it and I was like "there must be a better way".

The plan for the script is you call "lua-save-state" and it saves everything. You call "lua-load-state" and it loads the saved data to what it can that is present. Ships that aren't present will get their data preloaded where possible, so all the FREDder will need to do is make sure they arrive and everything is taken care of. There will be some flags and options if you just want to load only position, orientation and whatnot.
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Bryan See on February 23, 2020, 07:57:43 am
Axem, I've got a new problem. When I test most of your scripts with the latest MediaVPs (4.X), it seems that the createParticle index/field from mv_exp-sct.tbm is a non-existent and nil value.

Code: [Select]
Could not find index 'createParticle' in type 'Testing'

------------------------------------------------------------------
ADE Debug:
------------------------------------------------------------------
------------------------------------------------------------------


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

stack traceback:
[C]: ?
[string "mv_exp-sct.tbm - On Mission Start"]:849: in function 'do_small_explosion_effects'
[string "mv_exp-sct.tbm - On Mission Start"]:880: in function 'maybe_draw_explosion_effects'
[string "mv_exp-sct.tbm - On Mission Start"]:912: in function 'process_explosion_effects'
[string "mv_exp-sct.tbm - On Frame"]:946: in main chunk
------------------------------------------------------------------

1: Userdata [Testing]
2: String [createParticle]
------------------------------------------------------------------

Code: [Select]
LUA ERROR: [string "mv_exp-sct.tbm - On Mission Start"]:849: attempt to call field 'createParticle' (a nil value)

------------------------------------------------------------------
ADE Debug:
------------------------------------------------------------------
------------------------------------------------------------------


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

stack traceback:
[C]: in function 'createParticle'
[string "mv_exp-sct.tbm - On Mission Start"]:849: in function 'do_small_explosion_effects'
[string "mv_exp-sct.tbm - On Mission Start"]:880: in function 'maybe_draw_explosion_effects'
[string "mv_exp-sct.tbm - On Mission Start"]:912: in function 'process_explosion_effects'
[string "mv_exp-sct.tbm - On Frame"]:946: in main chunk
------------------------------------------------------------------

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

Did you test all of your scripts with the latest FSO build (i.e. FSO version 19.0.0 or a latest nightly build) and the latest MediaVPs?

EDIT: Have you make sure all scripts make full use of libRocket/HD UI? Base scripts included.
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Axem on February 23, 2020, 09:08:53 am
mv_exp-sct.tbm is not part of my script pack, it's just for the mediavps. None of my scripts in this github repo use ts.createParticle either.

You do have a valid issue though, just with the mediavps and the ts.createParticle scripting function. The ts.createParticle function is obsolete if your FSO target version is too high, you should be using the gr.createParticle function. So the fix is either to set the target version to something that works, or replace all instances of ts.createParticle with gr.createParticle in the affected scripting files.

I don't test with every update, but scripting API changes are pretty rare (this being one of those rare occasions) and usually I'll hear about changes early on to try and avoid this.

These scripts also don't such libRocket at all so there's no chance of them breaking that.
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Bryan See on February 23, 2020, 09:34:09 am
I think the problem lies with the game_settings.tbl $Target Version: parameter when specified +Major: 19. FSO got a versioning number scheme recently.
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Axem on February 23, 2020, 09:35:06 am
Yes, major version should be less than 19 or switch to the proper function.

Code: [Select]
particle createParticle(vector Position, vector Velocity, number Lifetime, number Radius, enumeration Type, [number Tracer length=-1, boolean Reverse=false, texture Texture=Nil, object Attached Object=Nil])
    Creates a particle. Use PARTICLE_* enumerations for type.Reverse reverse animation, if one is specifiedAttached object specifies object that Position will be (and always be) relative to.
    Deprecated starting with version 19.0.0: Not available in the testing library anymore. Use gr.createPersistentParticle instead.
    Returns: Handle to the created particle
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Bryan See on February 23, 2020, 09:37:56 am
Yes, major version should be less than 19 or switch to the proper function.

Code: [Select]
particle createParticle(vector Position, vector Velocity, number Lifetime, number Radius, enumeration Type, [number Tracer length=-1, boolean Reverse=false, texture Texture=Nil, object Attached Object=Nil])
    Creates a particle. Use PARTICLE_* enumerations for type.Reverse reverse animation, if one is specifiedAttached object specifies object that Position will be (and always be) relative to.
    Deprecated starting with version 19.0.0: Not available in the testing library anymore. Use gr.createPersistentParticle instead.
    Returns: Handle to the created particle

Thanks, Axem. But I got one problem with yours. The proBox.

Code: [Select]
LUA ERROR: [string "proBox-sct.tbm - On Game Init"]:166: attempt to index field 'PromptData' (a nil value)

------------------------------------------------------------------
ADE Debug:
------------------------------------------------------------------
------------------------------------------------------------------


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

stack traceback:
[C]: ?
[string "proBox-sct.tbm - On Game Init"]:166: in function 'ResetRef'
[string "proBox-sct.tbm - On Game Init"]:170: in function <[string "proBox-sct.tbm - On Game Init"]:170>
------------------------------------------------------------------

------------------------------------------------------------------
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Axem on February 23, 2020, 09:50:43 am
Okay, I've just committed a fix. Please see if that fixes your issue.
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Bryan See on February 23, 2020, 10:36:42 am
Okay, I've just committed a fix. Please see if that fixes your issue.
It works for me. Thanks, Axem! :)
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Axem on March 07, 2020, 07:37:29 pm
Hello! I am working on the new save/load script. It's working out pretty great so far.

New features include this one sexp to save everything and one sexp to load everything!
(https://i.imgur.com/YWPZra7.png)

That is 99.999% literally it. It figures out what to save, and then it can apply it to the ships in a new playthrough, even ones that have not arrived yet! The only other extra work is needing to cue the unarrived ships to arrive, but I help and make them set their arrival info to have no warp in so you just need to tie their arrival to the same event as when you are loading the save data. I'll get into other neat features later, but first...

I've got some important questions for the FREDders who will be using this: What are your expectations for things that the script will save?

So stuff that gets saved now is stuff like position, orientation, health and shields, weapons, ammo, and general status (was it present during the save, destroyed? departed? arrived?).

Do you need AI orders? Turret lock status? Afterburner/weapon energy amounts? Stealth/hidden from sensor status? Any other alter-status-flag stuff? Player throttle position? ETS settings?

And how well do you need it to work with wings with waves? Like, perfect perfect or "kinda close enough". Single wave wings work fine right now, but when you get to the second or third set of waves... it get's a bit complicated and possibly inaccurate (like Beta 4 that died on the second wave might show up alive, something like that).
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Bryan See on March 14, 2020, 12:04:28 pm
I've got some important questions for the FREDders who will be using this: What are your expectations for things that the script will save?

So stuff that gets saved now is stuff like position, orientation, health and shields, weapons, ammo, and general status (was it present during the save, destroyed? departed? arrived?).

Do you need AI orders? Turret lock status? Afterburner/weapon energy amounts? Stealth/hidden from sensor status? Any other alter-status-flag stuff? Player throttle position? ETS settings?

And how well do you need it to work with wings with waves?
To me, the expectations for things that the script will save is high.

All will be present.

I need AI orders, turret lock status, scanned status, afterburner/weapon energy amounts, stealth/hidden from sensor status and any other alter-status-flag stuff, as well as player/AI throttle position and ETS settings.

I need to work with wings with waves in a modular and flexible way.

When it's finished, you need to update that article (https://wiki.hard-light.net/index.php/Tutorial_-_Mission_Infrastructure) on the wiki to reflect this.
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Darius on March 22, 2020, 12:32:32 am
Hitting some LUA errors and trying to troubleshoot.

Code: [Select]
HitpointsLeft: Argument 2 is an invalid type 'nil'; number expected

------------------------------------------------------------------
ADE Debug:
------------------------------------------------------------------
------------------------------------------------------------------


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

stack traceback:
[C]: ?
[C]: ?
[string "saveload2-sct.tbm - On Game Init"]:301: in function 'ApplyData'
[string "saveload2-sct.tbm - On Game Init"]:247: in function 'LoadAll'
[string "saveload2-sct.tbm - On Game Init"]:575: in function <[string "saveload2-sct.tbm - On Game Init"]:575>
------------------------------------------------------------------

1: Userdata [subsystem]
2: NIL
------------------------------------------------------------------

Got some ships that are set to enter a couple seconds after loading the checkpoint that were there during the actual checkpoint save. Is this causing issues with the script not being able to find them?
Title: Re: Axem's Script & Lua SEXP Collection
Post by: Axem on April 05, 2020, 11:03:44 am
So I did put the new SaveLoad script up on the github for Beta Testing. I would not use it for production right now, there's missing features and a few bugs right now. Basically it's out there so you can get a sense of how it works and report any structural issues.

I have added a new version of AxMessage, my scripted message hud gauge. This is version 1.3, and the big change here is multi-resolution settings. Before you could turn it on or off with the MinVertRes setting in the config file. That is now gone. Now you can specify a variety of minimum resolutions with different graphical settings, and the script will select the best one to fit your current screen. Things like different fonts, different message box graphics, and it'll even let you scale the message box. It's not dynamic scaling, but it does let you use a single message box, and then you just need to figure out the right fonts and offsets.

So because of all of that, the config file is quite a bit rekajiggered, and is not backwards compatible. You'll need to move some stuff around, just look through the sample file and you'll get a sense what goes where.

And lastly, the Infinite Ship Spawning script from JAD is up there. It's all accessible with LuaSEXPs, so if you're looking to make some wild arcade nonsense, it's even easier to have tons of fighters. There's some new features, like customizable arrival effects, and a way to make groups arrive at once (sort of like wings).