Thinned Station Columns Mod

The place to discuss scripting and game modifications for X4: Foundations.

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

User avatar
ChemODun
Posts: 595
Joined: Mon, 12. Feb 07, 21:58
x4

Re: Thinned Station Columns Mod

Post by ChemODun »

When you will achieve working mod without changes in a look of stations, try to update it, by removing \n from

Code: Select all

 
row[2]:createText(stationname .. "\n" .. secondline, { font = font, mouseOverText = mouseover })

And check results...
Multiply entropy by absolute zero

Freedom in space
RondoX4
Posts: 39
Joined: Thu, 30. Jun 22, 02:31
x4

Re: Thinned Station Columns Mod

Post by RondoX4 »

(1) into thin_columns.lua
after "place for code from map_menu.lua - begin"
do I copy
local config = {
...
}
in menu_map.lua lines 1050-1735?
I note that "--" indicates a comment line
(2) located menu.createPropertyRow in menu_map.lua
line 8538 "function menu.createPropertyRow"
line 8923 "end"
(3) located the area change in base code to be made
line 8663 "if isstation"
line 8680 "row[2]:createText(stationname"
Noted that this code has not been altered yet
(4)I know I need to create a file xml file L.createPropertyRow
Will this be place in iu subfolder?
(5)I know to copy the whole menu.createPropertyRow into L.createPropertyRow
(6)in the instruction "The whole copy of menu.createPropertyRow, placed after config and in extension file it has to be named L.createPropertyRow" I am confused with "place after config"
Sometimes your instructions can get a bit cryptic so I just need clarification.
It appears you want to first test this before changes are to ensure the baseline code works.
RondoX4
Posts: 39
Joined: Thu, 30. Jun 22, 02:31
x4

Re: Thinned Station Columns Mod

Post by RondoX4 »

(1) into thin_columns.lua
after "place for code from map_menu.lua - begin"
do I copy
local config = {
...
}
in menu_map.lua lines 1050-1735?
I note that "--" indicates a comment line
(2) located menu.createPropertyRow in menu_map.lua
line 8538 "function menu.createPropertyRow"
line 8923 "end"
(3) located the area change in base code to be made
line 8663 "if isstation"
line 8680 "row[2]:createText(stationname"
Noted that this code has not been altered yet
(4)I know I need to create a file xml file L.createPropertyRow
Will this be place in iu subfolder?
(5)I know to copy the whole menu.createPropertyRow into L.createPropertyRow
(6)in the instruction "The whole copy of menu.createPropertyRow, placed after config and in extension file it has to be named L.createPropertyRow" I am confused with "place after config"
Sometimes your instructions can get a bit cryptic so I just need clarification.
It appears you want to first test this before changes are to ensure the baseline code works.
RondoX4
Posts: 39
Joined: Thu, 30. Jun 22, 02:31
x4

Re: Thinned Station Columns Mod

Post by RondoX4 »

sorry about double post. The forum times out so quickly that I have to create a text file then copy it in and it went to another page
User avatar
ChemODun
Posts: 595
Joined: Mon, 12. Feb 07, 21:58
x4

Re: Thinned Station Columns Mod

Post by ChemODun »

Yes, you should copy both thing, i.e. local config and function menu.createPropertyRow with its respective full content in a place marked by comments
Without any changes.
Then, in the same file, i.e. in thin_columns.lua, rename function menu.createPropertyRow to function L.createPropertyRow

And nothing more.
So, after that in thin_columns.lua you will have a full copy of confug variable and local method L.createPropertyRow, equal to original from menu_map.lua.

This code, which was created initially, order a game use our local copy of createPropertyRow instead original one.

Code: Select all

menu.createPropertyRow = L.createPropertyRow
Now you have to install extension to game, and start and load game, check the message in log, and check if owned property shown without changes and issues

And only after that start to play with changing a code

Finally it has to looks like this:

Code: Select all

-- ffi setup
local ffi = require("ffi")
local C = ffi.C

local L = {
    egoCreatePropertyOwnedRow = nil,
}
local Lib = require("extensions.sn_mod_support_apis.ui.Library")

