UI modding - support thread

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

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

FantasyWarrior
Posts: 29
Joined: Sun, 24. Jul 16, 18:43

Post by FantasyWarrior » Mon, 25. Jul 16, 08:55

OMG it work !!! :o

Thanks a lot :D


Well, this game is interesting and elitist about modding and of course i like it, i return back soon...
I have a lot of work with the HUD ^^

FantasyWarrior
Posts: 29
Joined: Sun, 24. Jul 16, 18:43

Post by FantasyWarrior » Fri, 5. Aug 16, 00:55

Please, it is possible to modify a material like "cockpit_eventmonitor" (i would a transparent effect for the radar) or it is hard coded ? :l

And i 've tried to change the shield icon too, it work but the bars are deactivated...

Maybe the same ui script for cockpit_eventmonitor / shield icon, if i place a patch with new textures, these elements are broken...


edit, maybe it's in a patch...

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

Post by stefanEgo » Mon, 8. Aug 16, 17:43

Modding the eventmonitor and/or ship status panel is unsupported, unfortunately.

That said, as a workaround you could try making use of substitution catalog files to replace the corresponding textures/scripts (the Lua scripts can be replaced by copying the *.lua file to *.xpl). The downside would be that for each version update, you'd have to provide an update for your mod, since these scripts could be changed in a patch release. Also be aware that this is a completely unsupported process which might be broken by any following update!

The eventmonitor panel is more complicated than you might expect. There is not just one material involved but rather different layers/materials. One material is the cockpit_eventmonitor (and for another cockpit the cockpit_eventmonitor_cockpit_b). You can try tweaking its parameters to see if you can get somewhere for your case.

With regards to the issue with replacing the shield icons: Take a look at the debug log in game. I'd expect you see some error output related to the broken shield/hull bars there.
Stefan Hett

FantasyWarrior
Posts: 29
Joined: Sun, 24. Jul 16, 18:43

Post by FantasyWarrior » Sun, 14. Aug 16, 18:15

Thank you !

I have discovered everything you said by myself ^^ lua file, ect...

I was try to make a patch for Cockpit Shipstatus.lua, maybe something like

Code: Select all

<diff>
 < replace>
   </replace>
</diff>

And...a lot of other things , folders...


Well Actualy, I LOVE this game :!:

Of course, the modding is not simple :l i've just made :
80% of the textures hd, sounds, musics, reworked cockpit_b, and i have a lot of other mods.


0 % of B-U-G !!!!!

Now, i just need to put the new shield icon, add a glass for cockpit b, if i can rework the cockpit b a little more...

:!: For info : no crash with windows 7/ 64 bits 8G RAM and 80% of new textures 2048 -> 4096, and the same performances !



edit: my version, with the holographic hud ^^ (not finished).


http://tw.greywool.com/i/D_9R3.jpg
http://tw.greywool.com/i/F5kI2.jpg
http://tw.greywool.com/i/8yEgm.jpg
http://tw.greywool.com/i/Um-hX.jpg
http://tw.greywool.com/i/V-eGl.jpg


Edit: removed img-tags from oversized images. Please check the forum rules for the allowed sizes. X2-Illumintus

Edit :

OK !

Finaly, i just need to add a glass for cockpit_b !

I think the best solution is replace a material/element by a new one, but i think it's not so simple :l

For ex the "blue screen" (actualy deactivated) -> become the big glass from cocpit_1...

assets/units/player/units_player_cockpit_b.xml
(Blue_screen)

Code: Select all

<connection name="Connection08" tags="part iklink animation nocollision  " parent="anim_blocker_01">
<!--ect...-->
							<materials>
									<material id="1" ref="arcp1.cp1_fight_window_bluescreen"/>
								</materials>
<!--ect...-->
And by a patch...

Code: Select all

	 <replace sel="/components/component[@name='units_player_cockpit_b']/connections/connection[@name='Connection08']/offset/parts/materials">
								<materials>
									<material id="1" ref="arcp1.cp1_window"/>
								</materials>
	 </replace>		

Not work actualy...

KlausM
EGOSOFT
EGOSOFT
Posts: 639
Joined: Wed, 6. Nov 02, 20:31
x4

Post by KlausM » Tue, 16. Aug 16, 15:01

Hi FantasyWarrior,

it doesn't work because the XPath in the sel attribute isn't correct. This is the original connection element:

Code: Select all

<connection name="Connection08" tags="part iklink animation nocollision  " parent="anim_blocker_01">
	[...]
	<parts>
		<part name="anim_blocker_01_blue">
			<lods>
				<lod index="0">
					<materials>
						<material id="1" ref="arcp1.cp1_fight_window_bluescreen"/>
					</materials>
				</lod>
			</lods>
			[...]
		</part>
	</parts>
</connection>
So the XPath should be:

Code: Select all

sel="/components/component[@name='units_player_cockpit_b']/connections/connection[@name='Connection08']/parts/part[@name='anim_blocker_01_blue']/lods/lod/materials"

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

