[SCR] Ship Browser v1.2 - In Game Ship Comparison Tool [UPDATED: 11/2/2014]

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

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

zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal » Tue, 11. Nov 14, 03:18

The first version of the ship browser (1.0) was the final version for TC. I use a lot of AP specific commands.

User avatar
Urschleim
Posts: 919
Joined: Wed, 10. Jan 07, 13:34
x4

Post by Urschleim » Tue, 11. Nov 14, 13:09

Great Script, thx alot !!!!
Image

User avatar
dizzy
Posts: 1012
Joined: Sun, 26. Sep 10, 06:00
x4

Post by dizzy » Thu, 13. Nov 14, 10:32

OK, I found an issue (using latest TC version on XTC 2.2b): it doesn't list the OTAS ships.

In XTC, the OTAS ships belong to "Friendly Race" and are produced by "OTAS Shipyard" which also belongs to "Friendly Race" but is hosted in an Argon core sector (Sirius III). It also requires reputation with the Argon to buy them.

So I thought, maybe there's an issue with this script and "Friendly Race" ships in general. I debugged it by adding lots of "write to player logbook" lines but eventually the cause was surprising: it appears that if you query for the list of shipyards using the well known "get station array: of race $race class/type={Shipyard 2037}" it just doesn't list anything for "Friendly Race". Even weirder, the OTAS Shipyard is listed if you query for the shipyards using race "Argon 1". Not sure why the scripting engine in the game behaves this way, the OTAS Shipyard clearly belongs to "Friendly Race 13" (in XEditor2 for example). Maybe the game engine gets confused by the fact that the OTAS Shipyard is present in an Argon sector so it's listing it if you query for Argon stations.

ANYWAY, the fix is kinda of a hack (I'm open to suggestions), essentially if I detect that the ship race is "Friendly Race 13" then I make sure I query for shipyards for "Argon 1" instead. In your script I have changed these lines:

Code: Select all

find_closest_known_shipyard:
$syrace = $ship.race
if $syrace == {Friendly Race 13}
  * OTAS shipyards are found by searching for Argon shipyards, no idea why.
  $syrace = {Argon 1}
end

$station.list = get station array: of race $syrace class/type={Shipyard 2037}
...
EDIT: looking at v1.1 (AP only) changelong, this actually would have also fixed the issue as the problem is present when trying to find where to buy the ship and doesn't exist otherwise:
+ Changed rules so that being known to the player will allow the ship to be shown rather than requiring the player to know where to purchase the ship.

I may look into your v1.1 code and try to replicate that part in v1.0 (TC compatible) if it's not hard.

zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal » Thu, 13. Nov 14, 15:31

The changelog refers to a mistake I made early on thinking -> is known applied to wares.

So I would often write it like:

Code: Select all

if $ware.item -> is known
end
The correct way to check and see if a player knows about a ware (ship types are wares too) is:

Code: Select all

if has $ware.item been discovered
end
Of course it is now obvious too me that I should have realized that the -> is known can only apply to object instances and can't work on things like races and wares. I discovered the mistake and the fix shortly after releasing the AP version of the ship browser, so I don't know whether the TC one has the issue or not, but I did fix it for the AP version in 1.1.

The OTAS issue you have with TC is very similar to the ATF/Terran issue. If ATF ships can be purchased in XTC you might notice the same thing.

User avatar
dizzy
Posts: 1012
Joined: Sun, 26. Sep 10, 06:00
x4

Post by dizzy » Thu, 13. Nov 14, 22:10

Thanks for the info. I changed the code where it decided to display a ship only if "spoiler mode" enabled OR if it found a homebase for it with displaying it if "spoiler mode" enabled OR if it was discovered. My previous fix to find OTAS ships by searching for Argon shipyards is still useful at least for the "general" page where it tells you where to buy it from.

However, with this last change it now also lists ATF ships (which in XTC can't be bought anywhere). It's kind of arbitrary if this is useful or not, it's not useful if you are researching for ships to add to your fleet (you can't buy ATF ships and I don't think you can cap ATF ships in XTC) but may be of some use if you are comparing ships overall.

It's also missing some data for some of these new ships that are showing now (data like weapons capacity, shields, etc). I guess I'll just revert this last change to only show ships that have a known shipyard.

One thing I'm curious is how my change relates to vanilla X3:TC game. Does your ship browser display OTAS ships in the vanilla game? I'd be surprised if it does :) If it doesn't, you should include my fix in the TC version of your script since it's useful outside of the xtended mod.

zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal » Fri, 14. Nov 14, 03:04

memeics wrote:One thing I'm curious is how my change relates to vanilla X3:TC game. Does your ship browser display OTAS ships in the vanilla game? I'd be surprised if it does :) If it doesn't, you should include my fix in the TC version of your script since it's useful outside of the xtended mod.
Absolutely, if you want me to include your fixed file in the TC version just PM me a download link.

