[TUTORIAL] Creating menus + two library scripts
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Moderator (Script&Mod)
- Posts: 22437
- Joined: Sun, 14. Nov 04, 23:26
yup just gotta remember to manipulate the correct array.
what you can do is clear the array and remake it, as long you use the same array address
what you can do is clear the array and remake it, as long you use the same array address
Code: Select all
$count = size of array $menu
while $count
dec $count
remove element $count from array $menu
end
... (re add all your entries to $menu
-
- Posts: 2255
- Joined: Mon, 31. Oct 05, 08:44
-
- Posts: 1468
- Joined: Wed, 3. Aug 05, 05:05
-
- Posts: 15
- Joined: Sun, 14. Mar 04, 14:56
How to use custom menus?
I am wondering if someone can help me out with getting to know the custom menus.
What I want to do is create a custom menu from already created arrays that has multiple columns and has a return value (the PIN) that sends the user to another custom menu with several choices.
I.E creates a menu of all the characters that contains their stats (from arrays I already have) in other columns. Each row (character) can then be selected. It then sends the player to another menu with different actions that the player can select.
Basically all I really need to know is how to get the multiple columns and how the return values work.

{The [url=http://forum.egosoft.com/viewtopic.php?t=216696][b]T[/b][b]C[/b] [b]S[/b]&M Posting [b]R[/b]ules[/url] says: If there is a thread about topic, use it! And two on a sticky ... merging.
jlehtone}
What I want to do is create a custom menu from already created arrays that has multiple columns and has a return value (the PIN) that sends the user to another custom menu with several choices.
I.E creates a menu of all the characters that contains their stats (from arrays I already have) in other columns. Each row (character) can then be selected. It then sends the player to another menu with different actions that the player can select.
Basically all I really need to know is how to get the multiple columns and how the return values work.

{The [url=http://forum.egosoft.com/viewtopic.php?t=216696][b]T[/b][b]C[/b] [b]S[/b]&M Posting [b]R[/b]ules[/url] says: If there is a thread about topic, use it! And two on a sticky ... merging.

-
- Posts: 2033
- Joined: Wed, 29. Jun 05, 01:45
If you look at the tutorials and resources stick at the top of the forum you will find links to quite a few custom menu tutorials.
LV's one is a fairly standard one for the basic menu's
But Scargarets (I'm spelling his/her name wrong-sorry
) is newer and has info on columns
http://forum.egosoft.com/viewtopic.php?t=261816
In short however, I'd imagine it would go like this (I'm not getting the syntax exactly right, but this is the general idea)
$menu = create menu [with heading/one of the other create menu variants]
* Then for each item in your input array, add it to the menu with return value (the PIN). Note, this is adding one ROW at a time like "add $rowarray to menu"
$returnvalue = open menu $menu
* Then you have a billion if statements for each of the if statements
if $returnvalue = xxxx
....
else if $returnvalue = yyy
....
etc.
end
return null
And to answer your two quick question.
Columns: When you add an array to a menu, it will automatically make the menu column'ed (with each array item in its own column, and I "think"-guess- there is a max of 5 columns, but I've never used tested it
my self)
Return values: Each row in a menu (or item in a menu -in the event its just a normal single column'ed menu) has a return value assigned to it (even if it's null). When you open a menu, it does something like this
$return = open menu $yourmenu
And the $return is value associated with the item that you clicked.
If you close a menu with the scape key it returns -1
If you have a menu item with a null return, then it is highlight able but not selectable (i.e You can put the mouse over it, but nothing happens when you click it)
Cols + returns: Same as a normal menu, 1 return for the whole row.
Hope this helps,
Scrat's tutorial is aces.
LV's one is a fairly standard one for the basic menu's
But Scargarets (I'm spelling his/her name wrong-sorry

http://forum.egosoft.com/viewtopic.php?t=261816
In short however, I'd imagine it would go like this (I'm not getting the syntax exactly right, but this is the general idea)
$menu = create menu [with heading/one of the other create menu variants]
* Then for each item in your input array, add it to the menu with return value (the PIN). Note, this is adding one ROW at a time like "add $rowarray to menu"
$returnvalue = open menu $menu
* Then you have a billion if statements for each of the if statements
if $returnvalue = xxxx
....
else if $returnvalue = yyy
....
etc.
end
return null
And to answer your two quick question.
Columns: When you add an array to a menu, it will automatically make the menu column'ed (with each array item in its own column, and I "think"-guess- there is a max of 5 columns, but I've never used tested it
my self)
Return values: Each row in a menu (or item in a menu -in the event its just a normal single column'ed menu) has a return value assigned to it (even if it's null). When you open a menu, it does something like this
$return = open menu $yourmenu
And the $return is value associated with the item that you clicked.
If you close a menu with the scape key it returns -1
If you have a menu item with a null return, then it is highlight able but not selectable (i.e You can put the mouse over it, but nothing happens when you click it)
Cols + returns: Same as a normal menu, 1 return for the whole row.
Hope this helps,
Scrat's tutorial is aces.
-
- Posts: 1962
- Joined: Tue, 8. Jan 08, 18:19
Hi,
I just added two menu library scripts of mine to the start post (lib.scrat.format and lib.scrat.expand). Maybe you want to have a look at them.
Since I just learned a bit of HTML I decided to do the documentation in HTML so this is the result. Don't expect anything fancy.
Greetings,
ScRaT
I just added two menu library scripts of mine to the start post (lib.scrat.format and lib.scrat.expand). Maybe you want to have a look at them.
Since I just learned a bit of HTML I decided to do the documentation in HTML so this is the result. Don't expect anything fancy.

Greetings,
ScRaT
-
- Posts: 4
- Joined: Mon, 13. Feb 12, 10:30
the ....
http://www.file-upload.net/download-195 ... s.pdf.html
link doesnt work anymore.
Is there an alternate link available ?
thanks in advance
Pri
http://www.file-upload.net/download-195 ... s.pdf.html
link doesnt work anymore.
Is there an alternate link available ?
thanks in advance
Pri
-
- Posts: 4
- Joined: Mon, 13. Feb 12, 10:30
-
- Posts: 681
- Joined: Thu, 17. Nov 05, 13:12
Hi ScRaT_GER,
I got TC v3.2
dowloaded your expand libraries: http://scripts.fbnz.de/files/lib.scrat.expand.zip
put them the scripts folder, then called 'a.00test' with a script call.
The selection is functional, but it will not expand.
Here a screenshot:
[ external image ]
What am I doing wrong?
* EDIT *
Ok, problem solved, I forgot to put the lib.scrat.format.xml in the scripts folder.
I got TC v3.2
dowloaded your expand libraries: http://scripts.fbnz.de/files/lib.scrat.expand.zip
put them the scripts folder, then called 'a.00test' with a script call.
The selection is functional, but it will not expand.
Here a screenshot:
[ external image ]
What am I doing wrong?
* EDIT *
Ok, problem solved, I forgot to put the lib.scrat.format.xml in the scripts folder.

-
- Posts: 2
- Joined: Sun, 27. Jul 08, 05:38
[ external image ]
Offer:
Provide to lib.scrat.expand.add extra argument for creating expandable sub-menus under selector.
Offer:
Provide to lib.scrat.expand.add extra argument for creating expandable sub-menus under selector.
-
- Moderator (Deutsch)
- Posts: 25130
- Joined: Sun, 2. Apr 06, 16:38
Since ScRaT_GER's website does not seem to be available any longer, I added his two tutorials to the Egosoft X3 wiki: Creating beautiful menus in X3: Terran Conflict and Creating menus + two library scripts. (The respective script files can be downloaded there too.)
I added both links to the opening post too.
I added both links to the opening post too.
Last edited by X2-Illuminatus on Wed, 20. Sep 17, 12:29, edited 1 time in total.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
-
- Posts: 15
- Joined: Sat, 19. Jun 10, 16:36
Thanks X2-Illuminatus for adding the alternatives!
Unfortunately I'm getting a secure connection failure with error code SSL_ERROR_RX_RECORD_TOO_LONG, and thus I can't access them. Are you aware of any workarounds that I could make use of, or anyone that I could get in touch with to resolve the issue?
Thank you in advance.
Unfortunately I'm getting a secure connection failure with error code SSL_ERROR_RX_RECORD_TOO_LONG, and thus I can't access them. Are you aware of any workarounds that I could make use of, or anyone that I could get in touch with to resolve the issue?
Thank you in advance.
-
- Moderator (Deutsch)
- Posts: 25130
- Joined: Sun, 2. Apr 06, 16:38
The port number in the links was changed some time ago. I adjusted the links accordingly now. They should redirect you to the respective wiki pages now.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
-
- Posts: 15
- Joined: Sat, 19. Jun 10, 16:36