[SCRIPT] Weapons Changer v2.50 [Updated 15/07/07]

The place to discuss scripting and game modifications for X³: Reunion.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Mon, 30. Apr 07, 18:17

The feature list looks pretty damn good now. Have yet to try it, though. =)
Bunny wrote:75ms - Playership
3s - In sector ship
12s - Out of sector ship
Just an idea here...

Your data is saved in local variables so you could restart the target ship's WC mainscript after changing the mode.
This would not be a performance issue because this would be on direct player order only.

Especially useful for OOS ships, this would eliminate the 12s wait before the data is actually entered into the variables.
Well, and it's another way to avoid User Error reports. =)
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

Bunny
Posts: 2014
Joined: Mon, 1. Dec 03, 19:44
x3ap

Post by Bunny » Mon, 30. Apr 07, 18:23

I knew I missed something :wink:
On the list for the next upgrade,

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Mon, 30. Apr 07, 18:59

WC's interface is pretty smooth now but programming the weapon setups for every single ship is still... work.

I wrote a hack for personal use that
-installs weapons,
-programms this loadout by calling the WC script with proper argument,
-uninstalls weapons.
-repeat for every configuration I want for this ship class.

This way all the programming is done for me since all my ships have the same weapons anyway.

The Broadcast feature sets the mode for all ships in sector, right?

Some kind of "Copy THIS loadout" would eliminate the tediousness but there is no ideal way of doing it.
Ideally, the ship would copy the complete setup from a ship of identical type.
This is not easy, though, because there is no way for a ship to fetch it's own ship type. Can only query the object class which is way too general.

1.)
The only "proper" way (that I can see) is to build an array with every shiptype and make it available as global.
Then a ship can test against every existing shiptype and has then a chance to test other ships in sector against this shiptype.
If WC is running on a matching ship, the complete setup is loaded from that ship.

Sounds nifty to me because I could buy 10 new ships and only need one ship with an existing setup.
the others can "learn" from it and fall in. =)

The only issue would be that all shiptypes need to be entered into the setup and this would hurt compatibility with mods that have more ships.

2.)
The compatible but far less accurate way would be to query all ships of matching Object Class in the same environment.
Kind of a "broadcast Setup" feature.
That would be far simpler to write because all player ships in sector can be queried as an array and so can environment + WC Running.
Actually copying the setups would be easy enough.
Clone array, write local var to target... finished.

10 new ships (say, of object class M3) in a sector could completely be configured with one command this way. (and WC started for them =)
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

Bunny
Posts: 2014
Joined: Mon, 1. Dec 03, 19:44
x3ap

Post by Bunny » Tue, 1. May 07, 14:07

Yeap, Broadcast Config is just for in sector.

Have you tried using the get ware type command to get the ship type?. I think that worked. I'll dig out the code and look into the idea.

Are you programming large numbers of fighters?.

Cheers for the feedback

Bunny

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Tue, 1. May 07, 14:23

Bunny wrote:Are you programming large numbers of fighters?.
Not yet and as I said, I got a quick and dirty hack to do the job.
Programming the setup for every single M3 is tedious and I don't like tasks like that. =)

For now I have a small fleet with Elephant and a couple captured LX and so far I don't see the point in getting more or heavier ships.
For clearing a Xenon sector I can use an LX or Hyperion and that's about the biggest fight you could find in X3.

When my income has grown so far that I can't spend the Cr any more it's time to retire and restart again since there is no game any more. =P
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

Teladidrone
Posts: 644
Joined: Tue, 24. Aug 04, 11:41
x3tc

Post by Teladidrone » Wed, 2. May 07, 05:49

I found a small problem... maybe.

For OOS I loaded 8 BHEPT in front, and 4 AHEPT in the turrets of an
osprey.
The ship carries 4 more AHEPT and 4 BPAC.

In sector I want the script to swap in 8 AHEPT in front and 4 BPAC in turrets.
That does not always work; it replaces only 4 of the front BHEPT with AHEPT and leaves the other 4 BHEPT in place.

Maybe the script is confused if it can not take all the weapons straight from the cargo bay and needs to unmount them first and then remount on other positions?

