[Script] Universal Ware Transfer v2.00 31-Jul-08

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

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

eladan
Posts: 7168
Joined: Sat, 7. Jan 06, 16:01
x4

[Script] Universal Ware Transfer v2.00 31-Jul-08

Post by eladan » Thu, 31. Jul 08, 10:53

Universal Ware Transfer

Version 2.00 - Download here - courtesy of Xai Corp

You will need to update X3:R to version 2.5 in order to use this script, as it requires Mission Director functionality.

This script will allow you to transfer wares by means of a GUI-like interface between any two player owned ships docked at the same location. (I'm muscling in on B-O'Fs territory a bit here... sorry mate!) It works with all wares on the ship including equipped items and software/upgrades (except inbuilt software such as Trade Software Mk1 on TSs.) A plug for B-O'Fs script by way of compensation - his script is still more versatile than this one.

This is a (fairly radical) metamorphosis of the Software and Upgrade Transfer script, which is now so different I decided it needed both a new name and its own thread. (I will keep that version available, although I likely won't develop it further.) For this release, I've tried to make the interface as informative and easy to use as possible. In some ways, I like it more than the standard transfer interface! I'd be interested to hear anyones opinion on how to improve it.

Big thanks to SymTec Ltd and B-O'F, for their libraries (STLs Incoming Question Handler, and B-O'Fs Numeric Entry library,) both of which are used by this script.


Piccy of the interface used:



[ external image ]

From the readme:
Readme wrote:Universal Ware Transfer v2.00 by eladan
---------------------------------------------

This package will allow you to transfer wares between any two ships docked at the same location by means of a GUI-like interface.

Upon installation of this script, the command "Universal Transfer Wares" will be made available in the General menu of the command console. Upon running this command on any ship you own, if conditions are met for a transfer to take place (the ship is docked, and there is a ship to transfer to,) you will receive an incoming message. The incoming message, when opened, will show a numbered list of the ships which are docked in the same location. Selecting the number next to the ship you would like to transfer to will open another screen where a combined list of all wares (equipment, normal wares, software and upgrades) on both ships is displayed down the center of the screen, one ware per line. The amount of each ware belonging to the ship the command was run on is listed to the left side of the corresponding ware, and the amount of each ware belonging to the ship selected for transfer is listed to the right of the coresponding ware.

To the top left, three lines display the name of the ship the command was run on, its ID for further identification, and the maximum cargo class it can carry, as well as the current free cargo space. The top right has three lines similarly displaying the same information for the second, selected ship. The middle top displays the currently selected mode of transfer, with the transfer mode being a selectable button. Clicking on the button will cycle the mode through five available modes - transfer in units of 1 (default,) units of 10, units of 100, units of 1000, or numeric entry.

Each line of wares will allow you to (virtually - see below) transfer amounts back and forth between the two ships by means of two 'add' buttons. As long as conditions allow the transfer to take place, the button will be selectable. The button to the left of the ware will transfer wares in amounts determined by the current mode to the left side ship (and subtract a similar amount from the right side ship.) The reverse is true for the button to the right of the ware. If a transfer is selected which would transfer more than is available on the ship being transferred from, or if the receiving ship doesn't have enough cargo space to accept all items being transferred, the amount which could legally be transferred will be moved instead. Wares where the entire line is coloured red indicates that one of the ships has a maximum cargo class too small to be able to transfer any of that ware. If the 'numeric entry' mode is selected, clicking on one of the 'add' buttons will bring up a calculator-like keypad which will allow you to enter the amount you would like to transfer.

The colours of the numbers of wares on each ship indicate whether the amount was the original amount which was present prior to transfer (the number is grey,) there is more now than prior to transfer (number is green,) or less than prior to transfer (number is red.) Installed equipment for each ship is indicated by (eq) next to the appropriate ware for that ship.

If there are too many wares to fit on one screen, buttons to the bottom left and right labelled 'Next Page' and 'Previous Page' will allow you to navigate through all the wares available.

All transfers are virtual transfers only, until the 'end transfer' button is selected. Transfers are remembered when you change page using next and previous buttons. To get back to the state that existed prior to any changes, selecting the 'clear' button will reset all amounts to what they were originally. Selecting 'clear' then 'transfer selected' is equivalent to canceling the transfer.

If the 'add' button next to a ware is unselectable, one of the following conditions is true.

- The transferring ship doesn't have any of that ware on board
- The receiving ship doesn't have the cargo space to accept even 1 unit of that ware
- The ware being transferred is an upgrade or software, and the ship already has that upgrade/software.


