UI modding - support thread

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

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

blackmilan
Posts: 124
Joined: Sat, 22. Jan 11, 21:13
xr

Post by blackmilan » Mon, 2. Mar 15, 18:14

Another surprise? I have to say Christmas for modders is really early this year :-) The Wiki looks great!

I am totally fine with your approach. Thanks for updating my JIRA ticket and considering an update of the filter functionalityin the trade menu. This is the only concrete case I have right now and I agree you should not waste time on code which is not used in mods.

stefanEgo
Posts: 545
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo » Tue, 3. Mar 15, 11:05

@blackmilan: XRUIMOD-16 should be fixed in the next version
@YorrickVander: What exactly do you mean by "Lua as a function or as a mod 'script'"? Are you suggesting a facility which allows you to copy/paste Lua code into the game directly and have it executed? If so, then this should in principle be achievable by writing your own mod. The only thing which might be missing would be a function to paste the text into the game (atm only copying to the clipboard is possible). Is that what you have in mind?
Stefan Hett

stefanEgo
Posts: 545
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo » Tue, 3. Mar 15, 13:42

We've also just added a page which shows the changelog of UI modding changes as a shortcut to get a quick overview of what's going on atm as well as what was done in older versions: https://www.egosoft.com:8444/confluence ... /Changelog
Stefan Hett

stefanEgo
Posts: 545
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo » Tue, 3. Mar 15, 15:50

@wysiwyg: in the next build we added support for single addons to run in multiple environments and also specify dependencies based on the environment. That should restore (and actually even extend) the same functionality which was possible in 3.20.

Please note that this will impose a breaking change of existing addons unfortunately, since we changed the ui.xml format slightly. The change is recorded here: https://www.egosoft.com:8444/confluence ... .50+Beta+2
Stefan Hett

stefanEgo
Posts: 545
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo » Tue, 3. Mar 15, 16:35

@Phipsz/wysiwyg: The described workaround (adding a subdirectory called ui/addons/ego_xxx/ui.xml) doesn't seem to work here. Can you provide test-files which work for you?
Stefan Hett

User avatar
YorrickVander
Posts: 2701
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander » Tue, 3. Mar 15, 18:12

@stefan - no mate, as I said, in a similar way to which compiled c can be used from python scripts. To elaborate - say there's a function/mod i want to write that is best achieved in lua, but i currently cannot do that unless i am running that lua code as part of a detail monitor menu. Are there any plans to make this possible?
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

Phipsz
Posts: 335
Joined: Mon, 23. Apr 12, 23:56
x4

Post by Phipsz » Tue, 3. Mar 15, 18:48

@stefan: simply adding a folder didn't work for me either, but adding a ui/addons/ego_* folder with ui.xml etc in a subst_01.cat worked for me. Don't know if it still works, as I ported my mods already to the official structure. If there should still be need of an example I can see if I can upload a previous version of any of my mods tomorrow.