Bunny
Posts: 2014
Joined: Mon, 1. Dec 03, 19:44
x3ap

Post by Bunny » Wed, 2. May 07, 09:39

Okay, I'll try and replicate the problem to see what is going on.

Bunny
Posts: 2014
Joined: Mon, 1. Dec 03, 19:44
x3ap

Post by Bunny » Thu, 3. May 07, 09:55

@Teladidrone
Yeap, it was a bug. Version 2.01 fixes it.

Cheers

Bunny

Squelch
Posts: 252
Joined: Sat, 15. May 04, 11:03
x2

Post by Squelch » Thu, 3. May 07, 14:51

Will 2.01 require a restart of the script or will it simply patch it?

Also, any chance you could release the spk seperately so package installer automaticaly finds new versions.

Thanks

Bunny
Posts: 2014
Joined: Mon, 1. Dec 03, 19:44
x3ap

Post by Bunny » Thu, 3. May 07, 14:54

Just patch it, the script will automatically restart (and remember the settings). The spk is already included in the zip file.

Cheers

Bunny

Squelch
Posts: 252
Joined: Sat, 15. May 04, 11:03
x2

Post by Squelch » Thu, 3. May 07, 15:00

Bunny wrote:Just patch it, the script will automatically restart (and remember the settings). The spk is already included in the zip file.

Cheers

Bunny
Cool that's good to hear.

I know the spk is in the zip but it can't be checked for updates by package installer. It needs to be a seperate file. I missed this point release because I didn't get notified of a reply to this topic. That may be down to the board having a few glitches, but a one click check for updates in package installer would avoid this.

Don't worry if it's not possible.

Teladidrone
Posts: 644
Joined: Tue, 24. Aug 04, 11:41
x3tc

Post by Teladidrone » Thu, 3. May 07, 23:38

Ehm, sorry, but now you broke it completely.

I updated the spk, loaded game, saved, loaded game again.

When trying to set a weapon configuration now (eg. input 4) the script no longer confirms the new configuration in logfile - all I get is "weapon changer started", the ship name has "Weap D" added and it unmounts all weapons.

