Note on mods that require UI Extensions

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

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

kuertee
EGOSOFT
EGOSOFT
Posts: 818
Joined: Sun, 14. Dec 03, 13:05
x4

Note on mods that require UI Extensions

Post by kuertee »

Just a note to players who use the UI Extensions mod:

The new 7.5 beta Protected UI Mode setting in the Extensions menu is unavailable on games with the UI Extensions mod installed because that mod overrides that menu.

And mods that require UI Extensions are currently incompatible with the 7.5 beta.
Realspace
Posts: 1637
Joined: Wed, 15. Nov 06, 10:21
x4

Re: Note on mods that require UI Extensions

Post by Realspace »

This affects also SN API 1.90 as far as I can see. I tried launching the game with it, it gave me the option to disable the Protected UI once, then no more so I can't figure if the mod is working or not.
I suppose you already know it since the API is the base of the base of all your mods :-)
kuertee
EGOSOFT
EGOSOFT
Posts: 818
Joined: Sun, 14. Dec 03, 13:05
x4

Re: Note on mods that require UI Extensions

Post by kuertee »

Yeah, MSAPI's Lua_Loader and its MD implementation (i.e. <raise_lua_event name="'Lua_Loader.Load'" param="'X'"/>) no longer function.

Now with 7.5's lua "sandboxing" fixed (the "_g = nil" bug as UI modders termed it), all custom lua files can be loaded with the mod's ui.xml file - as intended.
re: https://wiki.egosoft.com:1337/X%20Rebir ... d%20guide/
Note that guideline is for X Rebirth. But its use in X4 is similar.
This is how my mod's Alternatives To Death ui.xml looks like:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<addon name="kuertee_alternatives_to_death" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../ui/core/addon.xsd">
  <environment type="menus">
    <file name="ui/gameoptions_uix.lua" />
    <file name="ui/menu_toplevel_uix.lua" />
    <dependency name="ego_detailmonitor" />
  </environment>
</addon>
(A "non-working sandbox" is how far I understood that "_g = nil" bug - when it was explained to me. I didn't understand the fix further than that. :D
Regardless, 7.5 looks to be good in regards to UI modding. i.e. I now have a working WIP UI Extensions beta on the Steam version of my game.
Work on the update to my UI Extensions mod continues.)

EDIT: MSAPI's Lua_Loader and <raise_lua_event name="'Lua_Loader.Load'" param="'X'"/> look to still work but only within the MSAPI folder.
- which feels like it is now "sandboxed" (as intended) within its own mod folder. END EDIT.
Realspace
Posts: 1637
Joined: Wed, 15. Nov 06, 10:21
x4

Re: Note on mods that require UI Extensions

Post by Realspace »

7.5 is really adding good things, by my part I appreciate a lot the modding possibilities to boosters, which I already implemented.
I go ot for one question that always floats in my mind and you are the only one who can answer :-)
Would it be possible to mod the ui map so thar, for instance, when zoomed out you don't have the hexagons but a map more similar to X3 or better one, made of circles and connections as in a real star map (Elite Dangerous' style)?
Or is it out of the question for the actual ui modding?
I really know zero about ui modding..
Thank you!
DeadAirRT
Posts: 1124
Joined: Fri, 25. Jan 19, 03:26
x4

Re: Note on mods that require UI Extensions

Post by DeadAirRT »

kuertee wrote: Thu, 5. Dec 24, 04:19 Yeah, MSAPI's Lua_Loader and its MD implementation (i.e. <raise_lua_event name="'Lua_Loader.Load'" param="'X'"/>) no longer function.

Now with 7.5's lua "sandboxing" fixed (the "_g = nil" bug as UI modders termed it), all custom lua files can be loaded with the mod's ui.xml file - as intended.
re: https://wiki.egosoft.com:1337/X%20Rebir ... d%20guide/
Note that guideline is for X Rebirth. But its use in X4 is similar.
This is how my mod's Alternatives To Death ui.xml looks like:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<addon name="kuertee_alternatives_to_death" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../ui/core/addon.xsd">
  <environment type="menus">
    <file name="ui/gameoptions_uix.lua" />
    <file name="ui/menu_toplevel_uix.lua" />
    <dependency name="ego_detailmonitor" />
  </environment>
</addon>
(A "non-working sandbox" is how far I understood that "_g = nil" bug - when it was explained to me. I didn't understand the fix further than that. :D
Regardless, 7.5 looks to be good in regards to UI modding. i.e. I now have a working WIP UI Extensions beta on the Steam version of my game.
Work on the update to my UI Extensions mod continues.)

