I've been working on this script and everything in it works just fine.. execpt setting the permissions. I'm trying to set the permission levels to Owner Only, Same Group, or Anyone with a polite message if you do not meet the current permission level via one of the dialog menus.
I just can't seem to get the permissions to change.. Currently if anyone clicks the object they get the correct menu but the permission settings seem to be ignored. This represents my first attempt at setting permissions via a menu so I KNOW I've bolloxed it up somewhere, but even with the help of the wiki, this form and the library I'm still not able to sort it out.
If someone could take a look and let me know just where and why I've gone wrong I would appreciate it. If you want to post a bit of corrected code I wouldn't mind that either

Here's the script as it stands:
CODE
//GLOBALS
key AGENTs;
key OBJECTS_OWNER;
integer GROUP;
integer INGROUP = FALSE;
integer PUBLIC = FALSE;
integer OWNER = FALSE;
//CHANNELS
integer CHANNEL = -395751;
integer CHANNEL_COLOR = -395752;
integer CHANNEL_POOF = -395753;
integer CHANNEL_FOG = -395754;
integer CHANNEL_PERM = -395755;
//LISTENERS
integer cLISTENER;
integer LISTENERc;
integer LISTENERp;
integer LISTENERf;
integer pLISTENER;
//LISTS
list MENU_MAIN = [ ];
list MENU_COLOR = ["Red", "Blue","Main", "Green", "Gold", "Purple"];
list MENU_POOF = ["Music", "Hearts", "Smiley", "Main"];
list MENU_FOG = ["Green", "White", "Main", "Purple", "Red", "Blue"];
list MENU_PERM = ["Owner", "Group", "Public", "Main"];
//FUNCTIONS
Mmenu()
{
llDialog(AGENTs,"Dance Floor Controller Mk2\nChoose activity", MENU_MAIN, CHANNEL);
}
//SCRIPT
default
{
on_rez(integer start_param)
{
llResetScript();
}
touch_start (integer total_number)
{
OBJECTS_OWNER = llGetOwner();
AGENTs = llDetectedKey(0);
GROUP = llDetectedGroup(0);
if (AGENTs == OBJECTS_OWNER)
{
MENU_MAIN =
[
"Fog Color",
"Set Particles",
"Pattern",
"Fog Off",
"Particles Off",
"Permissions",
"Fog On",
"Particles On",
"Bright"
];
Mmenu();
cLISTENER = llListen(CHANNEL,"",NULL_KEY,"");
llSetTimerEvent(30);
return;
}
else if (INGROUP == GROUP)
{
MENU_MAIN =
[
"Fog Color",
"Set Particles",
"Pattern",
"Fog Off",
"Particles Off",
"Fog On",
"Particles On",
"Bright"
];
Mmenu();
cLISTENER = llListen(CHANNEL,"",NULL_KEY,"");
llSetTimerEvent(30);
return;
}
else if (PUBLIC == TRUE)
{
MENU_MAIN =
[
"Fog Color",
"Set Particles",
"Pattern",
"Fog Off",
"Particles Off",
"Fog On",
"Particles On",
"Bright"
];
llDialog(AGENTs,"Dance Floor Controller Mk2\nChoose activity", MENU_MAIN, CHANNEL);
cLISTENER = llListen(CHANNEL,"",NULL_KEY,"");
llSetTimerEvent(30);
}
else
{
llInstantMessage(llDetectedKey(0),"You do not have permission to change the settings on this item");
llListenRemove(cLISTENER);
}
}
listen(integer channel, string name, key id, string message)
{
if (channel==CHANNEL)
{
if(llToLower(message)=="pattern")
{
llDialog(AGENTs,"Dance Floor Controller Mk2\nChoose Floor Pattern", MENU_COLOR, CHANNEL_COLOR);
LISTENERc = llListen(CHANNEL_COLOR,"",NULL_KEY,"");
}
else if (llToLower(message)=="fog color")
{
llDialog(AGENTs,"Dance Floor Controller Mk2\nChoose Fog Color", MENU_FOG, CHANNEL_FOG);
LISTENERf = llListen(CHANNEL_FOG,"",NULL_KEY,"");
}
else if (llToLower(message)=="set particles")
{
llDialog(AGENTs,"Dance Floor Controller Mk2\nChoose Particles", MENU_POOF, CHANNEL_POOF);
LISTENERp = llListen(CHANNEL_POOF,"",NULL_KEY,"");
}
else if (llToLower(message)=="main")
{
Mmenu();
}
else if (llToLower(message)=="fog on")
{
llSay(CHANNEL_FOG, "On");
Mmenu();
}
else if (llToLower(message)=="fog off")
{
llSay(CHANNEL_FOG, "Off");
Mmenu();
}
else if (llToLower(message)=="particles on")
{
llSay(CHANNEL_POOF, "On");
Mmenu();
}
else if (llToLower(message)=="particles off")
{
llSay(CHANNEL_POOF, "Off");
Mmenu();
}
else if (llToLower(message)=="bright")
{
llSay(CHANNEL_COLOR, "bright");
Mmenu();
}
else if (llToLower(message)=="permissions")
{
llDialog(AGENTs,"Dance Floor Controller Mk2\nSet Permissions", MENU_PERM, CHANNEL_PERM);
pLISTENER = llListen(CHANNEL_PERM,"",NULL_KEY,"");
}
}
if(channel==CHANNEL_COLOR)
{
if (llToLower(message)=="main")
{
Mmenu();
}
else
{
Mmenu();
}
}
if(channel==CHANNEL_POOF)
{
if (llToLower(message)=="main")
{
Mmenu();
}
else
{
Mmenu();
}
}
if (channel==CHANNEL_FOG)
{
if (llToLower(message)=="main")
{
Mmenu();
}
else
{
Mmenu();
}
}
if (channel==CHANNEL_PERM)
{
if (llToLower(message)=="owner")
{
INGROUP == FALSE;
PUBLIC == FALSE;
llOwnerSay("Permission set to Owner Only");
Mmenu();
}
if(llToLower(message)=="group")
{
INGROUP == TRUE;
PUBLIC == FALSE;
llOwnerSay("Permission set to Group");
return;
}
if(llToLower(message)=="public")
{
INGROUP == FALSE;
PUBLIC == TRUE;
llOwnerSay("Permission set to Public");
return;
}
}
}
timer()
{
llListenRemove(LISTENERc);
llListenRemove(LISTENERf);
llListenRemove(LISTENERp);
llSetTimerEvent(0);
}
}