This script uses SymTec Ltds excellent Incoming Question Handler library, as well as B-O'Fs Numeric entry lib, which also relies on the same library.

Q: It doesn't work! What do I do?
A: If you are trying to do a transfer, and all conditions are met, but it still doesn't work, you may need to reset the mission director. You do this by hitting the <Enter> key on the number pad when not docked, then clicking on the "reset mission director" button near the bottom. You may then need to save and reload.

Resources used: textfile and page id 8250, General Command 24

Changelog
---------

v2.00 - Radical overhaul, rereleased as Universal Ware Transfer

v1.00 - Initial release as Software and Upgrade Transfer
Last edited by eladan on Fri, 1. Aug 08, 14:26, edited 1 time in total.

B-O'F
Posts: 724
Joined: Sat, 21. Feb 04, 02:15
x3tc

Post by B-O'F » Thu, 31. Jul 08, 11:19

Hi eladan

At last some real competition - the first since my first transfer script years ago for X2.

The piccy looks good and SymTec's Incoming Question handler stops the logbook bloat that my script suffered from.

Best of luck with this script - it is something that is needed and I think should have been in the original code by ES.
I might finish off the updated version of my script when RL issues have been sorted out.... until then...

Have fun,

Boron - Ol Fh'art
Public Service announcement

Growing old is not a disease - it is a delayed symptom of birth trauma.

eladan
Posts: 7168
Joined: Sat, 7. Jan 06, 16:01
x4

Post by eladan » Thu, 31. Jul 08, 11:33

Cheers B-O'F - the code's nowhere near as pretty as yours, but it seems to be solid at the moment.

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Thu, 31. Jul 08, 23:35

Woot! How did you manage to get the text to format like that, all my attempts at using multiple justification (i.e. centre/justify) and multiple columns results in just one of them showing?

*Doh*... I see... you used [left] and right :S. Don't suppose you could impart your knowledge onto the colour and formatting sticky? :) (Are there any other things you can do with text's?)
http://forum.egosoft.com/viewtopic.php?t=129042

eladan
Posts: 7168
Joined: Sat, 7. Jan 06, 16:01
x4

Post by eladan » Fri, 1. Aug 08, 03:39