EDIT: MSAPI's Lua_Loader and <raise_lua_event name="'Lua_Loader.Load'" param="'X'"/> look to still work but only within the MSAPI folder.
- which feels like it is now "sandboxed" (as intended) within its own mod folder. END EDIT.
So it's only loading lua's that's sandboxed? The md portion of simple menus would still be theoretical?
kuertee
EGOSOFT
EGOSOFT
Posts: 818
Joined: Sun, 14. Dec 03, 13:05
x4

Re: Note on mods that require UI Extensions

Post by kuertee »

DeadAirRT wrote: Thu, 5. Dec 24, 15:49 So it's only loading lua's that's sandboxed? The md portion of simple menus would still be theoretical?
Yeah. MSAPI's Simple Menu API (including its Extension Options feature) works.
Most (if not all) of MSAPI's MD API should still work.
Only its Lua Loader API is restricted to work on its own MSAPI folder.
As far as I can tell at this time, of course.
kuertee
EGOSOFT
EGOSOFT
Posts: 818
Joined: Sun, 14. Dec 03, 13:05
x4

Re: Note on mods that require UI Extensions

Post by kuertee »

Realspace wrote: Thu, 5. Dec 24, 13:48 7.5 is really adding good things, by my part I appreciate a lot the modding possibilities to boosters, which I already implemented.
Nice! and yeah, i can't wait to play 7.5 properly. but have been too busy updating my mods. :D
Would it be possible to mod the ui map so thar, for instance, when zoomed out you don't have the hexagons but a map more similar to X3 or better one, made of circles and connections as in a real star map (Elite Dangerous' style)?
I don't actually know which assets need to be replaced for that. will have a look.
kuertee
EGOSOFT
EGOSOFT
Posts: 818
Joined: Sun, 14. Dec 03, 13:05
x4

Re: Note on mods that require UI Extensions

Post by kuertee »

Realspace wrote: Thu, 5. Dec 24, 13:48 Would it be possible to mod the ui map so thar, for instance, when zoomed out you don't have the hexagons but a map more similar to X3 or better one, made of circles and connections as in a real star map (Elite Dangerous' style)?
Or is it out of the question for the actual ui modding?
Unfortunately, the hex grid is built at run-time and isn't moddable.
Realspace
Posts: 1637
Joined: Wed, 15. Nov 06, 10:21
x4

Re: Note on mods that require UI Extensions

Post by Realspace »

Thank you for checking. :-)
User avatar
beko
Posts: 81
Joined: Thu, 11. Jun 20, 21:14
x4

Re: Note on mods that require UI Extensions

Post by beko »

Tried to apply this to `sn_mod_support_apis` and it was a pain in the neck due to my lack of knowledge but I think I got it working.

Moved `sn_mod_support_apis/ui/addons/ego_debug/Lua_Loader.lua` to `sn_mod_support_apis/ui/lua_loader.lua` deleted the folder `sn_mod_support_apis/ui/addons` and created `sn_mod_support_apis/ui.xml` with the following content:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<addon name="sn_mod_support_apis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../ui/core/addon.xsd">
  <environment type="menus">
    <file name="ui/lua_loader.lua" />
    <savedvariable name="__MOD_USERDATA" storage="userdata" />
  </environment>
</addon>
I also had to change this or it wouldn't find any lua files and only looked for txt files (I have the unpacked version from Git for development purposes):

Code: Select all

diff --git extensions/sn_mod_support_apis/ui/lua_loader.lua extensions/sn_mod_support_apis/ui/lua_loader.lua
index 365f91f..b8d9c80 100644
--- extensions/sn_mod_support_apis/ui/lua_loader.lua
+++ extensions/sn_mod_support_apis/ui/lua_loader.lua
@@ -87,6 +87,10 @@ local function on_Load_Lua_File(_, file_path)
         package.path = "?.txt;"..package.path
     end
 
+    if not string.find(package.path, "?.lua;") then
+        package.path = "?.lua;"..package.path
+    end
+
     require(file_path)
     -- Removing the debug message; if a user really wants to know,
     -- they can listen to the ui event.
Trajan von Olb
Posts: 573
Joined: Wed, 4. Feb 04, 21:39
x3tc

Re: Note on mods that require UI Extensions

Post by Trajan von Olb »

Ok, I see... nothing :-)... Well, at least only a little.
That's why I ask simply:
If I make calls in my mod like:
Spoiler
Show

