2.5 UI and Modding
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 5625
- Joined: Sat, 10. Nov 12, 17:55
2.5 UI and Modding
Does anyone know about this? If new ui will be easier/possible to mod?
-
- Posts: 1277
- Joined: Tue, 13. Dec 11, 08:27
-
- Posts: 2774
- Joined: Tue, 29. Oct 13, 21:59
I'd quite like to know this too. Assuming it's reasonably straightforward I'll be adding it to a couple of my mods that currently rely on the radial menu. If it's not straightforward I'll post back with anything I find.
X Rebirth - A Sirius Cybernetics Corporation Product
Split irritate visiting pilot with strange vocal patterns.
Split irritate visiting pilot with strange vocal patterns.
-
- Posts: 5625
- Joined: Sat, 10. Nov 12, 17:55
Since patchnotes are already posted im not that sure about this. Also no idea what is covered by the NDA, so i just ask anyway. Maybe someone posts who actually has something to say.jack775544 wrote:Since the 2.5 beta is still private, and that is covered by an NDA, the only answer is a definite 'maybe'.
@YorrickVander: thanks, appreciated.
-
- Posts: 2774
- Joined: Tue, 29. Oct 13, 21:59
Looks like the sidebar is lua. Looking at it now decompiled with NightNord's tool.
EDIT :
Confirming Lua only as of 2.5 rc6 for sidebar modding
This means mods with menus are currently forced to use the legacy menu as we can't diff patch the compiled xpl files for our mods to play nice together.
As a test I added a YAT entry into the sidebar with
Which calls the radial for YAT when selected 
http://i.imgur.com/odxkxxG.jpg
EDIT :
Confirming Lua only as of 2.5 rc6 for sidebar modding

As a test I added a YAT entry into the sidebar with
Code: Select all
{
icon = "mm_ic_trading",
name = ReadText(1002, 1005),
list = {
{
section = "gTrade_offerselect",
icon = "mm_ic_trading",
name = ReadText(1001, 1113),
sectionparam = {
0,
0
},
info = ReadText(1002, 21047)
},
{
section = "gYorrick_TradeMenu",
icon = "mm_ic_trading",
name = "YAT",
sectionparam = {
0,
0
},
info = "Yet Another Trader"
}
}
},

http://i.imgur.com/odxkxxG.jpg
X Rebirth - A Sirius Cybernetics Corporation Product
Split irritate visiting pilot with strange vocal patterns.
Split irritate visiting pilot with strange vocal patterns.
-
- Posts: 158
- Joined: Sun, 20. Jun 04, 03:24
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
seems like currently not in the new Sidebar, but there is still the option to use the old legacy menu ^^Ginger470 wrote:Hi Yorrick,
Haven't had time to look at the new codebase yet, but are you saying that we can no longer add menu options to the existing trees like we could before using the MainMenu.xml and <add_player_choice> ?
Thanks
btw: @yorrick: wouldnt it be also a temporary solution for everyone to place a call to the Legacy Main Menu in the new Sidebar to access Mod functionality in the old Menu without completely switching to it?
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help

-
- Posts: 2774
- Joined: Tue, 29. Oct 13, 21:59
@uni - Yeah that's doable. To add that part to the lua and distribute as a mod you will need to decompile mainmenu.xpl, add your reference, and add the lua back by recompiling or renaming that file to .xpl and distributing as a mod wrapped in subst01.cat/dat pair. This means of course that each mod would overwrite others entries unless we all got together to make a common .xpl to use for several mods simultaneously 
Euclid found a way around it for his jump mod + autotrader but again, these methods will be limited to his mod only.
We haven't actually lost anything here, the legacy menu is fast and snappy to use now but I'm really suprised at ES for making such a modder unfriendly change.
EDIT : to clarify a point - the new menu is one big lua file, not 1 per button which would make modding and adding menus that much easier. The best we could likely do is port BK's universal comm menu to it and hook in that way.
Tbh just adding the radial seems fruitless as we can just turn it on in game settings anyway.