Post by stefanEgo » Tue, 16. Aug 16, 15:28

FantasyWarrior wrote:Thank you !

I have discovered everything you said by myself ^^ lua file, ect...

I was try to make a patch for Cockpit Shipstatus.lua, maybe something like

Code: Select all

<diff>
 < replace>
   </replace>
</diff>

And...a lot of other things , folders...
As stated above, modifying these Lua files is unsupported atm. The workaround given above should do the trick atm though, but isn't guaranteed to keep working in the future (aka: replace the whole file (and the xpl-variant) with your own version using the substitution catalog files).
Stefan Hett

FantasyWarrior
Posts: 29
Joined: Sun, 24. Jul 16, 18:43

Post by FantasyWarrior » Fri, 19. Aug 16, 09:34

Thank you !!!

And thank you so much for this A---W---E---S---O---M---E GAME :twisted:

Ovni
Posts: 141
Joined: Sun, 6. May 12, 23:42
xr

Post by Ovni » Mon, 29. Aug 16, 09:30

I was wondering whether modding the station icons to be visible through the station's geometry would be possible (while I'm at it I'm probably gonna set different icons for scanned/unscanned components instead of the greyed out and full versions)?

If it is, any pointers would be appreciated. Otherwise, consider this a feature request for a game option or at least mod possibility next update :twisted: .

Andy_MB
Posts: 72
Joined: Fri, 24. Jul 15, 17:47
x4

Post by Andy_MB » Wed, 31. Aug 16, 09:43

@stefanEgo. Hi! I read about that change / add hotkeys is imposible. (gameoptions.lua - cant be changed)
If I can't add hotkeys, maybe there is any possibility to track pressing or releasing a button?
For example:
I want to track press "Shift + J" for my MOD "Emergency jump for player ship"
Can I add to librarys/contexts.xml and inputmap.xml

Code: Select all

<diff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <add sel="libraries/inputmap/action[@id='INPUT_ACTION_OPEN_PLAYER_INVENTORY_MENU']" pos="after">
    <action id="INPUT_ACTION_OPEN_PLAYER_AMB_JUMPDRIVE" source="INPUT_SOURCE_KEYBOARD" code="INPUT_KEYCODE_J_SHIFT" sinceversion="52" />
  </add>
  
  <add sel="libraries/inputcontexts/context[@id='INPUT_CONTEXT_MENUS']/action[@id='INPUT_ACTION_OPEN_ZONE_MAP']" pos="before">
    <action id="INPUT_ACTION_OPEN_PLAYER_AMB_JUMPDRIVE"/>
  </add>
</diff>
and how to track event pressing Shift+J? (from *.xml or *.lua file)

Code: Select all

if action == "INPUT_ACTION_OPEN_PLAYER_AMB_JUMPDRIVE" then
_____________

User avatar
eliseeff
Posts: 255
Joined: Wed, 26. Jan 05, 17:17
x4

Post by eliseeff » Wed, 23. May 18, 06:39

Andy_MB wrote:Can I add ...
You can't add INPUT_ACTION, because list of INPUT_ACTIONs is hard-coded in the exe-file.

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

Post by stefanEgo » Wed, 23. May 18, 15:43

For some reason I completely missed the last two questions back from 2016.

Since it'd be better to answer a question late than never, here we go:

@Ovni: The icons used for the target elements are referenced in libraries/icons.xml (f.e. see sections mission offer icons). You'd be able to patch these entries in a mod and direct that to replacement textures.

@Andy_MB: eliseeff is right. The ability to modify actions is unfortunately quite restricted. You can't add new actions/states. You'd be able to hack around the limitations to some degree however. It'll be quite tricky though to manage this. The contexts.xml file defines which input actions/states/ranges are active in which context. If you find a suitable context for your need you'd be able too hook into the corresponding action by defining it in the addon's bindings.xml file. The corresponding feature request is on record here: https://www.egosoft.com:8443/jira/browse/XRUIMOD-20

Unfortunately we didn't manage to get this in any previous release yet (at least I added your vote to the list now).
Stefan Hett

Ovni
Posts: 141
Joined: Sun, 6. May 12, 23:42
xr

Post by Ovni » Wed, 23. May 18, 22:21

stefanEgo wrote: @Ovni: The icons used for the target elements are referenced in libraries/icons.xml (f.e. see sections mission offer icons). You'd be able to patch these entries in a mod and direct that to replacement textures.
Thanks. I figured that changing the icons wouldn't be complicated, but what about the seeing them through objects part? (Assuming the game doesn't do it at this point, haven't played in a while.)

User avatar
eliseeff
Posts: 255
Joined: Wed, 26. Jan 05, 17:17
x4

Post by eliseeff » Thu, 24. May 18, 02:30

stefanEgo wrote: If you find a suitable context for your need you'd be able too hook into the corresponding action by defining it in the addon's bindings.xml file. The corresponding feature request is on record here: https://www.egosoft.com:8443/jira/browse/XRUIMOD-20

