dynamic_menu object
This method will add an item to a menu using audio as its output.
int add_item(string filename, string name="")
Parameters:
filename
The file to add. If the sound is stored on disk this can be either an absolute path, a relative path or the file name on its own. Absolute paths are not applicable however, if the sound is being added from a pack file (see remarks).
name
An optional name intended to be used for lookups (see remarks).
Return value:
The position in the menu of the new item (starting at 1) on success, -1 on failure.
Remarks:
The location in which the engine searches for the file specified in the filename parameter is determined by a call to the "set_sound_storage" function. By default it will look on the users hard drive and in the directory where the program is stored, unless an absolute path is specified such as "C:\\Windows\\media\\ding.wav". If the engine has been set up to look inside a pack file then only a file name such as "creature.ogg" or a relative path such as "sounds\\monster.ogg" can be specified.
Note that both \ and / can be used to specify paths.
Item names are handy when you do not know in what order items may appear, or indeed if certain items will appear at all. For a more thorough description of item names and their uses, please see the get_item_name method chapter.
Example:

    // Make a simple menu.

    #include "dynamic_menu.bgt"

    void main()
    {
    dynamic_menu my_menu;
    int menu_result;
    my_menu.allow_escape=true;
    my_menu.wrap=false;
    my_menu.add_item("start_game.wav");
    my_menu.add_item("test_speakers.wav");
    my_menu.add_item("exit.wav");
    menu_result=my_menu.run("choose_an_option.wav", false);
    if(menu_result==-1)
    {
    alert("Error", "There was an error loading the menu.");
    exit();
    }
    if(menu_result==0)
    {
    alert("Option", "Escape was pressed. Exiting.");
    exit();
    }
    if(menu_result==1)
    {
    alert("Option", "Option selected was start game.");
    }
    if(menu_result==2)
    {
    alert("Option", "Option selected was test speakers.");
    }
    if(menu_result==3)
    {
    alert("Option", "Option selected was exit. Exiting.");
    exit();
    }
    }