Code: Select all

    <cue name="Mhk_at_OnLuaLoaderReady">
      <conditions>
        <event_ui_triggered screen="'Lua_Loader'" control="'Ready'" />
      </conditions>
      <actions>
        <raise_lua_event name="'Lua_Loader.Load'" param="'extensions.tvo_more_hotkeys_adv_targeting.ui.more_hotkeys_adv_targeting'"/>
      </actions>
    </cue>
will they continue to work without changes?

OR What exactly do I have to change?

And what about the LUA scripts? Do I have to change anything there too? In most cases it concerns the targeting system (i.e. switching on a target) or the direct access to Egosoft menus:
Spoiler
Show

Code: Select all

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

local Lib = require("extensions.sn_mod_support_apis.lua_library")
local mapMenu = {}
local mhk_menu = {}

local function init()
    DebugError("More Hotkeys AT Init")

    mapMenu = Lib.Get_Egosoft_Menu("MapMenu")

    RegisterEvent("MoreHotkeys.targetAllThings", mhk_menu.targetAllThings)
    RegisterEvent("MoreHotkeys.removeTarget", mhk_menu.removeTarget)
end

function mhk_menu.targetAllThings(_, object)
    local object64Bit = ConvertStringTo64Bit(object)
    C.SetSofttarget(object64Bit, "")
end

function mhk_menu.removeTarget(_, event)
    if event == "onPress" then
		RemoveSofttarget()
    end
end

init()

Code: Select all

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

-- local Lib = require("extensions.sn_mod_support_apis.lua_library")
local Lib = require("extensions.sn_mod_support_apis.lua_interface").Library
local mapMenu = {}

local mhk_menu = {}
local selectedcomponent = nil
local panelsToggle = {
    left = true,
    right = true,

    infoMod = nil,
    searchMode = nil,
}

local function init()
    DebugError("More Hotkeys MAM Init")

    mapMenu = Lib.Get_Egosoft_Menu("MapMenu")

    RegisterEvent("MoreHotkeys.openObjectListWithHotkey", mhk_menu.openObjectListWithHotkey)
    RegisterEvent("MoreHotkeys.openPropertyOwnedWithHotkey", mhk_menu.openPropertyOwnedWithHotkey)
    RegisterEvent("MoreHotkeys.openMissionOffersWithHotkey", mhk_menu.openMissionOffersWithHotkey)
    RegisterEvent("MoreHotkeys.openMissionManagerWithHotkey", mhk_menu.openMissionManagerWithHotkey)
    RegisterEvent("MoreHotkeys.openInfoWithHotkey", mhk_menu.openInfoWithHotkey)
    RegisterEvent("MoreHotkeys.toggleTradeLayerWithHotkey", mhk_menu.toggleTradeLayerWithHotkey)
    RegisterEvent("MoreHotkeys.toggleMiningLayerWithHotkey", mhk_menu.toggleMiningLayerWithHotkey)
    RegisterEvent("MoreHotkeys.toggleOtherLayerWithHotkey", mhk_menu.toggleOtherLayerWithHotkey)
    RegisterEvent("MoreHotkeys.toggleMenuRightWithHotkey", mhk_menu.toggleMenuRightWithHotkey)
    RegisterEvent("MoreHotkeys.rightInfoWithHotkey", mhk_menu.rightInfoWithHotkey)
    RegisterEvent("MoreHotkeys.rightCrewWithHotkey", mhk_menu.rightCrewWithHotkey)
    RegisterEvent("MoreHotkeys.rightLoadoutWithHotkey", mhk_menu.rightLoadoutWithHotkey)
    RegisterEvent("MoreHotkeys.rightLogbookWithHotkey", mhk_menu.rightLogbookWithHotkey)
    RegisterEvent("MoreHotkeys.rightOrderWithHotkey", mhk_menu.rightOrderWithHotkey)
    RegisterEvent("MoreHotkeys.rightOrderAdvWithHotkey", mhk_menu.rightOrderAdvWithHotkey)
    RegisterEvent("MoreHotkeys.rightStandingOrdersWithHotkey", mhk_menu.rightStandingOrdersWithHotkey)
    RegisterEvent("MoreHotkeys.closeMapWithHotkey", mhk_menu.closeMapWithHotkey)
end

function mhk_menu.openObjectListWithHotkey(_, param)
    local event, component = string.match(param, "(.+):(.+)")
    local convertedcomponent = tonumber(component)
    if event == "onPress" then
		mapMenu.infoTableMode = "objectlist"
        mapMenu.addSelectedComponent(convertedcomponent, true, true)
        mapMenu.infoSubmenuObject = convertedcomponent
