Jump to content

Removing a button from a dialog menu


Lunar Tripsa
 Share

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

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

Recommended Posts

Hello,

 

I'm trying to remove a menu button from llDialog, but this area is new to me. 
I want to to check the number of linked prims and if it is 9 then show a button and if it is 8 (or less maybe) don't show the button.  I am able to show the button, but I'm not sure how to remove it.

touch_start(integer total_number)
    {
        //llOwnerSay("free memory:"+ (string)llGetFreeMemory());
        displayDialog(llDetectedKey(0),"
        
        
        Make a selection...",Main,1);
    integer prims = llGetObjectPrimCount(llGetKey());
        if (prims == 9)
        {
            prims = llGetNumberOfPrims();
            Main += ["Door"];
        }
       else if (prims == 8)
        {
            prims = llGetNumberOfPrims();

//not sure what to put here?
        }
    }

 Any help your a pint in the right direction would be awesome!  Thanks

Link to comment
Share on other sites

A dialog is build anew every time you do llDialog().
This means you can't remove buttons, you just don't add them.

So, in your touch event, you start with emptiing your 'Main' list and then re-fill it under each 'if'.

It would also be far more logical if you call llDialog after you fill the button list (Main). 

Link to comment
Share on other sites

you have some listitems (buttons) already in Main. you want to:

add another item (button) to Main only when the object is 9 prims. and remove a already added item (button). when the number of linked prims of object changes dynamically by script yes ?

if so then example mod:

 

list Main = ["Button1", "Button2"];...touch_start(integer total_number){     integer index = llListFindList(Main, ["Door"]);     integer prims = llGetObjectPrimCount(llGetKey());      if (index < 0)         if (prims == 9) Main += ["Door"];     else         if (prims != 9) Main = llDeleteSubList(Main, index, index);     displayDialog(llDetectedKey(0), "Make a selection...", Main, 1);}

 

if not dynamic then the example mod is overkill

Link to comment
Share on other sites

Thanks so much for both your help.  I've been playing around with it and am able to "remove" and ad a totally different button, but not the button I want to remove.  If I reset the script then it works, but that messes up the access to the menu.  Oh well.  I think I'll have this to my figure out someday list.

Thanks again though I do appreciate the help!

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3651 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...