View Single Post
splewis
Veteran Member
Join Date: Feb 2014
Location: United States
Old 08-23-2014 , 13:44   Re: SMLIB 0.11 BETA (over 300 Function Stocks) | updated 15.07.2011
Reply With Quote #373

Quote:
Originally Posted by berni View Post
I don't really see much of a use case for them, as they basically do just String to int conversion.
However if you want them in you can create a pull request (follow the contribution guidelines).
I was mainly curious if there was a better way to write menu/cookie logic when things aren't stringy by nature. Since I haven't seem similar functions before I thought maybe I was just doing things a stupid way.

Here's my general use case, giving menu options across an enum:

Code:
enum MapType {
    MapType_Current,
    MapType_Vote,
    MapType_Veto
};

...


    Handle menu = CreateMenu(SetupMenuHandler);
    SetMenuTitle(menu, "How will teams be setup?");
    SetMenuExitButton(menu, false);
    AddMenuInt(menu, _:TeamType_Captains, "Assigned captains pick their teams");
    AddMenuInt(menu, _:TeamType_Random, "Random teams");
    AddMenuInt(menu, _:TeamType_Manual, "Players manually switch teams");
    DisplayMenu(menu, client, MENU_TIME_FOREVER);


...

public SetupMenuHandler(Handle menu, MenuAction action, param1, param2) {
    if (action == MenuAction_Select) {
        int client = param1;
        g_TeamType = TeamType:GetMenuInt(menu, param2);
    } else if (action == MenuAction_End) {
        CloseHandle(menu);
    }
}
__________________
splewis is offline