[MOD] Trade Menu Cargo Hold Filter (v1.05 compatible with patch 3.5x, 3.6x and 4.x)

The place to discuss scripting and game modifications for X Rebirth.

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

blackmilan
Posts: 123
Joined: Sat, 22. Jan 11, 22:13

[MOD] Trade Menu Cargo Hold Filter (v1.05 compatible with patch 3.5x, 3.6x and 4.x)

Post by blackmilan » Sun, 9. Nov 14, 14:46

This is a little UI mod. It adds a new filter to the trade menu which filters the trade list by the cargo type of the selected ship. If you click the button a second time it will only show wares in the trade list which are on board of the selected ship (or on its shopping list). Clicking it again will switch back to the cargo type filter.

If you have any questions or feedback please let me know.
  1. The new filter is set as default when you open the trade menu. You do not have to select the appropriate filter for each of your ships manually any more.
  2. If you have a ship like the Rahanas which can transport multiple cargo types (e.g. energy and container) you can see all corresponding wares in one list.
  3. Filtering by the cargo on board of the selected ship allows you to easily find the trade requests you can serve with your current cargo or to find further offers if you are collecting a certain ware.
  4. The ship details are now displaying the full system/sector/zone name instead of the abbreviation and I have made the cargo list a bit more readable. (Only in version v1.01, might be added again later)
Steam Workshop Alternative Download and Installation
  1. Follow the link below and select the file
  2. Click on the download button at the top of the window
  3. Unpack the ZIP archive and copy the folder "TradeMenuCargoHoldFilter" to the X-Rebirth "extensions" directory
Trade Menu Cargo Hold Filter (v1.01, v1.04 and v1.05)

(Click to enlarge image)
Image

Version History


19-Dec-2015 v1.05 (compatible with patch 4.30 and newer) (published on Steam Workshop 29-Feb-2016)
  • Update to be compatible with the UI changes in patch 4.00 beta 4.
18-Apr-2015 v1.04 (compatible with patch 3.5x until patch 3.6x)
  • Added a new filter option to only show wares in the trade list which are on board of the selected ship (or on its shopping list).
10-Mar-2015 v1.03 (compatible with patch 3.5x until patch 3.6x)
  • Update to be compatible with the UI modding features changed in patch 3.5 RC 1.
08-Mar-2015 v1.02 (compatible with patch 3.50 beta 3)
  • Updated the mod to be compatible with the new UI modding features in patch 3.5 beta 3. This version will not work with any patch prior to 3.5 beta 3.
11-Nov-2014 v1.01 (compatible with patch 2.51)
  • Fixed a freeze which occured if there was no ship in the squad. In this case all available trades will be displayed now.
09-Nov-2014 v1.00 (compatible with patch 2.51)
  • Initial Release
Last edited by blackmilan on Thu, 21. Dec 17, 13:47, edited 27 times in total.

Vim Razz
Posts: 1797
Joined: Tue, 2. Nov 10, 03:20

Post by Vim Razz » Mon, 10. Nov 14, 05:37

I've been using this all evening and it's a great addition.

It works fine with 3.00 b2, though it does overwrite the changes in the new menu. I haven't fully explored what the new 3.00 b2 colors and stuff actually indicate yet, but, you know... there's some new stuff in there that exists to look at at some point.

The only problem I could find so far is that it currently causes the game to freeze if the trade menu is opened when there are no ships in your squad.

From the error log:

[General] ======================================
[=ERROR=] Error while executing onEvent script for event: showTradingOffersMenu.
Errormessage: [string "ui/addons/detailmonitor/menu_trading_offers.lua"]:423: attempt to index a nil value
[General] ======================================


If you can get that straightened out, then that'd be awesome.

Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 7032
Joined: Tue, 30. Mar 04, 12:28

Post by Sparky Sparkycorp » Mon, 10. Nov 14, 09:13

Look's great, thanks!

Beta-testing the new beta so will wait a bit to try. Colour - wise in 3.00b2, there's a colour for wares that are illegal. I don't think it is responsive to license or system context but I've not full tested that.

swatti
Posts: 1188
Joined: Sun, 7. Dec 03, 13:03

Post by swatti » Mon, 10. Nov 14, 12:37

Can you make a mod that filters OUT ships that can only carry "fuel" AKA: combat-ships? And fighters / ships with no cargo-hold.

blackmilan
Posts: 123
Joined: Sat, 22. Jan 11, 22:13

