Editing UI Elements

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

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

Post Reply
Argustone
Posts: 57
Joined: Mon, 5. Jun 17, 16:29
x3ap

Editing UI Elements

Post by Argustone » Mon, 5. Feb 18, 18:31

I'm wanting to edit some UI elements (menu headers). I have no idea where to start or what to really even look for. Any help would be greatly appreciated.

Trying to edit Mayhem's new 'job' ui so that jobs only have 1 header instead of each individually.

https://www.dropbox.com/s/l24d8f7v64n3q ... I.png?dl=0

Would very much appreciate some guidance. Next step is to hopefully edit the new DA's to quit being stupid ;)

Argustone
Posts: 57
Joined: Mon, 5. Jun 17, 16:29
x3ap

Post by Argustone » Tue, 6. Feb 18, 01:59

Pretty sure I've managed to find the correct 'line'. But I'm unsure of which element is dictating which one determines how the data is listed. Namely why each job is listed with a separate header... No idea what I'm doing here.

Managed to find the file and what I think is the correct 'string?' Forfeit! :evil: again tomorrow... Guess I'll actually go play for now!

Argustone
Posts: 57
Joined: Mon, 5. Jun 17, 16:29
x3ap

Post by Argustone » Tue, 6. Feb 18, 02:03

<line linenr="031" indent=" ">
<var>$jobs</var>
<text> </text>
<text>=</text>
<text> </text>
<text>table</text>
<text> </text>
<text>get</text>
<text> </text>
<var>$logistics</var>
<text> </text>
<text>(</text>
<text> </text>
<text>'jobs'</text>
<text> </text>
<text>)</text>
</line>
<line linenr="032" indent="  ">
<comment>* Collect data to sort the array.</comment>
</line>

--

Not sure the appropriate format for linking this but I'm pretty sure this is what determines how it's sorted? Any insight would be appreciated.

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 21126
Joined: Sun, 2. Apr 06, 16:38
x4

Post by X2-Illuminatus » Tue, 6. Feb 18, 10:39

First of all, you cannot edit X3 scripts in an ordinary text or xml editor. The somewhat readable part at the top of the script file (everything between the <sourcetext></sourcetext> tags) is only responsible for displaying the script in your browser. Doubleclicking an xml script file within the "scripts" folder, or any other folder where the x2script.xsl is present, will open a readable view of that script in your browser. If you want to reference or ask about about specific code snippets, copy the relevant part of this view into bbcode code-tags in your post. The actual script code, however, is listed between the <codearray></codearray> tags.
To edit a script you either need to use the ingame Script Editor or a specialised external Script Editor like X-Studio by mr.bear. (If you haven't worked with MSCI scripts/the Script Editor before, you may want to read the MSCI manual.)

As for your headline issue, you need to find the script which is creating the menu in question. The line you're looking for is "add custom menu heading to array <Value>: text=<Var/String>" which adds a heading text defined in "text=<Var/String>" to the menu specified in "<Value>". See also this tutorial on creating custom menus in X3TC/AP.
Besteht Interesse an einem Nopileos-Hörbuch?

Farnhams Legende und Nopileos als E-Books!

"People who think they know everything are a great annoyance to those of us who do." - Isaac Asimov

"If it's not impossible, there must be a way to do it." - Sir Nicholas Winton

Argustone
Posts: 57
Joined: Mon, 5. Jun 17, 16:29
x3ap

Post by Argustone » Tue, 6. Feb 18, 16:26

Thanks Illuminatus, Helps alot! Wasn't sure where to go from there.

Never messed with anything like this other than HTML was trying to edit it like I would HTML.

Argustone
Posts: 57
Joined: Mon, 5. Jun 17, 16:29
x3ap

Post by Argustone » Tue, 6. Feb 18, 18:07

So slightly more progress, Seems I've possibly found the lines (probably not).

https://www.dropbox.com/s/cc8bymizseegg ... b.png?dl=0

I'm fairly positive this is the dynamic menu. But from what I could understand it should be labeled with dynamic in it? Not sure. Maybe there's a reference to make it dynamic that I'm not seeing.

https://www.dropbox.com/s/ai8ki58rg1y1e ... y.png?dl=0

Seeing *collect data to sort array* makes me think this is the dynamic line? If I'm understanding how this works correctly.

I also haven't been able to find $logistics or $jobs. Seems like that's something else other than a script? Is it just a internal reference?


TL;DR : Pretty sure I've found the line but don't see whats making it create individual headers.

User avatar
Joubarbe
Posts: 3596
Joined: Tue, 31. Oct 06, 13:11
xr

Post by Joubarbe » Tue, 6. Feb 18, 18:23

...

Menu.DWM.Get.Logistics.Jobs, line 98

Code: Select all

add custom menu heading to array $menu: title=$t
replace by:

Code: Select all

add non selectable menu item: $menu, text=$t

Argustone
Posts: 57
Joined: Mon, 5. Jun 17, 16:29
x3ap

Post by Argustone » Tue, 6. Feb 18, 19:26

So your suggestion wasn't quite what I was trying to do. But after some more 'figuring' it's this simple. DELETE line 108.

https://www.dropbox.com/s/8g2fdfjf81tyh ... 1.png?dl=0

It's so clean! Thanks for all the help! Lock thread?

Edit. I'm guessing this means that all lines below 108 to the 'end' are now junk (for my game) probably should delete them as well?

User avatar
Joubarbe
Posts: 3596
Joined: Tue, 31. Oct 06, 13:11
xr

Post by Joubarbe » Tue, 6. Feb 18, 19:33

Illuminati, Illumanitoum, Illuminatus! May this thread be locked!

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”