Simple Custom Menu

[Reusable] Simple Custom Menu 1.6.2

* Replaced the PlayerCmd hook with a PreThinkFrame hook, since apparently PlayerCmd can cause desynchs in netgames
* Changed the example menu a bit
* When there is only 1 page the menu will not display the page name on the bottom right of the menu
* If value is for some reason omitted it will default to 0 now
* Fixed a possible bug and improved the comments-guide a lot
+ The menu now supports multiple pages/nesting, a bit of conversion is needed if you want to port your menu from a previous version
+ Added MNF_CHANGEPAGE flag, a setting with this flag will change the page to the number of their value, since his value shouldnt change/be changed, I suggest adding MNF_NOSAVE too
+ Added "pagename" parameter, when selecting this option the page will change its name to the defined string, use in combination with a MNF_CHANGEPAGE setting
+ Added "selectedvflags" parameter, same thing as "vflags" but thse will only be applied when the setting is selected
* Hopefully didnt break anything considering how much this adds and changes

-HOW TO CONVERT FROM PREVIOUS VERSIONS-
The part that needs to be converted is player.menu.contents, in the past it looked like this (assuming {element} is one of the menu elements):

how it looked before 1.6:
player.menu.contents = {
    {element},
    {element},
    {element},
    {element}
}

now player.menu.contents holds the different pages that then hold the elements, so your table should look like this now:

how it should look in 1.6:
player.menu.contents = {
    [1] = {
        {element},
        {element},
        {element},
        {element}}
}

if you want to add more pages simly add more elements after the 1 as element 2, 3 and so on
  • Cool!
Reactions: DinnerSonic
+ Added "flags" parameter, which should have custom MNF_* flags, you can see what they do in the file
+ Added "vflags" parameter, this one should have V_* flags, mainly made to have color video flags
* Improved comments-guide a little bit
* When in the menu the player will lose all momentum and won't be able to move even when falling down
* Rewrote the way I/O works, allowing a setting's value and maxvalue to be as big as you want
- Removed maxvalue's limit(10) since I/O can now write and read much bigger numbers
* The "value" parameter now sets the setting's default value
+ Added sliders settings
* Added more checks for maxvalue (to avoid issues)
* Improved the comments-guide
* Made the menu more aligned to the center of the screen
+ Added the maxvalue parameter (max value for this parameter is 10), for settings which value is not a boolean-type (boolean-type meaning that the value can range only from 0 to 1), if this parameter is omitted it will default to 2 (a boolean-type value)
+ Added the option paramter, this parameter has to be a table that contains a string for each possible value the setting can be, if omitted it will default to OFF/ON (for a boolean-type value)
+ you can now make a setting in the menu not be a on/off boolean and instead call a given function
* improved the comments-guide for making this menu work in your addon
Top