[TUTORIAL] Creating menus + two library scripts

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

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

User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

Congratulations!
Dynamic menus are quite cool, aren't they?

Maybe I should include a passage about the common pitfalls with dymanic menus.

Greetings,
ScRaT
Logain Abler
Posts: 2255
Joined: Mon, 31. Oct 05, 08:44
x4

Post by Logain Abler »

ScRaT_GER wrote:Congratulations!
Dynamic menus are quite cool, aren't they?

Maybe I should include a passage about the common pitfalls with dymanic menus.

Greetings,
ScRaT
They are indeed :)

LA
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22437
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow »

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

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
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

You can also simply resize the array to 0.
Maybe this is a little faster, since it doesn't need a loop.

Greetings,
ScRaT
Logain Abler
Posts: 2255
Joined: Mon, 31. Oct 05, 08:44
x4

Post by Logain Abler »

ScRaT_GER wrote:You can also simply resize the array to 0.
Maybe this is a little faster, since it doesn't need a loop.

Greetings,
ScRaT
Thanks for your help & time. This should be a sticky, your guide has improved the look & feel of my menus no end.

LA
mark_a_condren
Posts: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

Post by mark_a_condren »

This should be a sticky, your guide has improved the look & feel of my menus no end
Second that !!
For my own menu's

MarCon
Firehawk777
Posts: 15
Joined: Sun, 14. Mar 04, 14:56

How to use custom menus?

Post by Firehawk777 »

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}
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

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 :S) 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.
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

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
User avatar
Pri
Posts: 4
Joined: Mon, 13. Feb 12, 10:30
x3tc

Post by Pri »

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
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

Tutorial is up again.

Greetings,
ScRaT
User avatar
Pri
Posts: 4
Joined: Mon, 13. Feb 12, 10:30
x3tc

Post by Pri »

Thank you very much for re-uploading this tutorial. Its exactly what I need at the moment ! :)

Pri
Nicoman35
Posts: 681
Joined: Thu, 17. Nov 05, 13:12
x3tc

Post by Nicoman35 »

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. :oops:
Nekomata
Posts: 2
Joined: Sun, 27. Jul 08, 05:38

Post by Nekomata »

[ external image ]

Offer:
Provide to lib.scrat.expand.add extra argument for creating expandable sub-menus under selector.
Gqqnbig
Posts: 66
Joined: Fri, 12. Jul 13, 14:08

Post by Gqqnbig »

waaa.. it's latex. You're so professional!
User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 25130
Joined: Sun, 2. Apr 06, 16:38
x4

Post by X2-Illuminatus »

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.
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!
Admiral Vesna
Posts: 15
Joined: Sat, 19. Jun 10, 16:36
x4

Post by Admiral Vesna »

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.
User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 25130
Joined: Sun, 2. Apr 06, 16:38
x4

Post by X2-Illuminatus »

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!
Admiral Vesna
Posts: 15
Joined: Sat, 19. Jun 10, 16:36
x4

Post by Admiral Vesna »

Awesome! Thank you very much X2-Illuminatus! :D

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