--		mapMenu.highlightLeftBar = "objectlist"
		mapMenu.refreshMainFrame = true
--		mapMenu.refreshInfoFrame ()
--		mapMenu.updateMapAndInfoFrame ()
		mapMenu.refreshInfoFrame()
		mapMenu.refreshInfoFrame2()
--		Helper.closeMenuAndOpenNewMenu("MapMenu", "MapMenu", { 0, 0 }, nil)
--		OpenMenu("MapMenu", { 0, 0 }, nil)
    end
end

function mhk_menu.openPropertyOwnedWithHotkey(_, param)
    local event, component = string.match(param, "(.+):(.+)")
    local convertedcomponent = tonumber(component)
    if event == "onPress" then
        mapMenu.infoTableMode = "propertyowned"
        mapMenu.addSelectedComponent(convertedcomponent, true, true)
        mapMenu.infoSubmenuObject = convertedcomponent
		mapMenu.refreshMainFrame = true
--		mapMenu.updateMapAndInfoFrame ()
		mapMenu.refreshInfoFrame()
		mapMenu.refreshInfoFrame2()
    end
end

function mhk_menu.openMissionOffersWithHotkey(_, event)
    if event == "onPress" then
        mapMenu.infoTableMode = "missionoffer"
		mapMenu.refreshMainFrame = true
--		mapMenu.updateMapAndInfoFrame ()
		mapMenu.refreshInfoFrame()
		mapMenu.refreshInfoFrame2()
    end
end

function mhk_menu.openMissionManagerWithHotkey(_, event)
    if event == "onPress" then
		mapMenu.infoTableMode = "mission"
		mapMenu.missionMode = "plot"
		mapMenu.refreshMainFrame = true
--		mapMenu.updateMapAndInfoFrame ()
		mapMenu.refreshInfoFrame()
		mapMenu.refreshInfoFrame2()
    end
end

function mhk_menu.openInfoWithHotkey(_, param)
    local event, component = string.match(param, "(.+):(.+)")
    local convertedcomponent = tonumber(component)
    if event == "onPress" then
        mapMenu.infoTableMode = "info"
        mapMenu.addSelectedComponent(convertedcomponent, true, true)
        mapMenu.infoSubmenuObject = convertedcomponent
		mapMenu.refreshMainFrame = true
--		mapMenu.updateMapAndInfoFrame ()
		mapMenu.refreshInfoFrame()
		mapMenu.refreshInfoFrame2()
    end
end

function mhk_menu.toggleTradeLayerWithHotkey(_, event)
    if event == "onPress" and mapMenu.map then
		mapMenu.buttonSetFilterLayer("layer_trade", 0, 0)
	end
end

function mhk_menu.toggleMiningLayerWithHotkey(_, event)
    if event == "onPress" and mapMenu.map then
		mapMenu.buttonSetFilterLayer("layer_mining", 0, 0)
	end
end

function mhk_menu.toggleOtherLayerWithHotkey(_, event)
    if event == "onPress" and mapMenu.map then
		mapMenu.buttonSetFilterLayer("layer_other", 0, 0)
	end
end

function mhk_menu.toggleMenuRightWithHotkey(_, event)
    if event == "onPress" and mapMenu.map then
		mapMenu.buttonToggleRightBar("info", false)
	end
end

function mhk_menu.rightInfoWithHotkey(_, event)
    if event == "onPress" and mapMenu.map then
		if (not mapMenu.searchTableMode) then
			mapMenu.buttonToggleRightBar("info", false)
		end
		mapMenu.searchTableMode = "info"
		mapMenu.infoMode.right = "objectinfo"
		mapMenu.refreshMainFrame = true
--		mapMenu.refreshInfoFrame()
		mapMenu.refreshInfoFrame2()
	end
end

function mhk_menu.rightCrewWithHotkey(_, event)
    if event == "onPress" and mapMenu.map then
		if (not mapMenu.searchTableMode) then
			mapMenu.buttonToggleRightBar("info", false)
		end
		mapMenu.searchTableMode = "info"
		mapMenu.infoMode.right = "objectcrew"
		mapMenu.refreshMainFrame = true
--		mapMenu.refreshInfoFrame()
		mapMenu.refreshInfoFrame2()
	end
end