Euclid found a way around it for his jump mod + autotrader but again, these methods will be limited to his mod only.
We haven't actually lost anything here, the legacy menu is fast and snappy to use now but I'm really suprised at ES for making such a modder unfriendly change.
EDIT : to clarify a point - the new menu is one big lua file, not 1 per button which would make modding and adding menus that much easier. The best we could likely do is port BK's universal comm menu to it and hook in that way.
Tbh just adding the radial seems fruitless as we can just turn it on in game settings anyway.
X Rebirth - A Sirius Cybernetics Corporation Product
Split irritate visiting pilot with strange vocal patterns.
Split irritate visiting pilot with strange vocal patterns.
-
- Posts: 2774
- Joined: Tue, 29. Oct 13, 21:59
There are list params that need some investigation list1ButtonScripts and list2ButtonScripts that might be useful. More time digging and testing required. These may simply be for the top + bottom sections - reading code over breakfast isn't my best time of day
-wanders off to remove pyjama anorak-

X Rebirth - A Sirius Cybernetics Corporation Product
Split irritate visiting pilot with strange vocal patterns.
Split irritate visiting pilot with strange vocal patterns.
-
- Posts: 3354
- Joined: Wed, 6. Nov 02, 20:31
Lua has the "require" or "dofile"-functions to load other lua files into the running lua file.YorrickVander wrote:EDIT : to clarify a point - the new menu is one big lua file, not 1 per button which would make modding and adding menus that much easier. The best we could likely do is port BK's universal comm menu to it and hook in that way.
Wouldn't it be possible to split the menu open into several small lua-files (each containing a seperate sub-menu) and let the game combine them via require/dofile-function?
-
- Posts: 5625
- Joined: Sat, 10. Nov 12, 17:55
Thanks for the info! Hope one day ES will have the time to support modding UI. It's nice to be able to link in the new menu, but if mods have to overwrite eachother's changes, it won't really help that much.
Maybe ES doesn't even want any big and popular mods around before they can get XR in release state.
Maybe ES doesn't even want any big and popular mods around before they can get XR in release state.
-
- Posts: 3354
- Joined: Wed, 6. Nov 02, 20:31
Actually, if its possible to require several lua files with the main menu lua file then it's highly modable because with functions like "table.insert(table, {<content>})" command people could create as many additional entries into the menu as they like.
Since table.insert() does not require a specific index number (unlike the xml-menu which, if i remember correctly, required the modders to point out the exact command slot they want their mod to use, from 1 to 6) mods wouldn't conflict at all, at least no conflicts with command slots.
If 6 entries are taken and another mod gets loaded with "require" and the entries get inserted with "table.insert()" it'll just create a 7th slot automatically.
That is course only if the menu supports all lua features (like require and table inserting).
Since table.insert() does not require a specific index number (unlike the xml-menu which, if i remember correctly, required the modders to point out the exact command slot they want their mod to use, from 1 to 6) mods wouldn't conflict at all, at least no conflicts with command slots.
If 6 entries are taken and another mod gets loaded with "require" and the entries get inserted with "table.insert()" it'll just create a 7th slot automatically.
That is course only if the menu supports all lua features (like require and table inserting).
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
you could omit the slot number to use the next-best free one, but most menus are already pretty crowded and were limited to 6 slots...Rei Ayanami wrote:Since table.insert() does not require a specific index number (unlike the xml-menu which, if i remember correctly, required the modders to point out the exact command slot they want their mod to use, from 1 to 6) mods wouldn't conflict at all, at least no conflicts with command slots.
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help

-
- Posts: 335
- Joined: Mon, 23. Apr 12, 23:56
Sooo, I found a solution to add new entries to the menu, generically as a mod, so everone can add new some, without shutting others out. But, alas, as I extended the (decompiled) original Lua mainmenu, I wanted to be sure that I am allowed to publish it? I mean, it was compiled for a reason I think, I don't want to break any copyright
-
- Posts: 2774
- Joined: Tue, 29. Oct 13, 21:59
Nicely done Phipsz
No reason not to publish lua mods, I've had one out there for a bit (Galaxy Station Range) with no complaints. The trick is to just rename the .lua to .xpl before adding to subst_01.cat/dat or the replacement doesn't work correctly in mod form. Look forward to seeing what you did with it.