Unfortunately we didn't manage to get this in any previous release yet (at least I added your vote to the list now).
Thanks! I am very interested in this issue too. I would very much like to add a hotkey for my "Mods Options" menu.

But we still have to do something with the impossibility of binding for custom addons.

Binding nodes is only written in the coreaddon.xsd file. In addon.xsd file there is none. And for custom addons, binding is ignored.

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

Post by stefanEgo » Thu, 24. May 18, 13:34

@Ovni: The exact behavior of how/when/if target elements are obstructed by other geometry is quite a bit complex to explain in detail. In your case I'd get started by looking into the targetsystem.lua script where you'd be able to control/change the obstruction behavior of target elements. Unfortunately we didn't get to a point where modifying this script would be done in a from our side official supported way. You'd however be able to change it using the substitution catalog approach.

@eliseeff: You are right of course there. Recalling this was a last minute decision we had to take since we didn't get the integration/handling to the point where this would be usable by mods reliably. FWIW: I added you to the list of voters.
Stefan Hett

User avatar
eliseeff
Posts: 255
Joined: Wed, 26. Jan 05, 17:17
x4

Post by eliseeff » Thu, 24. May 18, 15:26

stefanEgo wrote:@eliseeff: You are right of course there. Recalling this was a last minute decision we had to take since we didn't get the integration/handling to the point where this would be usable by mods reliably. FWIW: I added you to the list of voters.
Thank you so much!

Another "Wishlist": the ability to use bytecode and a utility to compile. I explain why: I have a desire to modify the Property menu by sorting stations by clusters and sectors (with expanding sections for them). However, with a sufficiently large number of ships and stations, the menu begins to noticeably slow down. This is caused by the specificity of this menu: multiple execution of functions, in particular - menu.addContainerRow, quite large in volume.

The possibility of using bytecode would speed up the work.

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

Post by stefanEgo » Fri, 25. May 18, 12:39

@eliseeff: That's not quite correct. There's no performance difference expected in your case regardless of whether you use bytecode or plain Lua scripts. Only the initial load time of your script would be impacted in that case but we'd be talking here a range of milliseconds which should hardly be relevant for your use case, should it?
To profile your script and determine the main performance relevant sections, you can also make use of DebugProfileStart() and DebugProfileStop().
DebugProfileStop() returns the time in ms since DebugProfileStart() was called (I took the chance to update the documentation for these function shere: https://www.egosoft.com:8444/confluence ... n+overview ).
Stefan Hett

FRSTR
Posts: 2
Joined: Wed, 19. Dec 18, 14:20

Re: UI modding - support thread

Post by FRSTR » Wed, 19. Dec 18, 14:42

Hi @stefanEgo
I have a question on UI modding, if you don't mind and still here.

I've been updating XPL/Lua files as discussed earlier in this thread to resize the menus, and it worked pretty well for Options Menu and for Main Menu in the left sidebar (I know tha modifying those files directly is not ideal, but al least it works).
Though the issue is that I cannot find the config parameters for rendering text in communication dialog (for example, when in cockpit and use F key for a ship or station and there is info or docking options around the cursor) and text for objects flying around, e.g. the distance to this object displayed inside a rectangle.
I actually managed to resize some of the icons next to those texts, but not the texts itself.

Could you point where to find those configs?

FRSTR
Posts: 2
Joined: Wed, 19. Dec 18, 14:20

Re: UI modding - support thread

Post by FRSTR » Wed, 19. Dec 18, 16:35

Holy moly! When I thought I looked everywhere I could (though I'm new to modding and X rebirth) I actually was able just increase the font size of the text element with one new line in menu activation function. The forum must have magic aura.

gamesemailvp
Posts: 18
Joined: Tue, 5. Feb 19, 23:11

Re: UI modding - support thread

Post by gamesemailvp » Thu, 7. Feb 19, 16:57

Hello!
Would you help me create a mod?
I want to add the order of patrol, minimum ability of a star, but I do not give ..
What have I done wrong???

<?xml version="1.0" encoding="iso-8859-1" ?>
<diff>
<add sel="//aiscript/order/skill/">
<skill min="20"/>
</add>
</diff>

AR_Starfighter

Re: UI modding - support thread

Post by AR_Starfighter » Mon, 10. Jun 19, 06:12

Hello all. I have advanced programming skills and been reading up on UI scripting. I'm overwhelmed by the complexity of the code and need help.

I've already done a mod to 'combat rank bailout'. Now, the updates to points don't clutter up the logbook. It's just a window that pops up 20% of the time. The combat updates are now a percent. Not bad for a first timer. :)

I need someone to walk me through how to do this mod.

When you contact traders in the buy sell menu, you have press the change key then set the amount. It's usually buy all or sell all. It's get repetitive and annoying.

How do I add a 'buy all' and 'sell all' button One on either side of the 'change' button?

Thanks.

Post Reply

Return to “X Rebirth - Scripts and Modding”