UI modding - support thread

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

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

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

Post by blackmilan » Mon, 2. Mar 15, 19: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
EGOSOFT
EGOSOFT
Posts: 501
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo » Tue, 3. Mar 15, 12: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, Engine Architect

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

Post by stefanEgo » Tue, 3. Mar 15, 14: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, Engine Architect

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

Post by stefanEgo » Tue, 3. Mar 15, 16: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, Engine Architect

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

Post by stefanEgo » Tue, 3. Mar 15, 17: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, Engine Architect

User avatar
YorrickVander
Posts: 2672
Joined: Tue, 29. Oct 13, 22:59
x4

Post by YorrickVander » Tue, 3. Mar 15, 19: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: 246
Joined: Mon, 23. Apr 12, 23:56
x4

Post by Phipsz » Tue, 3. Mar 15, 19: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
EGOSOFT
EGOSOFT
Posts: 501
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo » Wed, 4. Mar 15, 10: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, 11:30, edited 1 time in total.
Stefan Hett, Engine Architect

User avatar
YorrickVander
Posts: 2672
Joined: Tue, 29. Oct 13, 22:59
x4

Post by YorrickVander » Wed, 4. Mar 15, 10: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
EGOSOFT
EGOSOFT
Posts: 501
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo » Wed, 4. Mar 15, 11: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, Engine Architect

User avatar
wysiwyg
Posts: 584
Joined: Thu, 26. Feb 04, 01:08
x4

Post by wysiwyg » Wed, 4. Mar 15, 23: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: 1837
Joined: Tue, 2. Nov 10, 03:20
x4

Post by Vim Razz » Thu, 5. Mar 15, 01: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
EGOSOFT
EGOSOFT
Posts: 501
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo » Thu, 5. Mar 15, 10: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, Engine Architect

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

Post by stefanEgo » Thu, 5. Mar 15, 12: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, Engine Architect

User avatar
YorrickVander
Posts: 2672
Joined: Tue, 29. Oct 13, 22:59
x4

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

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

Split irritate visiting pilot with strange vocal patterns.

Post Reply

Return to “X Rebirth - Scripts and Modding”