function mhk_menu.rightLoadoutWithHotkey(_, event)
    if event == "onPress" and mapMenu.map then
		if (not mapMenu.searchTableMode) then
			mapMenu.buttonToggleRightBar("info", false)
		end
		mapMenu.searchTableMode = "info"
		mapMenu.infoMode.right = "objectloadout"
		mapMenu.refreshMainFrame = true
--		mapMenu.refreshInfoFrame()
		mapMenu.refreshInfoFrame2()
	end
end

function mhk_menu.rightLogbookWithHotkey(_, event)
    if event == "onPress" and mapMenu.map then
		if (not mapMenu.searchTableMode) then
			mapMenu.buttonToggleRightBar("info", false)
		end
		mapMenu.searchTableMode = "info"
		mapMenu.infoMode.right = "objectlogbook"
		mapMenu.refreshMainFrame = true
--		mapMenu.refreshInfoFrame()
		mapMenu.refreshInfoFrame2()
	end
end

function mhk_menu.rightOrderWithHotkey(_, event)
    if event == "onPress" and mapMenu.map then
		if (not mapMenu.searchTableMode) then
			mapMenu.buttonToggleRightBar("info", false)
		end
		mapMenu.searchTableMode = "info"
		mapMenu.infoMode.right = "orderqueue"
		mapMenu.refreshMainFrame = true
--		mapMenu.refreshInfoFrame()
		mapMenu.refreshInfoFrame2()
	end
end

function mhk_menu.rightOrderAdvWithHotkey(_, event)
    if event == "onPress" and mapMenu.map then
		if (not mapMenu.searchTableMode) then
			mapMenu.buttonToggleRightBar("info", false)
		end
		mapMenu.searchTableMode = "info"
		mapMenu.infoMode.right = "orderqueue_advanced"
		mapMenu.refreshMainFrame = true
--		mapMenu.refreshInfoFrame()
		mapMenu.refreshInfoFrame2()
	end
end

function mhk_menu.rightStandingOrdersWithHotkey(_, event)
    if event == "onPress" and mapMenu.map then
		if (not mapMenu.searchTableMode) then
			mapMenu.buttonToggleRightBar("info", false)
		end
		mapMenu.searchTableMode = "info"
		mapMenu.infoMode.right = "standingorders"
		mapMenu.refreshMainFrame = true
--		mapMenu.refreshInfoFrame()
		mapMenu.refreshInfoFrame2()
	end
end

function mhk_menu.closeMapWithHotkey(_, event)
    if event == "onPress" then
		mapMenu.onCloseElement ("close")
		Helper.closeMenu ("MapMenu", "close")
		mapMenu.cleanup ()
    end
end

-- ------------------------------------------------------------------------------------------------



init()
Thanks for answers.

Greetings Trajan von Olb
Mein Traum vom Glück ist der Traum von einer anderen Menschheit. (S. Lem)
kuertee
EGOSOFT
EGOSOFT
Posts: 818
Joined: Sun, 14. Dec 03, 13:05
x4

Re: Note on mods that require UI Extensions

Post by kuertee »

beko wrote: Mon, 9. Dec 24, 22:22 Tried to apply this to `sn_mod_support_apis` and it was a pain in the neck due to my lack of knowledge but I think I got it working.
I'm quite sure the current version of MSAPI works as is.
Its only feature that doesn't work is its Lua Loader component.
So any mod that tries to load its own Lua file via MSAPI's Lua Loader is blocked.
Mods can now load their Lua files via their ui.xml file.

Here's my test:
1. Only v1.9 of MSAPIs and kuertee_test_ui_modding are active in Extensions Menu
Spoiler
Show
Image
kuertee_test_ui_modding is a small mod that I used to test MSAPIs and 7.5 of the base game.
It can be downloaded from here: https://drive.google.com/file/d/1U1fRP7 ... sp=sharing



2. kuertee_test_ui_modding loads a custom lua file via ui.xml that logs all menus loaded by the game. E.g.
Spoiler
Show

Code: Select all