Post by blackmilan » Mon, 10. Nov 14, 19:49

Vim Razz wrote:The only problem I could find so far is that it currently causes the game to freeze if the trade menu is opened when there are no ships in your squad.
Who is doing trade without ships? :D Actually I never thought of this scenario :oops: Thanks a lot for pointing that out. I will check that and provide an updated version.
Sparky Sparkycorp wrote:Look's great, thanks!
Thanks. I am hearing a lot of nice stuff about v3.0. I guess I will have to give it a try myself at some point in time and check out the new ui code.
swatti wrote:Can you make a mod that filters OUT ships that can only carry "fuel" AKA: combat-ships? And fighters / ships with no cargo-hold.
This is a nice idea. Though I am not sure, if it can be done with the current functionality in the trade menu.

blackmilan
Posts: 123
Joined: Sat, 22. Jan 11, 22:13

Post by blackmilan » Tue, 11. Nov 14, 19:52

I have fixed the freeze which occured if there was no ship in the squad and uploaded the new version v1.01.

Trade Menu Cargo Hold Filter (v1.01)

Have fun!

PS: Updated the original post with the new version and a version history.

User avatar
Earth Ultimatum IV.
Posts: 5132
Joined: Mon, 3. May 10, 14:39

Post by Earth Ultimatum IV. » Tue, 11. Nov 14, 20:01

Could be added to original game. Wouldn't be a bad addition :)

blackmilan
Posts: 123
Joined: Sat, 22. Jan 11, 22:13

Post by blackmilan » Wed, 12. Nov 14, 20:25

Thanks!

Feel free to suggest it to Bernd for the next update :)

Vim Razz
Posts: 1797
Joined: Tue, 2. Nov 10, 03:20

Post by Vim Razz » Wed, 12. Nov 14, 20:33

blackmilan wrote:Who is doing trade without ships? :D
I break what I can. :wink:

The new version is working nicely so far.

HailedGorion
Posts: 36
Joined: Sun, 2. Jan 11, 19:35

Post by HailedGorion » Thu, 13. Nov 14, 19:01

Would it be able to add filters for wares being offered/bought in a sector/system/galaxy?

I know we can check the distance to that trade to occur, but if I could see the offers coming from a sector/system/galaxy only, it would be much easier to visualize and make my plannings regarding building up the economy.

blackmilan
Posts: 123
Joined: Sat, 22. Jan 11, 22:13

Post by blackmilan » Thu, 13. Nov 14, 20:31

Resolving the location of a trade is rather simple, in fact the code is already there to show the system, sector and zone at the bottom of the trade menu.

Code: Select all

local cluster, sector, zone = GetComponentData(trade.station, "cluster", "sector", "zone")
The thing that is more difficult (at least for me) is how one would tell the menu which system/sector/zone is of interest? There would either have to be some kind of list to select from or a textbox to enter the desired value (like the textbox on top).

Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 7032
Joined: Tue, 30. Mar 04, 12:28

Post by Sparky Sparkycorp » Thu, 13. Nov 14, 20:40

Maybe colour-coding would be OK? Seems fine for NPC lists in the sidebar.

blackmilan
Posts: 123
Joined: Sat, 22. Jan 11, 22:13

Post by blackmilan » Sat, 15. Nov 14, 13:15

I like the idea to filter by system/sector/zone and I think I have an idea how to make it work. I will try to add a new row below the current filters and put a text field there where the name can be entered (like the search box at the top) and put buttons next to it to tell it what to filter for (system/sector/zone or galaxy in case one wants to see everything).

HailedGorion
Posts: 36
Joined: Sun, 2. Jan 11, 19:35

Post by HailedGorion » Sat, 15. Nov 14, 21:21

That would be great. It would make my life so much easier when looking for the wares needed to supply a specific station.

blackmilan
Posts: 123
Joined: Sat, 22. Jan 11, 22:13

Post by blackmilan » Thu, 20. Nov 14, 19:30

HailedGorion wrote:Would it be able to add filters for wares being offered/bought in a sector/system/galaxy?
I had a look into the trade menu code to see how we could make it work and there is actually good news.

No need to mod anything, it is already built-in. :lol:

Did you ever use the textbox at the top of the menu? I thought it could only search for wares.

Guess what, beside wares it allows searching for zones, sectors, systems and even station and faction names can be used. :D

Image

Post Reply

Return to “X Rebirth - Scripts and Modding”