local menu = nil

local function init()

    menu = Lib.Get_Egosoft_Menu("MapMenu")

    if not menu then
        DebugError("Thin columns - Could not find MapMenu, aborting UI modifications.")
        return
    end

    -- Functions that creates the Property Owned table row
    L.egoCreatePropertyOwnedRow = menu.createPropertyRow
    menu.createPropertyOwned = L.createPropertyRow

    DebugError("Thin columns - MapMenu modifications applied.")
end

--
-- place for code from map_menu.lua - begin
--

local config = {
...
}


function L.createPropertyRow(instance, ftable, component, iteration, commanderlocation, showmodules, hidesubordinates, numdisplayed, sorter)
...
end

--
-- place for code from map_menu.lua - end
--

init()
Please take in account - previously first three lines example of thin_columns.lua contained a mistyped text. Please recheck it in your file.
Multiply entropy by absolute zero

Freedom in space
RondoX4
Posts: 39
Joined: Thu, 30. Jun 22, 02:31
x4

Re: Thinned Station Columns Mod

Post by RondoX4 »

Hope you are having a good weekend.
Completed the coding on thin_columns as best as I could and double checked all the files.
I used Steam's debug function to create a log file.
I saw your debugger video in the modding utilities. Definitely sophisticated.
The game opens and initially appears OK, but when you open the map and click on property nothing occurs.
You just note a zero on the property line.
The log file is rather large but located the errors searching thin_columns
Each error occurs when you click on the properties button.
Each error is exactly the same
I would think the game creates a property list table dynamically and then displays it but it is trying to use an empty table.
[=ERROR=] 3228227.58 Error while executing onEvent script for event: onClick.
Errormessage: [string "extensions/thin_columns/ui/thin_columns.lua"]:724: attempt to index a nil value
Where the error is occurring:
line 723 function L.createPropertyRow(instance, ftable, component, iteration, commanderlocation, showmodules, hidesubordinates, numdisplayed, sorter)
line 724 local maxicons = menu.infoTableData[instance].maxIcons
User avatar
ChemODun
Posts: 595
Joined: Mon, 12. Feb 07, 21:58
x4

Re: Thinned Station Columns Mod

Post by ChemODun »