Well, I'm not using anything which isn't at least mentioned in that thread, though it doesn't really go into the implementation much, does it... I'll see about writing a quick tute for it (I'm no expert though - I was doing stuff for the first time with this script myself.) As for tags, I've found a few more which seem to be missing from there, but haven't investigated their use.

A quick explanation of what I did and how with the above pic as reference: The page has three columns (tag:text cols='3') - First col has the first ship details, (centered name, id, cargo info, then right justified ware amounts with the 'add' select button) followed by 'previous' select button at the bottom if required. Second col has the 3 centered lines for mode at the top, then left justified wares with right justified size and cargo type. At the bottom is the clear and end transfer buttons. Third col is mirror of first col, with the ware amounts and 'add' buttons left justified, and 'next' at the bottom if required.

I haven't used any nesting of tags other than everything is within the 'text' tags. I can imagine that nesting a 'justify' tag in a 'center' tag wouldn't work, as justify is supposed to spread the text the width of the line anyway, and would make center tags not make much sense... Not sure what difficulty you're having with multi columns? Multiple columns work by spreading the number of lines of text to display evenly between them. If, say, you have nine lines of text to display, and three columns, the nine lines will be evenly distributed as three lines per column, with the first column getting the first three lines, the second column getting the next three, etc.

You can't have a screen display text in a single column then switch to multiple columns, or vice versa, which may be what you've experienced?

bariumdose
Posts: 27
Joined: Thu, 3. Jan 08, 03:51
x3tc

Post by bariumdose » Sat, 25. Oct 08, 06:12

I installed your Universal Ware Transfer and the Mission Director. When I hit the key for the UWT, I don't get any incoming message that shows the GUI for transferring items. Both of my ships are docked at a shipyard, and there are wares to be transferred on both ships.

I tried pulling up the Mission Director to do the reset process you suggested in case the UWT doesn't work, but I can't find the MD in the list of options. Yet I know I downloaded the MD into the game folder.

Can you help me figure out why the UWT is not working?

Thanks in advance
Gene O Mui

eladan
Posts: 7168
Joined: Sat, 7. Jan 06, 16:01
x4

Post by eladan » Sat, 25. Oct 08, 17:00

You have X3:R version 2.5? (Mission director was only included in that patch.)

If so, if you press the number pad enter key while flying (i.e. not docked) a menu should display. On the bottom of the menu is an entry 'mission director'. If you select that, another menu will display. At the bottom of that menu will be an option to reset the mission director.

Once you've done that, the script should work. I can't recall, but you may have to save after following the instructions above and then load from that save.

bariumdose
Posts: 27
Joined: Thu, 3. Jan 08, 03:51
x3tc

Post by bariumdose » Sat, 25. Oct 08, 18:58

Yup, I just checked. My game version says 2.5 (2007) on the title screen. I hit enter on the numpad as I'm flying and scroll down, but I don't see a mission director. I do have Roguey's mod installed - maybe that has something to do with my install issue?
Gene O Mui

eladan
Posts: 7168
Joined: Sat, 7. Jan 06, 16:01
x4

Post by eladan » Sun, 26. Oct 08, 03:55

I'd doubt roguey's being the problem.

Is your script editor enabled?

bariumdose
Posts: 27
Joined: Thu, 3. Jan 08, 03:51
x3tc

Post by bariumdose » Sun, 26. Oct 08, 06:42

Hmm, that might be the problem. Sorry to sound like a noob, but how do I check to ensure that the script editor is enabled?
Gene O Mui

eladan
Posts: 7168
Joined: Sat, 7. Jan 06, 16:01
x4

Post by eladan » Sun, 26. Oct 08, 07:36

If you go into the command console of any of your ships, there will be an option to enter the script editor if it's enabled (the option should be just above the ship friend-foe settings.)

bariumdose
Posts: 27
Joined: Thu, 3. Jan 08, 03:51
x3tc

Post by bariumdose » Sun, 26. Oct 08, 23:51

Nope, I don't see the script editor in the place you described. How can I turn it on or install it, if that's possible?
Gene O Mui

eladan
Posts: 7168
Joined: Sat, 7. Jan 06, 16:01
x4

Post by eladan » Mon, 27. Oct 08, 00:26

Instructions are in the tutorial sticky.

bariumdose
Posts: 27
Joined: Thu, 3. Jan 08, 03:51
x3tc

Post by bariumdose » Tue, 28. Oct 08, 17:58

I followed the instructions in the sticky, but nothing happened, except that my name changed to Thereshallbewings. I will try again tonight, but I'm pretty sure I did not make any mistakes when following the instructions to access the script editor.
Gene O Mui

eladan
Posts: 7168
Joined: Sat, 7. Jan 06, 16:01
x4

Post by eladan » Wed, 29. Oct 08, 01:27

You can be pretty sure you've made a mistake. I've not yet seen an instance of someone being unable to enable the script editor which has not been traced to an error on entry. :)

Things to look for:

1. Ensure you've used a capital 'T'.
2. Check the double l - the interface has difficulties with the same key hit twice in quick succession.
3. No spaces anywhere.

bariumdose
Posts: 27
Joined: Thu, 3. Jan 08, 03:51
x3tc

Post by bariumdose » Wed, 29. Oct 08, 04:16

Ok, I got the Script Editor - thanks!

Now I just have to install your remote freight transporter script...I'm assuming I should uninstall the current remote freight transporter script I have before installing your script? It's the one that fills up the message log.
Gene O Mui

eladan
Posts: 7168
Joined: Sat, 7. Jan 06, 16:01
x4

Post by eladan » Wed, 29. Oct 08, 08:20

You shouldn't need to uninstall any other scripts. There won't be a conflict.

bariumdose
Posts: 27
Joined: Thu, 3. Jan 08, 03:51
x3tc

Post by bariumdose » Fri, 31. Oct 08, 04:30

I reset the Mission Director like you said and then saved the game. Now every time I dock or re-load. I get three incoming message screens. The first one says ReadText35-21. When I click Ok, the next screen says No Pilot. When I click Ok again, I get the blank Incoming Message screen and then I have to hit Esc to exit out.
Gene O Mui

eladan
Posts: 7168
Joined: Sat, 7. Jan 06, 16:01
x4

Post by eladan » Fri, 31. Oct 08, 10:31

It's an issue with STL's incoming question lib. Nothing I can do about it, unfortunately. It will go away after you've used the command for the first time.

It's harmless, though annoying.

bariumdose
Posts: 27
Joined: Thu, 3. Jan 08, 03:51
x3tc

Post by bariumdose » Mon, 3. Nov 08, 21:24

It works! I finally got it to work. Thanks again for your help - a very good script you created!

One thing I noticed that was strange is when I transferred some shields from one ship to another, the ship that received the shields don't show the shield status bar in the status. Both ships are docked. I haven't undocked the ship to see if the shield status bar reappears.
Gene O Mui

Post Reply

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