User avatar
dizzy
Posts: 1012
Joined: Sun, 26. Sep 10, 06:00
x4

Post by dizzy » Tue, 18. Nov 14, 00:37

zanzal wrote:Absolutely, if you want me to include your fixed file in the TC version just PM me a download link.
Do you want me to test with vanilla TC?

Otherwise I already posted the fix (but not the full script) a few posts back. It's going to query for Argon Shipyards to try to find where a ship is sold if that ship belongs to Friendly Race. This is kind of a hack, specifically for OTAS ships.

A better fix would be to get a full list of all Shipyards when the script begins, store it in some fast hash/tree indexed by ship ID and then use it when displaying ships, that way there is no assumption that OTAS ships are queried as Argon shipyards like my hack does, instead you just look for any OTAS (or whatever ships) in all Shipyards as they are already indexed by the ship IDs (so the lookup is fast).

zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal » Tue, 18. Nov 14, 04:44

I have no plans to make any changes to the final version for TC. Hence the final part. :)

Right now all my modding efforts are focused elsewhere.

BlackArchon
Posts: 1004
Joined: Wed, 4. Feb 04, 18:37
xr

Post by BlackArchon » Wed, 19. Nov 14, 11:33

I would really love to have a "total number of weapons slots" column for all ships and a "total number of capital ship weapon slots" (PPC, PBC, IC, and so on) for M7/M2/M1/TL class ships.
This would make the decision for some ships way more easier. What do you think?

zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal » Wed, 19. Nov 14, 17:34

BlackArchon wrote:I would really love to have a "total number of weapons slots" column for all ships and a "total number of capital ship weapon slots" (PPC, PBC, IC, and so on) for M7/M2/M1/TL class ships.
This would make the decision for some ships way more easier. What do you think?
If the script had a way of knowing what a capital ship weapon is, then it might be possible to highlight that turret entry with a different color indicating the biggest class of weapons it can equip.. That could help with ship selection.

Currently the only way this would work is by cargo class. So we might be able to say if the turret/mainguns can use any weapon of XL (XXL in XRM) class than highlight the number red. If the highest class is L (XL in XRM) then color it orange, M (L in XRM) then yellow, otherwise uncolored.

So then the weapons page might show turrets like:

8 10 9 10

This is probably the closest I would get to giving you this information. Unfortunately, some mods actually give mainguns to a select few capital ships so I can't replace main guns with capitalship guns for cap ships. Adding a new page specific to out of sector combat might be possible at some point.

I see I missed an earlier question you posted about the positions of turrets (front back, etc), I would have loved to have this information, but unfortunately, it is something that I can't obtain.

BlackArchon
Posts: 1004
Joined: Wed, 4. Feb 04, 18:37
xr

Post by BlackArchon » Wed, 19. Nov 14, 18:25

Ok, I see your point now - you cannot hardcode the capital ship weapons because you want your script to be independent of any installed mods. During the last minutes I tried to develop a rule on how to define capital ship weapons, but I always got to a point where it isn't exact or correct for the X3 mods I know. More than an educated guess doesn't seem to be possible.

And also thanks for the info about the turret's position. Well, if I had the money to buy Egosoft and let them develop a X4, I had some good ideas... :D

BlackArchon
Posts: 1004
Joined: Wed, 4. Feb 04, 18:37
xr

Post by BlackArchon » Wed, 26. Nov 14, 21:08

Can you also do a "Weapon browser"? A weapon comparison tool which displays the exact specifications (hull damage per hit/per second, shield damage per hit/per second, range, rounds/min, projectile speed, energy consumption per shot/per second, volume, container class, average price) of all weapons in the game? The values from the ingame encyclopedia are too much rounded up/down.
Last edited by BlackArchon on Wed, 26. Nov 14, 22:39, edited 1 time in total.

zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal » Wed, 26. Nov 14, 22:36

I am actually working on a very large modding project right now - almost as large as a total conversion.

BlackArchon
Posts: 1004
Joined: Wed, 4. Feb 04, 18:37
xr

Post by BlackArchon » Sun, 7. Dec 14, 20:36

The sorting by dock size seems to have a little issue: Image

It is sorted as ASCII string instead of by number.

zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal » Sun, 7. Dec 14, 22:27

Thanks for letting me know, I've posted a fixed version to address that bug. Let me know if it has any issues. I did make one other small internal change, but I am a little concerned it could cause problems with how docking information is gathered from ships.. It may not hurt anything, and worked good on mine, but it may not work for everyone, so let me know if everything looks good.

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”