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 »

There is another little mod which I have implemented for 2.51 using the subst_XX.cat method which I would like to port to the new UI modding way. It changes the formatting of the target distance of the primary target next to the crosshair to show a decimal place (e.g. 1.5 km) providing me with a better feeling for my actual speed and more importantly it is easier to find the right distance to start firing based on the range of the selected weapon.

The function that I like to change is "getDistanceText()" from "core/Lua/targetsystem.lua".

So my first question is, is modding UI core files supported right now? If yes, how would a dependency to a core file look like? I tried a few variants but so far I have always ended up with a missing dependency.

The second thing is that currently all the functions in targetsystem.lua seem to be local. Is there a way to overwrite/hook into them?

As always thank you all for your input and ideas.
User avatar
BigBANGtheory
Posts: 3180
Joined: Sun, 23. Oct 05, 12:13
x4

Post by BigBANGtheory »

stefanEgo wrote:@BigBANGtheory: If I get you right this is to a point already possible. Check out the map code for the calls to GetPickedMapComponent(). This function returns the currently selected/picked object on the map.
menu.onRenderTargetSelect() is called, when you click into the map.

So what you could currently already do is to get a list of all the objects the player clicks on in a sequence and then provide the appropriate actions for these.

As for the visuals, I guess atm you could add some table-layout to list what was picked already and provide means to unpick the objects via a button in the table.

To improve upon these things further, I guess this then goes down to adding support to draw shapes/lines directly (http://www.egosoft.com:8282/jira/browse/XRUIMOD-11) with which you then could achieve the visuals.

Does that sound correct, or did I miss something?
Ok then yes if the UI can list player objects clicked in a sequence and then be organised by object type that is a start. What then remains is indirect selection i.e. the player drawing a semi-transparent box over objects of interest and for those objects to be listed for further action.
User avatar
YorrickVander
Posts: 2768
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander »

little tip for passing data to/from lua for menus where params cannot be passed to lua as the user clicks :

Code: Select all

local playership = GetPlayerPrimaryShipID()
local player = GetComponentData(playership, "controlentity")
gives you the equivalent of player.entity so blackboard data can be accessed from the menu lua. player.entity.$blackboardvar then becomes

Code: Select all

local var = GetNPCBlackboard(player, "$blackboardvar")
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 »

@blackmilan: Unfortunately the only way to modify Lua scripts located under ui/core/Lua is only possible via substitution catalogs (with the exception of the widget_xxx-files). This still works in XR >3.50. We really wanted to add proper modding support for these files too, but due to the lack of resources, we had to postpone that. So for the time being, you'd be fine with using the subst-cat-files. However, I've added a feature request for you in the bugtracker: http://www.egosoft.com:8282/jira/browse/XRUIMOD-26
Just so you are aware: Please note that we are more likely to introduce breaking changes in new versions for mods using the subst-catalog-method than we are for the standard format.
As part of XRUIMOD-26 we'd also consider simplifying modifying the scripts without having to replace them alltogether.
Stefan Hett
blackmilan
Posts: 124
Joined: Sat, 22. Jan 11, 21:13
xr

Post by blackmilan »

@stefanEgo
Thank you!
stefanEgo
Posts: 545
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo »

Just to give you some heads-up on some modding related changes: 3.52 RC2 is currently in beta testing and contains two changes/fixes:
(full list is available here as usual: https://wiki.egosoft.com:1337/X%20Rebir ... Changelog/)

- Bugfix: the mouseOver/mouseOut events on tables was not correctly fired, if the table contained inactive buttons ( XRUIMOD-27 )
- New Feature: FFI function HasCustomConversation() was added which checks whether an entity is running a custom conversation atm. ( XRUIMOD-28 )
Stefan Hett
jdow22
Posts: 4
Joined: Fri, 20. Mar 15, 22:20

Post by jdow22 »

Is it possible to get/set the step increase of horizontal sliders?

I want to change the drop cargo slider to an all or nothing when a local security has asked for a cargo drop.

Also on other sliders I want to use home and end keys to select min/max.
stefanEgo
Posts: 545
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo »

@jdow22: Take a look at widgetSystem.scrollRight() that should provide you with a starting point on how to do that.
Stefan Hett
User avatar
Juggernaut93
Posts: 2897
Joined: Sun, 17. Jul 11, 21:03
x4

Post by Juggernaut93 »

Is it possible to create a multi-line EditBox?
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

Juggernaut93 wrote:Is it possible to create a multi-line EditBox?
you can write t-file links in this Text Box ( {PageID,tID} ) and with a custom t-file just containing \n you should be able to add a line break ;) just as workaround ;)

