Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

There is a number of improvements to the custom menus allowing you to add a lot more into them, making them look closer to vanilla style menus.

Table of Contents
maxLevel3

Column System

There is a new way to create columns, using the command:

...

This must be added directly under the select line to increase the size of the select line. The text value can also be setup into columns. The more extra lines you add, the bigger the selection bar will be.

Custom

...

Menu Strings

There are a number of new string types for custom menus, these create a string array that can draw various items and can be used anywhere you will use normal text. You can set the x position within the line via the columns system.

...

Code Block
themeMidnight
<RetVar> create custom menu string rect: width=<number>, y=<number>, height=<number>, menu colour=<number>[/code]
<RetVar> create custom menu string rect: width=<number>, y=<number>, height=<number>, raw colour=<number>

...

Code Block
themeMidnight
set menu line option: <menu>, hotkey=<string>, jumpto<boolean>jumpto=<boolean>

This sets the hotkey that can be used for this item (hotkeys can be a character or hotkey id). When setting jumpto, then pressing the hotkey simply highlights this line, if FALSE, then it selects it as if you pressed enter on it.

...

When using text colours, it will be better to use the line options for text and selection colour rather than using the colour codes in the text themselves. The reason for this is that when setting the line options, the select colour will be automatically inverted making it clearingclear. IE, if you use the red code in the string to have red text, then have a red selection colour. When the item is selected, it'll appear as red on red. When using the line option instead, and setting both selection and text to red, then the text will be red normally, but when highlighted, the highlight will be red, but the text will be inverted to normal.

The hotkey ids are the number code of the registered hotkeys. There are a few available constants for some of the build in hotkeys, you can also use the id codes from custom hotkeys.  For custom hotkeys, you need to register them as menu hotkeys, so they work when the menus are open

Tradebar

There are new commands for different types of trade bars depending on what function you require

Code Block
themeMidnight
add trade bar to menu: %0, text=%1, min=%2, max=%3, current=%4, volume=%5, used=%6, return value=%7, left text=%8, right text=%9

Similar to the original command, but allows you to set the volume and used amounts for the trade bar. The used amount is the red part that appears at the beginning.

 

Code Block
themeMidnight
add price trade bar to menu: %0, text=%1, min=%2, max=%3, current=%4, return value=%5

This adds a trade bar for changing prices. This works similar to when you adjust prices in your stations for wares.

 

Code Block
themeMidnight
add transfer trade bar to menu: %0, text=%1, volume=%2, current=%3, station amount=%4, station max=%5, ship amount=%6, ship free=%7, ship used=%8, return value=%9
add transfer trade bar to menu: %0, text=%1, ware=%2, ship=%3, station=%4, current=%5, return value=%6

These make a trade bar for transferring ware amounts between ship/station, similar to your HQ/Dock menu when moving goods between the station and docked ship.
You can either use the objects themselves, where the values will be pulled from them directly, or pass the data on manually.

 

Code Block
themeMidnight
add sell trade bar to menu: %0, text=%1, min=%2, max=%3, current=%4, volume=%5, used=%6, return value=%7, left text=%8, right text=%9

This trade bar works backwards for selling, ie starts full, and left will increase the value while emptying the bar.

 

Code Block
themeMidnight
add custom trade bar to menu: %0, text=%1, used=%2, free=%3, other=%6, current=%4, ware volume=%5, return value=%7

IF none of the other trade bar commands suit your needs, then you can use the custom trade bar instead. Unlike the others, it has no minimum/maximum values. So you have to control how far you want it to move yourself.
Using the "tradebar_changed" event you can check if the current value is correct. If its not, you can built a new menu setting the tradebar value to your minimum or maximum value.
You will also receive 2 additional events, "tradebar_full" and "tradebar_empty". This are when home or end keys are pressed to fill or empty the trade bar (setting it to minimum or maximum value). You simply need to return the value you want it set to. The custom tradebar will also not displaying anything other than the tradebar itself, unlike the others. You will need to manually add texts for these.

Custom Tradebar Texts

You can control the texts that are displayed along with the tradebar. The default texts depend on the type of tradebar item you are using.
But there are 8 sets of texts you can define. There are commands available to add these texts onto the end of a tradebar array. This can be used in the "tradebar" to update dynamic texts, or added when you created the menu.

if you added the tradebar to a menu array, then you will need to get that entry first, rather than adding to the menu array itself

Code Block
themeMidnight
add trade bar to menu: $menu ....
$tradeBarArray = get last array entry: $menu

then use the command

Code Block
themeMidnight
<RetVar>add menu trade bar text: <Array> id=<int> text=<string>

You can call this command to add each entry you want to override.
The <array> is the tradebar array (Not the Menu Array).

The id is one of the 8 types, these are available in the constants.

Code Block
themeMidnight
TradeBarText.Left1
TradeBarText.Left2
TradeBarText.Right1
TradeBarText.Right2
TradeBarText.InfoLeft
TradeBarText.InfoRight
TradeBarText.NotoLeft
TradeBarText.NotoRight

The Left/Right entries are the left and right of the tradebar itself, 1 is the top entry, 2 is the bottom entry.
Info is underneath the tradebar at the end of the menu on the left or right (this is the text you can set the in left and right arguments of the various tradebar commands)
The Noto text is the notoriety text that appears directly below the Info Text

You can also use some variables within these texts that can be dynamically changed without needing to create a dynamic tradebar itself.
NOTE: some of these wont be able in all trade bar types

%CURRENT% - The current value
%CURRENTVOL% - The current volume (current value * ware volume)
%ORIGINAL% - The original value, this is the current value you set initially
%MIN% - The minimum value
%MAX% - The maximum value
%PRICE% - The current price value (for price tradebars)
%FREIGHT% - The current ship frieght value (only in move tradebars)