[=ERROR=] 22.96 kuertee_test_ui_modding
[=ERROR=] 22.96 menus registered:
[=ERROR=] 22.96     menu: table: 0x01ae550b6430 menu.name: ChatWindow
[=ERROR=] 22.96     menu: table: 0x01ae55101798 menu.name: CraftingMenu
[=ERROR=] 22.96     menu: table: 0x01ae550e5dc0 menu.name: DockedMenu
[=ERROR=] 22.96     menu: table: 0x01ae5512a830 menu.name: EncyclopediaMenu
[=ERROR=] 22.96     menu: table: 0x01ae551322e8 menu.name: FollowCameraMenu
[=ERROR=] 22.96     menu: table: 0x01ae550afb40 menu.name: HelpMenu
[=ERROR=] 22.96     menu: table: 0x01ae596bcf08 menu.name: MapMenu
[=ERROR=] 22.96     menu: table: 0x01ae596d2f18 menu.name: MapEditorMenu
[=ERROR=] 22.96     menu: table: 0x01ae596e8f28 menu.name: MissionBriefingMenu
[=ERROR=] 22.96     menu: table: 0x01ae596f3f78 menu.name: PlatformUndockMenu
[=ERROR=] 22.96     menu: table: 0x01ae59743188 menu.name: PlayerInfoMenu
[=ERROR=] 22.96     menu: table: 0x01ae59731628 menu.name: ResearchMenu
[=ERROR=] 22.96     menu: table: 0x01ae59750830 menu.name: ScenarioDebriefingMenu
[=ERROR=] 22.96     menu: table: 0x01ae59762358 menu.name: ScenarioSelectionMenu
[=ERROR=] 22.96     menu: table: 0x01ae59769d90 menu.name: ShipComparisonMenu
[=ERROR=] 22.96     menu: table: 0x01ae5987c8b8 menu.name: ShipConfigurationMenu
[=ERROR=] 22.96     menu: table: 0x01ae598d6170 menu.name: StationConfigurationMenu
[=ERROR=] 22.96     menu: table: 0x01ae59909d08 menu.name: StationOverviewMenu
[=ERROR=] 22.96     menu: table: 0x01ae598e4968 menu.name: TerraformingMenu
[=ERROR=] 22.96     menu: table: 0x01ae598e9690 menu.name: TimelineMenu
[=ERROR=] 22.96     menu: table: 0x01ae59929208 menu.name: TopLevelMenu
[=ERROR=] 22.96     menu: table: 0x01ae598f4908 menu.name: kHUD
[=ERROR=] 22.96     menu: table: 0x01ae5990c298 menu.name: BlueprintOrLicenceTraderMenu
[=ERROR=] 22.96     menu: table: 0x01ae59bb0420 menu.name: InventoryTraderMenu
[=ERROR=] 22.96     menu: table: 0x01ae59bbd4e0 menu.name: TransactionLogMenu
[=ERROR=] 22.96     menu: table: 0x01ae59bb16e0 menu.name: TransporterMenu
[=ERROR=] 22.96     menu: table: 0x01ae59bc7e58 menu.name: UserQuestionMenu
[=ERROR=] 22.96     menu: table: 0x01ae59acb220 menu.name: OptionsMenu
[=ERROR=] 22.96     menu: table: 0x01ae59bff6b0 menu.name: CustomGameMenu
[=ERROR=] 22.96     menu: table: 0x01ae59bdb988 menu.name: GameModifiedMenu
[=ERROR=] 22.96     menu: table: 0x01ae59b3fc30 menu.name: OnlineUpdateMenu
[=ERROR=] 22.96     menu: table: 0x01ae59baa9d0 menu.name: InteractMenu
[=ERROR=] 22.96     menu: table: 0x01ae59c7a8c0 menu.name: MovieMenu


3. And then when a game is started, I tested MSAPI's Interact Menu API.
When right-clicking on a ship, a custom Interact Menu Action is listed as "MSAPIs InteractMenu".
Spoiler
Show
Image
kuertee
EGOSOFT
EGOSOFT
Posts: 818
Joined: Sun, 14. Dec 03, 13:05
x4

Re: Note on mods that require UI Extensions

Post by kuertee »

Hey Trajan!
Trajan von Olb wrote: Fri, 13. Dec 24, 14:42 If I make calls in my mod like:
Spoiler
Show

Code: Select all

    <cue name="Mhk_at_OnLuaLoaderReady">
      <conditions>
        <event_ui_triggered screen="'Lua_Loader'" control="'Ready'" />
      </conditions>
      <actions>
        <raise_lua_event name="'Lua_Loader.Load'" param="'extensions.tvo_more_hotkeys_adv_targeting.ui.more_hotkeys_adv_targeting'"/>
      </actions>
    </cue>
will they continue to work without changes?

OR What exactly do I have to change?