with this method you also should be able to add color Codes ( \033X where X is a Letter defining the Color) - just dont forget to terminate this with \033X (default Color) as it may make following Text colorful otherwise :D
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 ;)
User avatar
Juggernaut93
Posts: 2897
Joined: Sun, 17. Jul 11, 21:03
x4

Post by Juggernaut93 »

UniTrader wrote:
Juggernaut93 wrote:Is it possible to create a multi-line EditBox?
you can write t-file links in this Text Box ( {PageID,tID} ) and with a custom t-file just containing \n you should be able to add a line break ;) just as workaround ;)

with this method you also should be able to add color Codes ( \033X where X is a Letter defining the Color) - just dont forget to terminate this with \033X (default Color) as it may make following Text colorful otherwise :D
Interesting idea. I'll give it a try.
User avatar
wysiwyg
Posts: 585
Joined: Thu, 26. Feb 04, 00:08
x4

Post by wysiwyg »

Juggernaut93 wrote:Is it possible to create a multi-line EditBox?
Using the standard Helper.CreateEditBox you can create an edit box any size you like but it seems to be limited to single line entry. This function doesn't have any arguments relating to wrapping the text either and if you keep adding text the text just spews off the detailmonitor into "space" and then on past the edge of the screen.

You may be able to "pre-seed" the box with \n escape codes as UniTrader described but I haven't tried that yet.

Edit: Just tried and the edit box doesn't recognise \n escape codes
User avatar
Juggernaut93
Posts: 2897
Joined: Sun, 17. Jul 11, 21:03
x4

Post by Juggernaut93 »

wysiwyg wrote:
Juggernaut93 wrote:Is it possible to create a multi-line EditBox?
Using the standard Helper.CreateEditBox you can create an edit box any size you like but it seems to be limited to single line entry. This function doesn't have any arguments relating to wrapping the text either and if you keep adding text the text just spews off the detailmonitor into "space" and then on past the edge of the screen.

You may be able to "pre-seed" the box with \n escape codes as UniTrader described but I haven't tried that yet.

Edit: Just tried and the edit box doesn't recognise \n escape codes
Yeah, it seems we can't do anything at the moment.
stefanEgo
Posts: 545
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo »

@Juggernaut93: As wysiwyg correctly stated: atm that's not possible out of the box. The only way to realize that for you would be to modify the implementation in widget_xxxx.lua files to provide such a functionality. It's possible, but requires a certain amount of work to do it urself. I've added a feature request for you so it might be considered at one point (http://91.250.82.76:8282/jira/browse/XRUIMOD-31).
Stefan Hett
User avatar
Juggernaut93
Posts: 2897
Joined: Sun, 17. Jul 11, 21:03
x4

Post by Juggernaut93 »

stefanEgo wrote:@Juggernaut93: As wysiwyg correctly stated: atm that's not possible out of the box. The only way to realize that for you would be to modify the implementation in widget_xxxx.lua files to provide such a functionality. It's possible, but requires a certain amount of work to do it urself. I've added a feature request for you so it might be considered at one point (http://91.250.82.76:8282/jira/browse/XRUIMOD-31).
Thank you :)
User avatar
BigBANGtheory
Posts: 3180
Joined: Sun, 23. Oct 05, 12:13
x4

Post by BigBANGtheory »

for this month I wanted to digress slighty and tackle a more general restriction effecting the UI and resulting gameplay

Tactical UI Use Case 3.0 (April 2015)
The guiding principle here is for UI elements such as the HUD, instrument displays, menus to be able to be activated where needed or where the game design/context calls for it.

Use cases include:
- Control of pilotable ship whilst in external 3rd person view i.e. with a HUD and some instruments
- Access to interactive displays whilst in 1st person but out of the cockpit e.g. on a station or capital ship
- Presentation of live data out-of-cockpit e.g. market trading, maps, news bulletins etc as opposed to static data such as adverts and looped animations