No reason not to publish lua mods, I've had one out there for a bit (Galaxy Station Range) with no complaints. The trick is to just rename the .lua to .xpl before adding to subst_01.cat/dat or the replacement doesn't work correctly in mod form. Look forward to seeing what you did with it.
X Rebirth - A Sirius Cybernetics Corporation Product
Split irritate visiting pilot with strange vocal patterns.
Split irritate visiting pilot with strange vocal patterns.
-
- Posts: 335
- Joined: Mon, 23. Apr 12, 23:56
here it is then for now: http://www.nexusmods.com/xrebirth/mods/414/? I hope any questions for usage are answered by the examples 

-
- Posts: 2774
- Joined: Tue, 29. Oct 13, 21:59
-
- Posts: 335
- Joined: Mon, 23. Apr 12, 23:56
Thanks
it's in steamworkshop now as well: http://steamcommunity.com/sharedfiles/f ... =310835139

-
- Posts: 136
- Joined: Tue, 21. Nov 06, 13:58
I played a bit with the new sidebar and found the following way of inserting new entries without the need to modify the original file:
inside /ui/addons/mainmenu create a new .lua file with the following contents:
Explanation:
menuAddon: variable that holds the new menu entry
function createSetupAddMissionComputer: walks through the menu setup and inserts the new entry at the right position
function createSetupWrapper: this function replaces the original createSetup function. It first calls the original function and then createSetupAddMissionComputer to add the custom entry
function init: is called at the start and finds the main menu in the list of registered menus. Then it saves the original function createSetup (from mainmenu.lua/xpl) and replaces it with createSetupWrapper.
I have tested it and it worked so far, should also work with multiple mods adding menu entries. Just make sure that your lua file is added in the mainmenu.xml AFTER the mainmenu.xpl line (in the hope that the files are processed in that order, so that the main menu is already initialized)
But i have another problem with the lua code: has someone already managed to check whether some software is installed on the player ship? In MD you do something like this:
I have not yet found the equivalent lua function call for that.
inside /ui/addons/mainmenu create a new .lua file with the following contents:
Code: Select all
local menuAddon = {
entry = {
section = "gMainMission_MissionComputer",
icon = "mm_ic_info_missionmanager",
name = ReadText(1000001, 1),
sectionparam = {
0,
0
},
info = ReadText(1000001, 4)
}
}
local function createSetupAddMissionComputer(menu)
for _, subMenu in ipairs(menu.setup.top) do
if subMenu.icon == "mm_ic_info_missionmanager" then
table.insert(subMenu.list, menuAddon.entry)
end
end
end
local function createSetupWrapper()
menuAddon.origCreateSetup()
createSetupAddMissionComputer(menuAddon.menu)
end
local function init()
if Menus then
for _, menu in ipairs(Menus) do
if menu.name == "MainMenu" then
menuAddon.menu = menu
menuAddon.origCreateSetup = menu.createSetup
menu.createSetup = createSetupWrapper
break
end
end
end
end
init()
menuAddon: variable that holds the new menu entry
function createSetupAddMissionComputer: walks through the menu setup and inserts the new entry at the right position
function createSetupWrapper: this function replaces the original createSetup function. It first calls the original function and then createSetupAddMissionComputer to add the custom entry
function init: is called at the start and finds the main menu in the list of registered menus. Then it saves the original function createSetup (from mainmenu.lua/xpl) and replaces it with createSetupWrapper.
I have tested it and it worked so far, should also work with multiple mods adding menu entries. Just make sure that your lua file is added in the mainmenu.xml AFTER the mainmenu.xpl line (in the hope that the files are processed in that order, so that the main menu is already initialized)
But i have another problem with the lua code: has someone already managed to check whether some software is installed on the player ship? In MD you do something like this:
Code: Select all
<find_object_component name="$checkMissionComputer" object="player.primaryship" macro="macro.software_cf_mission_computer_macro"/>
-
- Posts: 2774
- Joined: Tue, 29. Oct 13, 21:59
It's an interesting method - you should also take a look at Phipsz' mod on workshop, Sidebar Extender, that allows for custom entries and new buttons to be added with a simple file addition to the target mods main dir.
X Rebirth - A Sirius Cybernetics Corporation Product
Split irritate visiting pilot with strange vocal patterns.
Split irritate visiting pilot with strange vocal patterns.