And what about the LUA scripts? Do I have to change anything there too? In most cases it concerns the targeting system (i.e. switching on a target) or the direct access to Egosoft menus:[/
MSAPI's Lua Loader is now restricted in 7.5.
Custom Lua files now need to be loaded via the mod's ui.xml file - as originally intended.
Here's that UI Modding Test mod that I shared in the post above that you can examine: https://drive.google.com/file/d/1U1fRP7 ... sp=sharing

local Lib = require("extensions.sn_mod_support_apis.lua_library")
I'm not 100% sure but this will likely not work anymore with 7.5.
From my little tests, the require() function is now limited.
mapMenu = Lib.Get_Egosoft_Menu("MapMenu")
To access base-game lua files, we can now use the new Helper.getMenu("MapMenu") command.
e.g. mapMenu = Helper.getMenu("MapMenu")

So that's for starters in regards to your hotkey mods.
As for the hotkeys themselves ... I'm not entirely sure.
Pre v1.9 of MSAPIs, hotkeys were managed via MSAPIs Pipe Server.
But as of v1.89/v1.9 of MSAPIs, MSAPI's hotkeys were disabled - for future re-build/re-activation, as far as I can remember.

I've not looked into setting up custom hotkeys natively with 7.5.
azaghal
Posts: 393
Joined: Wed, 21. Mar 07, 13:19
xr

Re: Note on mods that require UI Extensions

Post by azaghal »

kuertee wrote: Sat, 14. Dec 24, 02:39 I've not looked into setting up custom hotkeys natively with 7.5.
Kinda popping in here a bit randomly - but is it even possible to have the game itself handle custom hotkeys without having to run an external app that communicates over a pipe (the way mods currently do it)? Or am I misunderstanding what "natively" means in this context?

Best regards,
Branko

P.S.
Btw, kudos on all the QoL mods you have implemented - I really wish most of them were part of the base game. :)
Dex101
Posts: 2
Joined: Sat, 3. Aug 19, 15:16
x4

Re: Note on mods that require UI Extensions

Post by Dex101 »

Hi kuertee, REALSPACE (Eucharion?), all,

Apologies in advance if I'm overlooking the obvious due to ignorance:

In the current Beta was trying to find the cause for not being able to increase the size of a station plot. Ended up tracing it to SN Mod Support APIs and UI Extensions and HUD.

Given the amount of mods that depend on these two mods alone, wouldn't it be possible to agree between Egosoft, SirNukes, kuertee and maybe other parties for the functionality provided by these crucial mods to be provided by the game itself?

Thank you Egosoft for the game and all of your mods that add to it.
Chryssie
Posts: 1
Joined: Sat, 25. Jul 20, 07:16
x4

Re: Note on mods that require UI Extensions

Post by Chryssie »

kuertee wrote: Sat, 14. Dec 24, 02:26 I'm quite sure the current version of MSAPI works as is.
Its only feature that doesn't work is its Lua Loader component.
So any mod that tries to load its own Lua file via MSAPI's Lua Loader is blocked.
Mods can now load their Lua files via their ui.xml file.
Hey, I wanted to check. Does this mean that that `require` cannot be used at all, even for scripts already loaded via the `ui.xml`? I ask because I tried to get sn_mod_support_apis working with protected UI and I managed to get it working, but I had to replace the `require` statements (and the `return` statements for those) to be global variables which seems less than ideal. I work with C# mostly and am unfamiliar with lua so I might have something.
Scoob
Posts: 11170
Joined: Thu, 27. Feb 03, 22:28
x4

Re: Note on mods that require UI Extensions

Post by Scoob »

Hi,

I use a selection of mods that rely on SirNukes Support APIs. Having protected mode OFF, allows the Extension Options menu entry to be displayed, so I can configure things as I wish. However, this of course causes various issues during regular game-play. So, what I've been doing - I was just testing stuff, not playing properly - is to re-enabled protected mode once I've tweaked things to my liking. Of course the menu option then disappears, but the mod is still doing its thing gameplay-wise, plus I don't have those weird UI gremlins.

So, what I did seems to work - disable protect mode to set things up, enable it again when playing - but I don't know if it's really that simple, or if other things might break. For my specific mods, this works, but then none of my mods add extra in-game menu options - i.e. additional ship interactions and orders - they're just about extra main menu entries to allow mod configuration.

Hopefully SirNukes stuff will be updated when he's able, but for the time being, I think my work-around is working for me. I'm yet to try it in a "proper" new game though, outside of testing. I'm hoping to continue my v7.1 HF3 ReEmergence (and other mods) game in v7.5. Most stuff is updated, it's just SirNukes Support API's that haven't been yet.

In the meantime, I've been playing SWI for v7.5, which is very different but fun.
kuertee
EGOSOFT
EGOSOFT
Posts: 818
Joined: Sun, 14. Dec 03, 13:05
x4