@yorrick: you could create a fake menu that you call from md. this fake menu would need to have Helper.closeMenuAndCancel as last action of menu.onShowMenu (don't know if these are completely correct, have no examples on current pc) that way you could include lua into md while that menu closes itself

stefanEgo
Posts: 545
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo » Wed, 4. Mar 15, 09:03

@Phipsz: I'c. using the substitution facility for this was the missing link. Thanks for clarifying.

@YorrickVander: Pardon me, but still having difficulties fully getting what you mean here... By adding a Lua file to any addon, all the code which is inside the Lua file is executed on load (which normally is at the time the game starts). So if you write the following code:

Code: Select all

function foo()
-- do whatever you wanna do here
end

foo()
your function foo will be executed on load directly.
If you want to execute that upon some other trigger, you have different possibilities to do so. One example was given by Phipsz. Another example is to execute the function/code on a timely manner or upon certain gamestates, in which case you have the onUpdate()-function you could use. The onUpdate() function is executed every frame, so you could implement the trigger condition like:

Code: Select all

function onUpdate()
-- if I'm in a ship and being attacked by drones then
foo()

-- or alternatively to call ur function every 200 frames
int count = 0
function onUpdate()
  if count == 200
    foo()
    count = 0
  else
    count = count + 1
  end
end

function init()
-- create your frame
SetScript(myFrame, "onUpdate", onUpdate)
Do u mean that atm you lack the possibilitiy to execute scripts upon keypresses directly? Aka you would like to execute your function foo() when you press "k" for instance?
Last edited by stefanEgo on Wed, 4. Mar 15, 10:30, edited 1 time in total.
Stefan Hett

User avatar
YorrickVander
Posts: 2701
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander » Wed, 4. Mar 15, 09:46

I had meant as a function call from xml, but the onupdate method might well be a viable workaround, i hadn't considered it before.
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

stefanEgo
Posts: 545
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo » Wed, 4. Mar 15, 10:41

@YorrickVander: Thanks for clarifying what you mean. Now I got it. We are considering improving the interfacing between the UI and MD at some point. I've created a JIRA issue for that feature request: https://www.egosoft.com:8443/jira/browse/XRUIMOD-19

@all: We've also updated Lua/FFI function overview in Confluence. It should be easier to get an overview of the available functions now. See https://www.egosoft.com:8444/confluence ... n+overview and https://www.egosoft.com:8444/confluence ... n+overview
Stefan Hett

User avatar
wysiwyg
Posts: 585
Joined: Thu, 26. Feb 04, 00:08
x4

Post by wysiwyg » Wed, 4. Mar 15, 22:15

stefanEgo wrote:@wysiwyg: in the next build we added support for single addons to run in multiple environments and also specify dependencies based on the environment. That should restore (and actually even extend) the same functionality which was possible in 3.20.

Please note that this will impose a breaking change of existing addons unfortunately, since we changed the ui.xml format slightly. The change is recorded here: http://www.egosoft.com:8292/confluence/ ... .50+Beta+2
Seems to be working fine - Many thanks for the continued updates.

Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Post by Vim Razz » Thu, 5. Mar 15, 00:36

I'm still digesting all of this -- the new amount of information you guys are making available is amazing.

Is there any chance we might get a few more input options for menu button hotkeys in the future? I've got a few in mind that I'd really love to see:

INPUT_STATE_DETAILMONITOR_PGUP
INPUT_STATE_DETAILMONITOR_PGDN
INPUT_STATE_DETAILMONITOR_HOME
INPUT_STATE_DETAILMONITOR_END

stefanEgo
Posts: 545
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo » Thu, 5. Mar 15, 09:44

@wysiwyg: thanks for the update
@Vim Razz: input handling is really a bit limited atm, unfortunately - I've added a feature request to the bugtracker for you ( http://www.egosoft.com:8282/jira/browse/XRUIMOD-20 ), but can't give an ETA
Stefan Hett

stefanEgo
Posts: 545
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo » Thu, 5. Mar 15, 11:39

@Phipsz: FYI in the next 3.50 build, the "workaround" you suggested will no longer work, since all the cases for which you previously had to use the subst-catalog-files should now be properly supported by the engine (see: https://www.egosoft.com:8444/confluence ... .50+Beta+3)
Please let us know if you still run into a case which seems to not be possible without the subst-catalog-files, so we can resolve that in time for 3.50.
@YorrickVander: In the next build we added a new MD action called "raise_lua_event". That should allow you to send data from MD to Lua scripts as well as being used as a trigger for any kind of functionality. Please let us know if that does not solve the case for you.
Stefan Hett

User avatar
YorrickVander
Posts: 2701
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander » Thu, 5. Mar 15, 12:02

Sounds great Stefan, thanks :)
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13292
Joined: Sun, 15. Feb 04, 20:12
x4

Post by euclid » Thu, 5. Mar 15, 14:42

stefanEgo wrote: ......In the next build we added a new MD action called "raise_lua_event". That should allow you to send data from MD to Lua scripts as well as being used as a trigger for any kind of functionality.
......
That sounds good! As you know I'd like to access data which are not available via MD/XML script commands, for example "GetProductionModuleData". Looking forward to test this new command.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Post by Vim Razz » Fri, 6. Mar 15, 06:27

@stephan -- I was just wondering about the possibility. Thank you for taking the time to add the feature request!


And I'll join the chorus of "wow, sounds great!" at the exploring the possibilities of a raise-lua-event MD function. I currently use a MD-script based system for determining whether certain mods are active or not to make compatibility adjustments in my own project, but have been thinking of switching to a LUA-based extension lookup system instead. The possibility of doing that without having to pop open another fake menu is very appealing.

bm01
Posts: 421
Joined: Wed, 22. Jul 09, 22:31
x4

Post by bm01 » Sat, 7. Mar 15, 13:54

Thank you very much for http://www.egosoft.com:8282/jira/browse/XRUIMOD-6, this is exactly what I asked for in my old post. I was afraid I would have to provide a second mod just for one part of "my" UI.

Also, sorry if it has already be mentioned, but it seems that the ui.xml file isn't uploaded to the Steam Workshop.

cyberfuzzie
Posts: 134
Joined: Tue, 21. Nov 06, 13:58
x4

Post by cyberfuzzie » Sat, 7. Mar 15, 14:47

I put the ui.xml file in my ext_01.cat/dat and it worked fine.

Phipsz
Posts: 335
Joined: Mon, 23. Apr 12, 23:56
x4

Post by Phipsz » Sat, 7. Mar 15, 15:29

bm01 wrote:Also, sorry if it has already be mentioned, but it seems that the ui.xml file isn't uploaded to the Steam Workshop.
Yes, it's quite sad the workshoptool does not automatically pack the ui.xml into the cat with -buildcat (or -buildvcat either) now that I don't even have to add subst_01.cat to mods anymore. while manually packing the files is working fine, it would be more convenient and consistent if the workshoptool would not ignore the ui.xml. workshoptool also has another problem regarding contributor rights I reported a few days ago in the rebirth tools discussion (but sadly got no answer yet.)

Post Reply

Return to “X Rebirth - Scripts and Modding”