[WiP] [General Information] Custom Menus

This forum serves as MSCI Reference at EGOSOFT. It's Read-Only for non MSCI Group members.

Moderators: Scripting / Modding Moderators, MSCI Moderators

Post Reply
User avatar
Ogerboss
Posts: 1301
Joined: Sat, 5. Aug 06, 22:05
x3tc

[WiP] [General Information] Custom Menus

Post by Ogerboss » Sun, 3. Oct 10, 15:35

The Custom Menu gives you the possibility to get input from the player without spamming his logbook with incoming questions and has way more options to get player input.
In this topic the structure of the custom menu will be explained to give you a deeper understanding how the set of commands for this interface works. If you want to know how to interact with the player using these menu have a look at {link}.
The custom menu itself is simply an array, and each element of the array represents one line in the custom menu. The structure of the elements in the array depends on their function and will be covered in this topic. Of course there are commands that will do most of the work for you, so you may ask why to care about the inner structure of the custom menus. The answer is simple: the custom menus offer functionality that is not covered by the commands in the Script Editor and to take advantage of those you'll need to know how it works.

Elements of the custom menu
  • Array (-1, String) - a section heading, not interactive
    • String - the displayed text for the heading
  • Array (-2, String) - an info line, appearing at the beginning of the menu and not interactive
    • String - the displayed text for the info line
  • Array (-3) - an empty line, not interactive
  • Array (String, Value) - a normal text line, that can be selected
    • String - the text for the choice
    • Value - the return value for the custom menu command if the player chooses this option
  • Array (-4, String, Array, Int, Value) - a value selection line, can be used with the left/right arrow keys, but cannot be used to close the menu
    • String - the displayed text for the value selection
    • Array - an array containing all allowed choices for the value selection
    • Int - defines the default choice (to be understood as an array index)
    • Value - the variable where the return value of the choice will be stored
Changing the alignment of the text and creating tables

The default alignment for text is left-aligned, but you can alter this. Each occurrence String-variables allows you to use Array(Int, String) instead where Int specifies the position relative to the left border of the interface in pixel, and the String is the same as before. By using negative integers the position will be relative to the right border instead. If you put more than one Int, String pair into this array, you can easily create columns for a table.

Useful things to know about the custom menu

If you specify NULL as return value for a normal option, this option will become inactive. This means nothing will happen if you choose it, therefore make sure that you always have at least one normal option that returns something, even if it's just trash (e.g. if you have a config menu with value selection and only need a close option).

TBA:
-colour formatting
-examples, including pics
-adding links to commands, when they're written

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

Post by ScRaT_GER » Sat, 9. Oct 10, 19:22

Array (-4, String, Array, Int, Value) - a value selection line, can be used with the left/right arrow keys, but cannot be used to close the menu

* String - the displayed text for the value selection
* Array - an array containing all allowed choices for the value selection
* Int - defines the default choice (to be understood as an array index)
* Value - the variable where the return value of the choice will be stored
Are you sure that the explanation for "Value" is correct?
The command to create these selections is the following:
add value selection to menu: <Var/Array>, text=<Var/String>, value array=<Var/Array>, default=<Var/Number>, return id=<Var/String>

I think Value refers to the last <Var/String>, which is the return id of the value selection. And afaik it works differently, as I described in my tutorial on menus.


Greetings,
ScRaT

Post Reply

Return to “MSCI Reference”