In the case of a tactical UI the most logical benefit would be your presence in 1st person on the bridge of a capital class ship and be able to visualise your tactical poisiton and send orders/commands to your units. Detailed commands for those assets local to you, more high level commands to those distant from you. The presentation of the holomap in a prominent position on the bridge would be a good example.
stefanEgo
Posts: 545
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo »

@BigBANGtheory: If I get you right than to a certain degree what you are requesting should be possible already. I'm trying to cut that down to a few areas:
HUD elements (target elements, crosshair, etc.): You should be able to control when these are visible or not by replacing the underlying Lua scripts (targetsystem.lua, crosshair handling.lua, etc.). The calls you are likely to use are goToSlide([element], "inactive") or goToSlide([element], "active"). Take a look at the scripts to get a feeling on which elements are available for inactive/active behavior. In case of the target elements refer to targetElement.mainElement for instance.
instrument displays (primary/secondary weapon panels, ship status panel, speedbar, etc.): This is indeed a limitating factor with the use-case. Note that these displays are rendered on rendertargets. If the rendertarget is not visible, then you wouldn't see the panel. So you are free to place these panels anywhere in an asset (you'd have to modify the cockpit asset for instance), but in principle this might be achievable already.
menus: This too is possible, but you are limited to the detailmonitor environment. In this case like with instrument displays you'd have to place the related rendertarget where you want the menu to show up. There's one set-back however: For this to work, the HUD Detail Monitor setting must be disabled.

Is this roughly what you would require to realize ur use-cases?
Last edited by stefanEgo on Tue, 7. Jul 15, 10:29, edited 1 time in total.
Stefan Hett
User avatar
BigBANGtheory
Posts: 3180
Joined: Sun, 23. Oct 05, 12:13
x4

Post by BigBANGtheory »

So if I understand correctly what you are saying is (in theory at least):

1. You could display the holomap as a HUD Detail Monitor effectively overlaying a scene in 1st person e.g. on the bridge of a captial ship

2. project it to a render target effectively a 2D display/asset within the scene

The idea I had visualised was along the lines of the Mass Effect Normandy Bridge/War Room:
http://img4.wikia.nocookie.net/__cb2012 ... r_Room.png

So you couldn't use a detail HUD monitor for that effect but you could potentially use a transparent asset too for a more Battlestar Galactica vision (behind the actors in this screenshot):
[ external image ]

Which would work on many levels given the art direction of XR, if you are saying that the holomap could be projected out of the Skunk cockpit and onto another render target in first person?

In that sense it wouldn't be a full 3d projection because your character couldn't walk around it but as a compromise it would be still be 3d viewport on a 2d virtual display in the scene which is no better or worse than you playing on a physical 2d monitor anyway.
stefanEgo
Posts: 545
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo »

@BigBANGtheory: If I understand you right, then the answer to 1 would be no (at least not with feasible effort). Simply speaking the UI engine is limited to 2D display (to be precise this is not quite the truth, but within the current context just taking this for granted lets us keep the topic focused :-) ). Hence you won't be able to render a real UI scene anywhere in-game atm (so also no 3D holomap).
Regarding no 2: that's correct. The Masseffect War Room would not be possible atm. Given the Battlestar Galactica sample, this would kinda be possible, but not with the level of transparency you'd envision. Therefore I'd say: it's possible to add some geometry and use that as a rendertarget. The problem might be here to actually adjust the geometry of existing game assets. It should be more suitable to put a rendertarget on some already existing geometry.
Which would work on many levels given the art direction of XR, if you are saying that the holomap could be projected out of the Skunk cockpit and onto another render target in first person?
Correct. This should be possible.
In that sense it wouldn't be a full 3d projection because your character couldn't walk around it but as a compromise it would be still be 3d viewport on a 2d virtual display in the scene which is no better or worse than you playing on a physical 2d monitor anyway.
Also correct.
Stefan Hett
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

@BigBANG

i have thought about possibilities for this, too.. the AI/MD-Command <add_holomap/> looks promising, but i have no idea what it would expect as input or how to aquire it (especially the rendertarget)
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 ;)

Return to “X Rebirth - Scripts and Modding”