Jump to content

Next Button on a Dirty Menu


Laufiair Hexicola
 Share

You are about to reply to a thread that has been inactive for 798 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Many years ago I put together a giver script(user clicks on it, it gives an item) that only needed to be two menu's and is considered to be dirty because of the calls. I'm looking to expand the script beyond two menu's and can't seem to figure out how to script a Next Button that scales with the menu's beyond two menu's. If someone could point me in a direction i'd appreciate it.

-Logan

string mainMenuDialog = "Choose a 45 to be given ^_^\n\n1. Carameldansen by Little V\n2. She Wants Revenge - Tear You Apart\n3. Pegboard Nerds & Redless - Cheat Code\n4. Kate Bush - Running up that Hill\n5. Memory Cassette - Asleep at a Party\n6. AronChupa - I'm an Albatraoz\n7. Statler Brothers - Flowers on the Wall";
list mainMenuButtons = ["1", "Close", ">", "2", "3", "4", "5", "6", "7"];


string subMenu_01_Dialog = "Choose a 45 to be given ^_^\n\n8. Shirk & TLM - Things Fall Apart\n9. ArunChopa - Little Swing\n10. Hello Meteor - Ever\n11. Psy - Daddy\n12. BTSM - Destroy It(Drivepilot remix)\n13. Band-Maid - Dice"; 
list subMenu_01_Buttons = ["Previous", "Close", "Next", "8", "9", "10", "11", "12", "13"];


string subMenu_02_Dialog = "Choose a 45 to be given ^_^\n\n14. Stained - Outside\n15.\n16.\n17.\n18.\n19."; 
list subMenu_02_Buttons = ["Previous", "Close", "Next", "14", "15", "16", "17", "18", "19"]; 

//-------------------------------------------------------------//

integer dialogChannel;
integer dialogHandle;
 
open_menu(key inputKey, string inputString, list inputList)
{
    dialogChannel = (integer)llFrand(DEBUG_CHANNEL)*-1;
    dialogHandle = llListen(dialogChannel, "", inputKey, "");
    llDialog(inputKey, inputString, inputList, dialogChannel);
    llSetTimerEvent(30.0);
}
 
close_menu()
{
    llSetTimerEvent(0);
    llListenRemove(dialogHandle);
}
 
default
{
    on_rez(integer start_param)
    {
        llResetScript();
    }
      touch_start(integer numDetected)
    {      
        key id = llDetectedKey(0);
        close_menu();
        open_menu(id, mainMenuDialog, mainMenuButtons);
    }
 
    listen(integer channel, string name, key id, string message)
    {
        if(channel != dialogChannel)
            return;
 
        close_menu();
 
        if(message == "Ok")open_menu(id, mainMenuDialog, mainMenuButtons);
            else if(message == "Previous")open_menu(id, mainMenuDialog, mainMenuButtons); //Previous Button
//            else if(message == "Next")open_menu(id, subMenu_01_Dialog, subMenu_01_Buttons); //Next Button
            

           
            else if(message == "1")llGiveInventory(id,"Carameldansen (Little V Metal Cover)");
            else if(message == "2")llGiveInventory(id,"She Wants Revenge - Tear You Apart");
            else if(message == "3")llGiveInventory(id,"Pegboard Nerds & Redless - Cheat Code");
            else if(message == "4")llGiveInventory(id,"Kate Bush - Running up that Hill");
            else if(message == "5")llGiveInventory(id,"Memory Cassette - Asleep at a Party");
            else if(message == "6")llGiveInventory(id,"AronChupa - I'm an Albatraoz");
            else if(message == "7")llGiveInventory(id,"Statler Brothers - Flowers on the Wall");
            
            else if(message == "8")llGiveInventory(id,"Shirk & TLM - Things Fall Apart");
            else if(message == "9")llGiveInventory(id,"ArunChopa - Little Swing");
            else if(message == "10")llGiveInventory(id,"Hello Meteor - Ever");
            else if(message == "11")llGiveInventory(id,"Psy - Daddy");
            else if(message == "12")llGiveInventory(id,"BTSM - Destroy It(Drivepilot remix)");
            else if(message == "13")llGiveInventory(id,"Band-Maid - Dice");
            
            else if(message == "14")llGiveInventory(id,"Stained - Outside");



            
                                                                                             
    }
              
    timer()
    {
        close_menu();
    }
}

 

Link to comment
Share on other sites

My suggestion to deal with the else-if's would be to use a strided list of current_menu_items where the first element is the button name and the 2nd is what it maps to.

i.e. ["1","Carameldansen", "2", "She wants revenge"];

Then in your listen you'd do llListFindList(current_menu_items,[message]) this will give you the index of the button or -1 on not found, the item selected would be the index + 1

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 798 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...