Re: Note on mods that require UI Extensions

Post by kuertee »

azaghal wrote: Fri, 27. Dec 24, 23:11 Kinda popping in here a bit randomly - but is it even possible to have the game itself handle custom hotkeys without having to run an external app...
Best regards,
Branko
Unfortunately, it's not. We'll need to wait for MSAPI to get its Named Pipes and Hotkeys functionality working again.


Dex101 wrote: Mon, 27. Jan 25, 15:57 Hi kuertee, REALSPACE (Eucharion?), all, Apologies in advance if I'm overlooking the obvious due to ignorance: In the current Beta was trying to find the cause for not being able to increase the size of a station plot. Ended up tracing it to SN Mod Support APIs and UI Extensions and HUD.
Sorry for the delay. It definitely was a bug in that beta version of UI Extensions (UIX). That bug should be fixed in final 7.5.03 version of UIX.


Chryssie wrote: Sun, 2. Mar 25, 01:17 Hey, I wanted to check. Does this mean that that `require` cannot be used at all, even for scripts already loaded via the `ui.xml`? I ask because I tried to get sn_mod_support_apis working with protected UI and I managed to get it working, but I had to replace the `require` statements (and the `return` statements for those) to be global variables which seems less than ideal. I work with C# mostly and am unfamiliar with lua so I might have something.
That's correct. All custom lua files should be loaded via the mod's ui.xml.
You shouldn't need to change MSAPI to get general mods (e.g. my mods that need it, Forleyor's Info Centre, Mycu's various UI mods, etc) to work.


Scoob wrote: Mon, 3. Mar 25, 14:39 Hi,

I use a selection of mods that rely on SirNukes Support APIs. Having protected mode OFF, allows the Extension Options menu entry to be displayed, so I can configure things as I wish. However, this of course causes various issues during regular game-play. So, what I've been doing - I was just testing stuff, not playing properly - is to re-enabled protected mode once I've tweaked things to my liking. Of course the menu option then disappears, but the mod is still doing its thing gameplay-wise, plus I don't have those weird UI gremlins.
You will find other "weird" things.
E.g. I started finding that my personal uidata.xml wasn't getting accessed. uidata.xml stores, amongst other things, your Map Menu filter settings.
So, what I did seems to work - disable protect mode to set things up, enable it again when playing - but I don't know if it's really that simple, or if other things might break. For my specific mods, this works, but then none of my mods add extra in-game menu options - i.e. additional ship interactions and orders - they're just about extra main menu entries to allow mod configuration.
From what I saw in my tests (wasn't conclusive as I was playing and modding rather than finding exactly what is happening), is that the callbacks provided by UIX stopped working.
Without those callbacks, mods that require them (e.g. Forleyor's Info Centre, Mycu's Equipment Tool Tips, etc.) wouldn't work.





Sorry for my delayed response everyone! Was busy with things including updates to my AI mod, Kuda - which requires a bit more of my attention than my other mods.
Scoob
Posts: 11170
Joined: Thu, 27. Feb 03, 22:28
x4

Re: Note on mods that require UI Extensions

Post by Scoob »

kuertee wrote: Thu, 6. Mar 25, 07:15 You will find other "weird" things.
E.g. I started finding that my personal uidata.xml wasn't getting accessed. uidata.xml stores, amongst other things, your Map Menu filter settings.
Thanks for the reply.

I read elsewhere that people are saying that installing your UI Extensions mod - even if using nothing that strictly needs it - "fixes" things that rely on SirNukes Support API. I've not tried it myself yet. So, while my work-around allowed me to avoid some of the issue by toggling Protected Mode On or Off, BUT could still see me having weird issues as you mention. Simply adding your UI Extensions would resolve that. Like I said, I read this in a comment on SirNukes Nexus page for the support API.
Realspace
Posts: 1637
Joined: Wed, 15. Nov 06, 10:21
x4

Re: Note on mods that require UI Extensions

Post by Realspace »

Maybe is a bad idea but given that we don't know when the sn api will be updated, would it be possible to add some config file with clear explainations of what can be changed and what not, in the md folder of those mods of yours that do not strictly require it? I use trade analytics which works fine without sn api and requires no settings, but also friendly fire which I remember had some settings in the ui, and teleport from room which has too. I'd like to use Social St. and Citizenship too which maybe works without sn api but had lot of configs. I see a config file there but is quite complex :)

Return to “X4: Foundations - Scripts and Modding”