Gothic Online Forums
[Clientside] Simple menu framework - Printable Version

+- Gothic Online Forums (
+-- Forum: Scripting (English) (
+--- Forum: Resources (
+---- Forum: Frameworks (
+---- Thread: [Clientside] Simple menu framework (/thread-337.html)

[Clientside] Simple menu framework - Sative - 06.01.2016

Simple Menu Framework

It is easy to use menu framework with labels/textbox and mouse support!

Function list:
Menu::Menu(x, y, font, lineHeight) //Create menu
int Menu::addOption(name, onclick_function) //Add option to existing menu, returns optionID
int Menu::addTextBox(value, onclick_function) //Add textbox to existing menu, returns optionID
void Menu::show() //Shows menu
void Menu::hide() //Hide menu
void Menu::clear() //Experimental, destroying all draws and options, can be used for dynamic menu
array Menu::m_Options[] //Options list in current menu
int Menu::m_Option //Current option
bool Menu::m_Visible //Is menu visible?
New event:
Example script (menu.nut):

local myMenu = 0;
local option1 = 0;
local textbox = 0;

addEvent("onInit", function()
    myMenu = Menu(6000, 2000, "Font_Old_10_White_Hi.TGA", 130);
    option1 = myMenu.addOption("Option1", function(menu)
        print("You clicked first option");
    textbox = myMenu.addTextBox("Your text here", function(menu)
        //Get value of current option
        local text = menu.m_Options[menu.m_Option].name;
        print("Your text: " + text);

addEvent("onKey", function(key, letter)
    if(key == KEY_F1)
        if(myMenu.m_Visible == false)
        else myMenu.hide();

addEvent("onMenuChangeSelection", function(menu)
    if(menu == myMenu)
        if(menu.m_Option == option1)
            print("Set to: Option1");
        if(menu.m_Option == textbox)
            print("Set to: textbox");
How to use it?
Just put in your config.xml
<script src="simple-menu-framework.nuc" type="client" />
before your script. And put simple-menu-framework.nuc in client-scripts folder.


Donate me via PayPal: [email protected]

RE: [Clientside] Simple menu framework - Sative - 09.05.2016

Link updated.