[BONUS Plugin] Exchange Freight v1.1 04-8-05

The place to discuss scripting and game modifications for X²: The Threat.

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

User avatar
Burianek
Posts: 2928
Joined: Mon, 29. Dec 03, 04:29
x3tc

[BONUS Plugin] Exchange Freight v1.1 04-8-05

Post by Burianek » Fri, 5. Aug 05, 03:00

Hi all,

A new plugin for you to enjoy.
Available in the bonus plugins package.
Scripter: Vassenego

From the readme:
readme wrote: What's the script for?

As the name suggests, the script allows you to exchange freight between ships owned by the player. The player no longer needs to be in either of the ships or even in the same sector to transfer freight from one ship to another.

Attention: Executing this order on a ship cancels all other orders. So you have to issue new orders to your ship afterwards.




What does it do?

As stated, it transfers freight from one player owned ship to any other player owned ship within transporter range. Therefore both ships have to be in space and in the same sector. Naturally at least one of the ships has to be equipped with a transporter device. If you are transferring shields, they will be installed on the targeted ship automatically if they are better than the currently installed shields. Weapons will not be automatically installed. They just get transferred into the cargo hold of the target ship and have to be installed manually via the ships menu, if desired.




What can't it do?

Because of limitations of the script editor, you cannot choose a docked ship as a target, so both ships have to be in space to make the transport work. If a ship is docked, the command is not available. It is not possible to transfer ship upgrades or extensions (like the transporter device itself, freight scanner, or anything else like this). If the player ship is one of the two ships involved in the exchange, then it is possible to transfer command extensions using this command.
The script editor doesn't know if the command was executed successfully, so you always get the "Command Accepted" message when the command is run, but this doesn't necessarily mean that the freight really got transferred. If the transport failed for any reason, you will get an error message written to the player log (see Error messages). If the script successfully transferred the freight, no message is written (there's already enough spam within the log book). Another limitation of the script is that it can't check if there is a third ship equipped with a transporter device in range, so at least one of the ships taking part in the transfer has to be equipped with a transporter device. Otherwise, the transport will fail and an error message will show up in your log.



What won't it do?

There are some fictional and logical limitations to the script.
As stated already, to transport the freight there has to be a transporter device installed in one of the ships involved.
The transfer will only be successful within the normal transporter range of the transporter device. The range is five km, and both ships must be within the same sector. If the ships are flying around when you try to transport cargo, it might occur that they leave transporter range, so it's best to stop them before you command them to exchange their cargo.
Only player owned ships can be targeted for transport.
Negative amounts of freight are not allowed. If you want to transfer a ware back, you must execute the command from the other ship.
You cannot transfer freight to the same ship.
To keep it simple (I'm not a good scripter, this is just the result of playing around to get familiar with the script editor ;-) ) the script will only transfer the exact amount of goods given during the command routine. If this is not possible for any reason (cargo limitations or not enough wares), no freight will be transferred and an error message will be created. This is true even if the transport of a smaller amount of wares would have been possible.
The script will not transfer any freight which is currently installed on the source ship (e.g shields and lasers). So you'll have to uninstall them first if you want to transport them. ATTENTION: Missiles are handled differently, they will always get transfered even if they are the currently selected missile. Keep this in mind, or else the source ship may suddenly have no more missiles installed.
Finally, even if it would be possible, the script will not tranfer wares to "non-ships" like Squash Mines, Navigation Relay Satellites, Advanced Satellites, Lasertowers, and Fighterdrones. (ATTENTION: In modifed universes, targets might exist which are not specifically excluded by the script routine and so freight might get transfered without the chance to transport it back. This could cause the loss of the freight. The script should be adjusted for these mods or used with caution.)



Error Messages

As said, every failed attempt to transfer freight creates an error message in the player log. Here is an overview of the possible messages and their meaning (though I hope they are self explanatory in most cases)

- "ships are the same." - The source ship is identical to the targeted ship.
- "ships are in different sectors." - The source ship is not in the same sector as the targeted ship. This might be caused by movement of both ships (docking somewhere or jumping away) or you might have accidentally switched to another sector in the galaxy map.
- "ships are not in transporter range of each other." - The ships are within the same sector, but the distance between them is bigger than 5km.
- "transporter device needed." - At least one of the ships must have a transporter device installed.
- "not enough freight to transfer." - The specified amount of goods is higher than the amount of this ware in the cargo hold. This may mean that you are trying to transfer installed equipment (e.g. shields or lasers). - See: 4. What won't it do?
- "not enough free cargo space." - The target ship has insufficient room in its cargo hold. This might mean that you are trying to transfer too much freight or it might mean that the target ship is not capable of carrying the freight's transport class.
- "negative amount." - The amount of freight you are trying to transfer is 0 or below, which is pretty senseless ;-) To transport freight from the target ship to the source ship, just execute the command from the other ship.
- "target is not a ship." - The target is not a real ship (like Navigation Satellites, Lasertowers, Squash Mines or Fighterdrones). ATTENTION: Modified universes may define other objects as player owned, which might not be recognized as invalid targets by the script. The command might then be executed and the freight may get lost.



How to use it

After installing the script, you will see on every player owned ship a new command "Transfer freight ..." in the "Special..." command category.
After selecting the command, choose the ware you want to transfer from the cargo hold of the executing ship. Then enter the amount of goods you want to transfer (only positive integers will work). Next, the galaxy map opens and you select the target ship to transfer the wares to. Hit enter to confirm your inputs or "Esc" to cancel the command. After you choose the target ship and confirm your selection by hitting enter you're brought back to the ship command menu. The freight Should be transferred. If not, an error message should be shown in your player log (see 5. Error Messages)



How to use it (fast)

Step -> What to do

1 -> Select command
2 -> Choose freight
3 -> Enter amount
4 -> Select target ship
5 -> done
"Nature's first green is gold" . . . stay golden.

VincentTH
Posts: 6192
Joined: Wed, 6. Nov 02, 21:31
x4

Post by VincentTH » Tue, 9. Aug 05, 20:09

The problem with using this feature is that there is NO WAY to know when the 2 ships are within 5km of each other (unless you fly one of the ships yourself, which kinda defeat the purpose of having the script itself).

It would be much better that the 1 of the 2 ships for which the command was issued to, start with a "follow" order. For now, it must be done by hand first, before the exchange command can be issued.

My 2 cents.

The Great Stonk
Posts: 494
Joined: Tue, 23. Mar 04, 17:30
x3tc

Post by The Great Stonk » Tue, 9. Aug 05, 21:12

you can always order 1 ship to move to the position of the other...

Carl Sumner
Posts: 5112
Joined: Mon, 23. Feb 04, 02:28
x4

Post by Carl Sumner » Tue, 9. Aug 05, 22:31

This is very good for ships that are flyable. However, I use a few "Storage Hulks" parked at various stations. Flying them out of the station is not a safe thing to do (no shields, minimal hull).

I suspect that the script language does not allow access to ships in stations, though. :wink:
Tinker

"If engineers built buildings the way programmers write programs, the first woodpecker that came along would destroy civilization!"

User avatar
Burianek
Posts: 2928
Joined: Mon, 29. Dec 03, 04:29
x3tc

Post by Burianek » Wed, 10. Aug 05, 00:21

VincentTH wrote: It would be much better that the 1 of the 2 ships for which the command was issued to, start with a "follow" order. For now, it must be done by hand first, before the exchange command can be issued.
My 2 cents.
You can issue the follow order yourself first right? And then effect the transfer?
Carl Sumner wrote:I suspect that the script language does not allow access to ships in stations, though.
Not in a user friendly manner, no.
"Nature's first green is gold" . . . stay golden.

VincentTH
Posts: 6192
Joined: Wed, 6. Nov 02, 21:31
x4

Post by VincentTH » Wed, 10. Aug 05, 08:11

The problem with follow order is that if the target does not move, the ships that takes the order to follow would not move either.
And there are no guarantee that after the move (or move to position order) that they are within 5km of each other.

User avatar
moggy2
Posts: 4588
Joined: Wed, 6. Nov 02, 21:31
x3ap

Post by moggy2 » Wed, 10. Aug 05, 18:11

just out of curiosity, is there anyone who can tell me how this new script compares to Xai Corporation's Remote Transporter Device Software?

I haven't had a chance to play X2 since the new bonus pack was released.

VincentTH
Posts: 6192
Joined: Wed, 6. Nov 02, 21:31
x4

Post by VincentTH » Wed, 10. Aug 05, 23:42

moggy2,

I tried it but give up, as it simply does not work for me. I have mentioned the reason for it above.

User avatar
Burianek
Posts: 2928
Joined: Mon, 29. Dec 03, 04:29
x3tc

Post by Burianek » Thu, 11. Aug 05, 02:23

VincentTH wrote:moggy2,

I tried it but give up, as it simply does not work for me. I have mentioned the reason for it above.
Do you think widening the range out a bit would solve the problem?

You would agree that there should be some allowable physical range to be able to beam goods right? You don't think they should be allowed to be beamed across the universe?

Cheers.
"Nature's first green is gold" . . . stay golden.

VincentTH
Posts: 6192
Joined: Wed, 6. Nov 02, 21:31
x4

Post by VincentTH » Thu, 11. Aug 05, 03:16

No, I don't think widening the range solve the problem, I would much prefer the 5km range.

The problem is that the user has no way to know how far the ships are from each other. The game only shows the distance between the ship you are flying and a target ship. The only way - other than flying one of the ship - I know of is to place one ship in the monitor (Shift-F1), activate the monitor/remote control (F3), then target the second ship remotely, to know for sure that the 2nd ship is in range. That procedure is, however, complicated, and requires a lot of key strokes.

The best way to solve this problem is for the script to issue some command(s) to make the ships move within 5km of each other prior to doing the freight exchange. The command "Ship A follows ship B" would not cut it, because if B is stationary, A would not move. Only a script (or the player fliying ship A) knows how to place ship A within 5km of ship B.

User avatar
moggy2
Posts: 4588
Joined: Wed, 6. Nov 02, 21:31
x3ap

Post by moggy2 » Thu, 11. Aug 05, 03:28

you can tell the distance by looking at the sector map. By default 1 square is 8km across, by zooming in(home key iirc) one square becomes 4km across and if the ships are within one square then you can transport.

The biggest problem I can see here is that the signed script cancels the ship's currect command whether you're in range or not. If you're not in range, you then have to start the ship up moving again before you can attempt another transportation. The Xai Corp script doesn't have that problem since it's on a auxiliary ship command slot instead of a special autopilot command.

User avatar
Burianek
Posts: 2928
Joined: Mon, 29. Dec 03, 04:29
x3tc

Post by Burianek » Fri, 12. Aug 05, 01:03

This is certainly valuable feedback.

I'm against having the script move either of the ships. Issuing a move to position command on ship A and then highlighting ship B that you want to move to, should place them within 5 km shouldn't it?

I agree with moggy's suggestion. I'd think it'd be a good idea to run this script in one of the additional ship commands so that you can issue it while the ship is approaching and it won't cancel the move order.

If I catch Vassenego in the chat I'll talk to him about it.

Cheers.
"Nature's first green is gold" . . . stay golden.

User avatar
moggy2
Posts: 4588
Joined: Wed, 6. Nov 02, 21:31
x3ap

Post by moggy2 » Fri, 12. Aug 05, 03:23

If I may make another suggestion about the interface.

The command is almost instantaneous, I see no problem with displaying any messages generated imediately using the command

Code: Select all

send incoming message $msg to player: display it=[TRUE]
Infact it actually improves the users experience by not forcing them to quit the command window to open the pilots log to find out what actually went wrong.

Does the error message mention the range between the two ships when they're out of range? It would probably help if it did, if it doesn't already.

User avatar
Burianek
Posts: 2928
Joined: Mon, 29. Dec 03, 04:29
x3tc

Post by Burianek » Fri, 12. Aug 05, 05:43

Another good point.
Keep the feedback coming. :)
Cheers.
"Nature's first green is gold" . . . stay golden.

jlehtone
Posts: 17758
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone » Fri, 12. Aug 05, 10:21

VincentTH wrote:The command "Ship A follows ship B" would not cut it, because if B is stationary, A would not move. Only a script (or the player fliying ship A) knows how to place ship A within 5km of ship B.
I have not experimented with the different formation options for wingmen, so I do not know what they do or how they have been implemented, but from their mere existence I make the assumption that there either is or should be functionality to bring ships into (closed) formation. So is it feasible and worth it to have navigational command: "Move Ship A into formation X with Ship B"? That should probably call "Ship A follows ship B" on completion.

Post Reply

Return to “X²: The Threat - Scripts and Modding”