BullyWiiPlaza
Modder
- Messages
- 215
- Reaction score
- 174
- Points
- 818
I figured that I would "release" this since it can tremendously help people with managing and adding submenus.
The problem is that if you add an options to a menu that does not yet exist you will freeze. If you get confused with all the parameters and submenus it might happen. To
make the process easier, I made a wrapper function that adds an option and a menu at once. It looks as follows:
If you can't tell yet what this does, let me explain it to you. In order to add a submenu named "My Sub Menu" to the menu called "My Previous Menu", you would write the following code:
Before you would write something like this:
The code line above does the same thing. Now adding options is the the same as usual so I won't show it.
You might be left wondering why my function has a 3rd argument when it's not used? Well, that is for menus that are named differently from the displayed option title because you might have menus with the same title but obviously different menu so in that case you would simply write:
I use this for 2nd pages mostly if not all entries fit on one page. Since the "more..." menu is defined here and we want it to say "more..." instead, we need to change the menu title manually.
As a reminder, my add_option() and add_menu() functions so that you can make sure that yours are the same or at least similar:
Note:
This obviously depends on the menu base you're using but I hope you get the point.
Enjoy guys
The problem is that if you add an options to a menu that does not yet exist you will freeze. If you get confused with all the parameters and submenus it might happen. To
make the process easier, I made a wrapper function that adds an option and a menu at once. It looks as follows:
Code:
addSubMenu(previousMenu, newMenu, menuText)
{
menuOptionText = undefined;
if(isDefined(menuText))
{
menuOptionText = menuText;
}
else
{
menuOptionText = newMenu;
}
self add_option(previousMenu, menuOptionText, ::submenu, newMenu, newMenu);
self add_menu(newMenu, previousMenu, newMenu);
}
Code:
self addSubMenu("My previous menu", "My new submenu");
Code:
self add_option("My previous menu", menuOptionText, ::submenu, "My new submenu", "My new submenu");
self add_menu("My new submenu", "My previous menu", "My new submenu");
You might be left wondering why my function has a 3rd argument when it's not used? Well, that is for menus that are named differently from the displayed option title because you might have menus with the same title but obviously different menu so in that case you would simply write:
Code:
self addSubMenu("My whatever menu", "My more whatever menu", "more...");
As a reminder, my add_option() and add_menu() functions so that you can make sure that yours are the same or at least similar:
Code:
add_menu(Menu, prevmenu, menutitle)
{
self.menu.status[Menu] = "Verified";
self.menu.getmenu[Menu] = Menu;
self.menu.scrollerpos[Menu] = 0;
self.menu.curs[Menu] = 0;
self.menu.menucount[Menu] = 0;
self.menu.subtitle[Menu] = menutitle;
self.menu.previousmenu[Menu] = prevmenu;
}
add_option(Menu, Text, Func, arg1, arg2)
{
Menu = self.menu.getmenu[Menu];
Num = self.menu.menucount[Menu];
self.menu.menuopt[Menu][Num] = Text;
self.menu.menufunc[Menu][Num] = Func;
self.menu.menuinput[Menu][Num] = arg1;
self.menu.menuinput1[Menu][Num] = arg2;
self.menu.menucount[Menu] += 1;
}
This obviously depends on the menu base you're using but I hope you get the point.
Enjoy guys
Last edited: