[question]Injecting info in menus on mouseover[RESOLVED]

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
Orfevs
Posts: 183
Joined: Thu, 22. Jan 09, 23:03
x3tc

[question]Injecting info in menus on mouseover[RESOLVED]

Post by Orfevs » Sun, 16. Feb 14, 02:38

Anyone know how inject an info text into custom menus?
Specifically for arrow entries, as they don't return from the menu.

I do not mean "add custom menu info line", although that's where it will show up obviously.

I know there is an intricate method to this, except I don't recall how it was done.

- Orf. The Muxmaster.
Last edited by Orfevs on Sun, 16. Feb 14, 04:57, edited 1 time in total.
TCAN TC/AP Artificial Life, Menudriven Automated Ship/Station Namer
Spex: i7 4790K@4Ghz 16Gb DDR3 GTX970Strix(4Gb)
X:R 454 Hours. 15 hours unmodded.

zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal » Sun, 16. Feb 14, 03:55

The menu is just an array so to inject menu items you would just modify it using array manipulation commands. So lets say script A opens a menu, script B needs to monitor the menu array to detect when the value selection menu item changes and make modifications to the menu array based on the value selected.

For examples you can look at Lib Scrat: http://forum.egosoft.com/viewtopic.php?t=261816

You can also copy the pattern I've developed for my mods which make dynamic menus a lot more linear and can be found in my Ship Browser mod. The pattern uses 3 script files which are reusable for every menu you make:
  • createmenu: takes parameters packs them into an array which I call $handle. Includes a placeholder for a result value at index 0 and returns the $handle array after STARTing the menu script.
    ismenuopen: returns [TRUE] if the menu is still open and waits for a 100 ms if it is
    menu: opens the menu packed into the $handle array - intended to be called by createmenu using START so it runs in a separate task
The pattern works like this:

Code: Select all

$menu = ... your menu array ...

$handle = [THIS]-> call script 'lib.zanzal.createmenu' : title=$title.text heading=null menu.items=$menu large.menu=[TRUE]
while [THIS]-> call script 'lib.zanzal.ismenuopen' : handle=$handle
 * Check your $menu indexes for updates and respond by modifying $menu as needed.
end
$result = $handle[0]
You can find my implementation of this pattern at https://github.com/Zanzal/ShipBrowser/t ... er/scripts.

Orfevs
Posts: 183
Joined: Thu, 22. Jan 09, 23:03
x3tc

Post by Orfevs » Sun, 16. Feb 14, 04:15

Just the words "separate task" made me want to take a very long walk, then run all the way back and smash my head into something breakable..

Thank you for lodging me out of the hole I dug for myself!

EDIT:
The info is extremely helpful as well, so I guess my menus will change a little :)
TCAN TC/AP Artificial Life, Menudriven Automated Ship/Station Namer
Spex: i7 4790K@4Ghz 16Gb DDR3 GTX970Strix(4Gb)
X:R 454 Hours. 15 hours unmodded.

Post Reply

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