[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

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

Post by Bunny » Sun, 22. Apr 07, 13:37

I wonder if the problem is a script conflict?.

The next version will search and run in a free slot rather than be tied to 323.

It is good to get some scripting time at last (Now getting my head around the suggestions by Gazz).

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

Post by Squelch » Sun, 22. Apr 07, 15:56

I think I've found the reason for it getting stuck.

I have been working on a script of my own, and was using the debugger to track it's progress. It's fine when debugging another ship, but when used on playership, with weapon sets, it borks Weapon Changer. Turning off debugger afterward still leaves it in a zombie state, so a reload of a save prior to debugging is needed. This seems to be the case whether or not I have my script loaded, so it appears it's not a conflict.

You may have created the first anti-debug script :)

My apologies if it's caused you too much distraction.

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

Post by Bunny » Sun, 22. Apr 07, 18:36

Hmm, tech support might be interested to hear this.

Thanks for reporting this :thumb_up: .

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

Post by Squelch » Tue, 24. Apr 07, 13:50

Bunny wrote:Hmm, tech support might be interested to hear this.

Thanks for reporting this :thumb_up: .
Can anyone else confirm my observation?

I am now confident that running debug on Player Ship while Weapon Changer is active will cause Weapon Changer to cease responding to input after a while. It still has a random element (effects do not appear imediately) and could still be specific to my setup.

I will be making a fresh install of 2.0.0.2 in the near future, so will install Weapon Changer only, and enable SE to test my theory and to rule out any conflicts with other community made scripts.

It is worth pointing out that this should not affect anyone who does not have SE activated, and is not running debug.

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

Post by Bunny » Thu, 26. Apr 07, 10:56

Here is the current status of the script upgrade:

1. Weapons configurations are now contained in local variable arrays. This means they are remembered if the script is restarted.

2. Fourth OOS weapons configuration array (D) added. This is automatically selected when the ship is OOS.

3. All three weapon configurations can be programmed, selected and reprogrammed all by using a single hotkey.

4. Three more hotkeys added to allow quick configuration selection.

5. Option to terminate script and erase local weapons configuration variable arrays added.

6. All ships will automatically swap between weapon configurations A and D as they move between OOS and IS.


A few things are still to be added and the testing is in progress.
So almost done.

@Squelch - If time allows I will try the script with the SE debug option activated. Usually, I never use this feature but debug by sending the output to logs instead.

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

Post by Squelch » Thu, 26. Apr 07, 12:27

That looks like a pretty fine upgrade list. I look forward to testing it. Would it be possible to have a config that is reverted to upon leaving ship in a similar way to OOS/IS (config A for instance). It's probably a bit late to request but worth a shot.
@Squelch - If time allows I will try the script with the SE debug option activated. Usually, I never use this feature but debug by sending the output to logs instead.

I would normally but I was trying to capture stock script events and wanted to avoid editing signed scripts to output debug info and therefore potentialy introduce new errors. It seems the hangup only occurs under unusual circumstances. The workaround is to either ignore WC refusing input, or use it on a ship where WC is not running. It isn't relevent to the script I'm developing.

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

Post by Teladidrone » Thu, 26. Apr 07, 17:43

Woot!
Gimme, gimme, gimme... the hotkeys! *g*

Oh and just a little thing - I really like detailed sound/voice feedback from scripts...
Let the computer voice say "Weapon systems Alpha/Beta/Gamma/Delta ready" when changing the loadout IS using a hotkey ;)

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

Post by Bunny » Fri, 27. Apr 07, 09:40

Is such long audio confirmation in a dogfight a good idea?.
At the moment it just says the letter of the selected weapons loadout.

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

Post by Teladidrone » Fri, 27. Apr 07, 15:00

Yeah I know... but only "A" is a little... well... short.
At least let it say "A ready" ;)

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

Post by Gazz » Fri, 27. Apr 07, 17:52

Some (like me) certainly prefer the shortest possible speech so the current "A" suits me just fine. =)

I don't know what your plan is but if the old "enter the number" way still exists, it's no big deal to add a toggle for verbose speech with a number input of 40 or whatever.

The verbose style could also play sample 969 (or something similiar mechanical sounding) and say the weapon config letter afterwards.
(samples do not halt the script like speech does - a wait is required)
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 » Sun, 29. Apr 07, 13:40

Progress update:

-Ship name now indicates the selected weapons configuration (Not for player ship) - added & tested

- Ship remembers the selected weapons configuration when the player enters the ship. These weapons are restored when the player leaves the ship again - added & tested

- Audio sample 969 plays when player hotkey swaps the weapons - added & tested

Okay, I just need to move the player log messages to the t page and double check with the testing.

So expect version 2.0 to be posted in the next couple of days.

Cheers

Bunny

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

Post by Squelch » Sun, 29. Apr 07, 13:55

Excellent news!

I'm looking forward to this.

I was just thinking of a modification to mobile mining to use weapon changer. In fact any other job type script. That is, in the case of a miner, arm defensive weapons while traveling between locations, and then arming with mobile mining platform when clearing asteriods. The triggers for this being fired from the job script that checks for the existance of WC on that ship. Possible?

With the new memory of player/ai configurations, there are many possiblities that will enhance the experience.

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

Post by Bunny » Mon, 30. Apr 07, 17:01

After 3 months of life getting in the way....Weapons Changer Version 2.00 has arrived.

@Squelch
:S I'd really like to keep weapons changer and the mobile miner separate. Both are rather complex beasts to modify.

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

Post by Squelch » Mon, 30. Apr 07, 17:52

Wow that was quick!

I look forward to testing this tonight.

The mobile miner modification was me thinking out loud. I appreciate how complex the scripts are, and anything that might break them should be avoided. If I may, I'd like to call WC with parameters from my scripts as I don't want to have to replicate your excellent work. Do have any objections?

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

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

No problem, all your script would need to do to control the weapons changer is call hww.bunny.setstate with the required mode number.

Now let's see if I got all of the bugs out of this thing :)

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.

Post Reply

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