Excuse me for mistyping again.
Long hard week... :-(
In your file replace

Code: Select all

menu.createPropertyOwned = L.createPropertyRow
by

Code: Select all

menu.createPropertyRow = L.createPropertyRow
I.e. file should looks like

Code: Select all

-- ffi setup
local ffi = require("ffi")
local C = ffi.C

local L = {
    egoCreatePropertyRow = nil,
}
local Lib = require("extensions.sn_mod_support_apis.ui.Library")

local menu = nil

local function init()

    menu = Lib.Get_Egosoft_Menu("MapMenu")

    if not menu then
        DebugError("Thin columns - Could not find MapMenu, aborting UI modifications.")
        return
    end

    -- Functions that creates the Property Owned table row
    L.egoCreatePropertyRow = menu.createPropertyRow
    menu.createPropertyRow = L.createPropertyRow

    DebugError("Thin columns - MapMenu modifications applied.")
end

--
-- place for code from map_menu.lua - begin
--

local config = {
...
}


function L.createPropertyRow(instance, ftable, component, iteration, commanderlocation, showmodules, hidesubordinates, numdisplayed, sorter)
...
end

--
-- place for code from map_menu.lua - end
--

init()
Multiply entropy by absolute zero

Freedom in space
RondoX4
Posts: 39
Joined: Thu, 30. Jun 22, 02:31
x4

Re: Thinned Station Columns Mod

Post by RondoX4 »

Tested your change out.
Used an older save file and functioning OK
Expand, Rightclick and sort functioning OK
Any other testing needed. Congratulations on you efforts.
only mention in the debug log was:
[FileIO ] 19.18 File I/O: Failed to verify the file signature for file '.\extensions\thin_columns\ui.xml' (error: 14)
User avatar
ChemODun
Posts: 595
Joined: Mon, 12. Feb 07, 21:58
x4

Re: Thinned Station Columns Mod

Post by ChemODun »

RondoX4 wrote: Sun, 14. Dec 25, 01:49 Tested your change out.
Used an older save file and functioning OK
Expand, Rightclick and sort functioning OK
Any other testing needed. Congratulations on you efforts.
only mention in the debug log was:
[FileIO ] 19.18 File I/O: Failed to verify the file signature for file '.\extensions\thin_columns\ui.xml' (error: 14)
Good to know!

Code: Select all

[FileIO ] 19.18 File I/O: Failed to verify the file signature for file '.\extensions\thin_columns\ui.xml' (error: 14)
Is normal for any non-Egosoft file.

Does log contains "Thin columns - MapMenu modifications applied."?
If yes - you can start testing, for example - try to remove "\n" at position what I stated previously.

And one important thing, which will simplify your life.

You don't need always reload game to check how new code is working ...
After the game with extension is loaded, you can do only two things to reload code in game:
  1. Copy new file in the same place (or edit directly, it's on your decision)
  2. Send /reloadui command in chat window. Or /rui if you have SN Mod API installed. It will reload UI, and for sure it will be visible... For example, if you were in map view, it will exit from this mode ...
So, good luck. And you can ask anything...
Multiply entropy by absolute zero

Freedom in space
RondoX4
Posts: 39
Joined: Thu, 30. Jun 22, 02:31
x4

Re: Thinned Station Columns Mod

Post by RondoX4 »

In the degbug log i do see the text about MapMenu modifications applied.
I have already attempted to modify the code. In the line
row[2]:createText(stationname .. "\n" .. secondline, { font = font, mouseOverText = mouseover })
I changed it to
row[2]:createText(stationname, { font = font, mouseOverText = mouseover })
This only removes the location text from line 2, but text 2 line still remains.
Right justified are ship icons and numbers indicating ships docked, traders subordinate etc
Those are still there an and need to be excluded.
All I want is the small block with the plus for expanding and the location name in one line of text.
The green highlighted box needs to be 1 row and not 2 to thin the column.
I think the crux of the change needed is in
row[2]:setColSpan(4 + maxicons - #fleettypes - 1)
and the fact that whole 2 line green highlighted box is based on row[2]?
I have looked in JAMUI for clues how the previous modder did this but this where luck has run out.
Still looking at JAMUI and thinned_columns but may need suggestions on how to remove ship stats and the second line.
RondoX4
Posts: 39
Joined: Thu, 30. Jun 22, 02:31
x4

Re: Thinned Station Columns Mod

Post by RondoX4 »

Well so far the only change I have managed is to (1) kept the expand button on left (2) station name left justified (3) ship icons on text line 1 representing docked ships etc with corresponding values under the icons on text line 2.
I have not figured out how to only displayed one row for Station name.
Any assistance would be welcomed.
User avatar
ChemODun
Posts: 595
Joined: Mon, 12. Feb 07, 21:58
x4

Re: Thinned Station Columns Mod

Post by ChemODun »

If I'm understand correctly, currently you have something like this:
Image

At least I have after replaced "\n" by "" at point what I stated before.

If you will go deeper in the code inside L.createPropertyRow, you can find several others "\n" used.
And as we currently can see, it is somehow related to the "fleets" icons.

So, try to find it and again replace "\n" with "", i.e. simple delete it.

And you will get the next picture ...
Image

Looks like we lose all, but it is not fully right, try to move mouse on a right part of row, and you will see ...

Image

And when you will achieve it, please think - why it happened? Why we have a data, but no visible for us?

Next time I will explain how to fix it ...
To get:
Image
Multiply entropy by absolute zero

Freedom in space
RondoX4
Posts: 39
Joined: Thu, 30. Jun 22, 02:31
x4

Re: Thinned Station Columns Mod

Post by RondoX4 »

From the point of the first "\n" in your first suggestion to change I scanned
"\n" including the quotes
I copied the lines to be changed and commented them out and deleted \n.
When I loaded a saved game there was no change.
Then I scanned for just \n and deleted just the \n in the line of code.
After I loaded a save game I noted the single thinned line for each station as in your example.
Tested unassigned and fleet ship functionality as well.
Expand +, right click on station name and sort functions OK.
I have one fleet which did have two text lines but the first line was blank.
So deleting \n in quotes had no effect but the few \n not in quotes made the change.
At this point I am pleased with the results, but including the additional ship information
would be good.
Many of the "\n" that were changed involved mouse over code. Will they have to be changed back?
User avatar
ChemODun
Posts: 595
Joined: Mon, 12. Feb 07, 21:58
x4

Re: Thinned Station Columns Mod

Post by ChemODun »

Excuse me, not statet it - quotes simple used to show the text borders.
As it usually done for any text variable.
I.e. "\n" means that \n has to be replaced with "", I.e. with nothing, I.e. simple removed.
For me it is standard notation...

Good to know, thar you have achieved next steps.
Does you see fleet icons with numbers flying on mouse over right part of a row?
Please share somehow the screen shots or video
Multiply entropy by absolute zero

Freedom in space
RondoX4
Posts: 39
Joined: Thu, 30. Jun 22, 02:31
x4

Re: Thinned Station Columns Mod

Post by RondoX4 »

For the station name rows I still still see the fleet info left left of the hull bar.
I have captured a couple of screenshots I would like for you to see.
However, I cant insert the jpegs directly onto the post and need to use [ external image ]?
Is there a simple way to do that?
I have made a slight change to remove the sector name
row[2]:createText(stationname .. "" .. secondline, { font = font, mouseOverText = mouseover })
to
row[2]:createText(stationname, { font = font, mouseOverText = mouseover })
At this point the I feel ok loading and playing the game but still look forward to changing the code to have some fleet details after the station name.
User avatar
ChemODun
Posts: 595
Joined: Mon, 12. Feb 07, 21:58
x4

Re: Thinned Station Columns Mod

Post by ChemODun »

Yes, you need to place images somewhere in internet...
Or you can make an YouTube account, and record video, currently windows has embedded utility to make screen recordings...

And regarding my question - did you achieve the situation described on my third screenshot ?
Multiply entropy by absolute zero

Freedom in space
RondoX4
Posts: 39
Joined: Thu, 30. Jun 22, 02:31
x4

Re: Thinned Station Columns Mod

Post by RondoX4 »

hanks for you continued interest in improving the mod.
I still need to learn how to get the images in the internet.
I have seen instructions on imbedding in the post so it will appear.
As I explained in my last post I have made a slight change to remove the white highlighted sector name.
Only the green Station name remains and the shield bar on the right.
I have not achieved the fixing the code to display right justified ships docked, traders subordinate etc.
I will definitely need help accomplishing that.
I am grateful for your help in getting me this far.
User avatar
ChemODun
Posts: 595
Joined: Mon, 12. Feb 07, 21:58
x4

Re: Thinned Station Columns Mod

Post by ChemODun »

You are welcome.

You can ping me anytime, and we can continue.
Multiply entropy by absolute zero

Freedom in space
RondoX4
Posts: 39
Joined: Thu, 30. Jun 22, 02:31
x4

Re: Thinned Station Columns Mod

Post by RondoX4 »

Image 1 after my slight change to remove sector name
Image
Image 2 how it looks with the sector name
Image
This is my first experiment with posting images on the web.
It uses a free service called imgur. To see the image you right click on the image icon and open image in a new tab
If you don't feel OK with the security with the app that's OK.
You know I am not a xml coder. So if we continue to improve on this mod you are going to have to help me to place the new code in the right place.
I am fine with the finding where to put the code and testing then testing it.
For now the mod functions well.
User avatar
ChemODun
Posts: 595
Joined: Mon, 12. Feb 07, 21:58
x4

Re: Thinned Station Columns Mod

Post by ChemODun »

Ok.

For future - from imgur looks like better post an image links as an url, not as an image, as their allow show images only on their site.

And still important question - if you will move mouse in right parts of thin rows with stations or fleets, will you see a popped up icons with numbers like on my third screenshot?
Multiply entropy by absolute zero

Freedom in space

Return to “X4: Foundations - Scripts and Modding”