Same happens if I try to used input 1,2,5,6,8.... every command adds another "Weap D" to the ship name and just unloads all mounted weapons :(

Teladidrone
Posts: 644
Joined: Tue, 24. Aug 04, 11:41
x3tc

Post by Teladidrone » Fri, 4. May 07, 01:51

What steps are necessary to remove this script completely and do a clean reinstall?

I stopped the weapon changer on all ships and I removed the spk with the script installer.

But the hotkey configurations in the interface tab are still there and if I leave my ship it adds "Weap A" to its name so I guess the script must still be running on my personal ship?

Squelch
Posts: 252
Joined: Sat, 15. May 04, 11:03
x2

Post by Squelch » Fri, 4. May 07, 03:48

I have just run some tests on this and the only thing that I see wrong is the ship name still shows the config after transporting into it. Everything else looks fine.

Which mode did you use to stop weapon changer, 0 or 10? 10 deletes all configs too.

Try these steps to completely remove and make a fresh install.
  1. Run a search on your scripts folder with the word bunny to confirm that the files are removed. There should be only one "lib.bunny.getfreetaskslot.xml"
  2. Delete them all if any other remain (probably not required but just to make sure the installer isn't confused)
  3. Reinstall the spk.
  4. Use mode 10 on all the ships you had it running on.
  5. Uninstall the spk.
  6. Copy the script "hww.bunny.removekey.xml" from the scripts folder in the zip to your scripts folder.
  7. Restart your game and use script editor to run the removekey script. (this will remove the left over hotkeys)
This should leave only the removekey and getfreetaskslot scripts (both harmless) in your scripts folder and everything should be back to normal.

You can now reinstall Weapon Changer.

Bunny - including something like a setup.uninstall.bunny.xml to switch off WC and remove hotkeys would avoid 4,6 & 7

Teladidrone
Posts: 644
Joined: Tue, 24. Aug 04, 11:41
x3tc

Post by Teladidrone » Fri, 4. May 07, 05:03

Thx very much!
I followed your steps and everything is working now again.

Squelch
Posts: 252
Joined: Sat, 15. May 04, 11:03
x2

Post by Squelch » Fri, 4. May 07, 12:53

Teladidrone wrote:Thx very much!
I followed your steps and everything is working now again.
I'm glad I could help :thumb_up:

Some of the steps probably were not necessary, but I wanted to make sure it was completely done.

The ship name not changing could possibly be due to setting mode 11 (test mode) during my tests.

This script is most excellent. I like the framework used to set the different configurations, and how it can switch automatically depending in circumstances. I see other possibilities for using this framework other than weapons. Switching between different attack stances for instance.

There is only one thing missing. If possible would be to register the weoapn slots ensbled for each config and set then too. It's still possible to set a ship free after piloting it with only one weapon firing even though it has all the slots loaded.

Bunny
Posts: 2014
Joined: Mon, 1. Dec 03, 19:44
x3ap

Post by Bunny » Fri, 4. May 07, 15:28

@Squelch
Cheers for troubleshooting support.

I'm not able to use the SPK update function because the filepath on the website changes. The file has the update version number in the name. I'm not complaining, since I'm more than happy with Moggy being kind enough to host scripts on his website.

I'll look into the ship name problem to see if it misses changes.

The structure of this script is bit unusual because it runs like a state engine controlled by a single local variable. So other scripts can communicate with it and use it. Actually, thinking about it is sort of reminds me of working with...activeX controls... OMG...I've created an abomination :).

I don't think it is possible to control weapon enabled status from a script. The weapon grouping interface seems to be hardcoded.

Squelch
Posts: 252
Joined: Sat, 15. May 04, 11:03
x2

Post by Squelch » Fri, 4. May 07, 21:16

Bunny wrote:@Squelch
Cheers for troubleshooting support.

I'm not able to use the SPK update function because the filepath on the website changes. The file has the update version number in the name. I'm not complaining, since I'm more than happy with Moggy being kind enough to host scripts on his website.
No worries it was merely a suggestion. moggy has my props for his community support.
I'll look into the ship name problem to see if it misses changes.
I have only noticed it the once, and that was after setting mode 11. If it occurs again I'll flag it, and if possible try to pinpoint the problem. I've leared alot from following your work so it's only fair to return it.
The structure of this script is bit unusual because it runs like a state engine controlled by a single local variable. So other scripts can communicate with it and use it. Actually, thinking about it is sort of reminds me of working with...activeX controls... OMG...I've created an abomination :).
There is nothing wrong with FSM as long as it's implemented well. The beast lives and it can come to tea at my house :D
I don't think it is possible to control weapon enabled status from a script. The weapon grouping interface seems to be hardcoded.
I've been puzzling over this and trying to find a way around it. As I learn new thinds I like to try then out and then share.

Teladidrone
Posts: 644
Joined: Tue, 24. Aug 04, 11:41
x3tc

Post by Teladidrone » Sun, 13. May 07, 17:11

I broke it again. :(

No new scripts installed or anything, just playing around a lot with different weapon configurations, starting, stopping, erasing, etc,...

And I managed to get the script into a state where it will NOT respond correctly to any command anymore.

No matter what command I tried, in log file I just get "weapon changer started" and another - Weap D is added to to ship name and no weapons stay mounted.
And any following command just does the same, I now have a ship named "Enterprise - Weap D - Weap D - Weap - D Weap - D Weap - D" :lol:
The script wont even stop anymore and the only way to fix it is to reload from an earlier savegame or destroy the ship.

I then tried to reproduce that from the working save again but could not trigger this behavior another time though.
No clue what might be wrong, but some little bug may still be in there somewhere...

Edit:
I ship I was working on was out of sector if thats important...

Squelch
Posts: 252
Joined: Sat, 15. May 04, 11:03
x2

Post by Squelch » Sun, 13. May 07, 17:28

Have you enabled mode 11 at all Teladidrone?

Weap D is the OOS config and should only appear when you are not there. Is this happening on your own ship, or one of your fleet? This sounds a little familiar to the random problems I had in the previous version, but much of it is now done differently.

Post Reply

Return to “X³: Reunion - Scripts and Modding”