Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

click menu scripting question.

BabyTiger Armistice
Registered User
Join date: 22 Dec 2005
Posts: 6
02-28-2006 15:17
i am trying ot make a menu script for a wearible item, but it seems that anyone can use the script. is there a way to make the menu only appear to the owner? while having the options menu availible to anyone to click?

the script is like this..

// when touched, present a dialog with four color choices

integer CHANNEL = 42; // dialog channel
list MENU_MAIN = ["0", "1","2", "3","4", "5", "Options..."]; // the main menu
list MENU_OPTIONS = ["11", "22", "33", "44", "...Back"]; // a submenu

default {
state_entry() {
CHANNEL = llFloor( llFrand( 10000.0 ) + 60000 ); // dialog channel (random 60000 - 70000)
llListen(CHANNEL, "", NULL_KEY, "";); // listen for dialog answers (from multiple users)
}

touch_start(integer total_number)
{
llDialog(llDetectedKey(0), "TEXT HERE", MENU_MAIN, CHANNEL); // present dialog on click
}

listen(integer channel, string ownername, key id, string message)
{
if (llListFindList(MENU_MAIN + MENU_OPTIONS, [message]) != -1) // verify dialog choice
{
if (message == "Options...";)
llDialog(id, "Choose and action!", MENU_OPTIONS, CHANNEL); // present submenu on request
else if (message == "1";)
llSay(0, ownername + "SCRIPTED MESSAGE HERE";

is there something i can change so i can only use the menu? and others can access the sub menu?

thanks for the help
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
02-28-2006 15:25
In the touch_start event, just before the llDialog, add this line:

CODE

if ( llDetectedKey(0) == llGetOwner() )


That will make it only launch a dialog if the person who touched it is the owner.
BabyTiger Armistice
Registered User
Join date: 22 Dec 2005
Posts: 6
02-28-2006 15:26
thank you very much
BabyTiger Armistice
Registered User
Join date: 22 Dec 2005
Posts: 6
02-28-2006 15:58
o.k. is there a way to make certain options availible to my, and the resto to others?

like..

if (message == "Options...";)
llDialog(id, "Choose and action!", MENU_OPTIONS, CHANNEL); // present submenu on request
else if (message == "1";)
llSay(0, ownername + "SCRIPTED MESSAGE HERE";
else if (message == "2";)
llSay(0, ownername + "SCRIPTED MESSAGE HERE";

mesage #1 i can use only and message 2 can be used by someone who clicked the object

Nevermind.. i will just use 2 scripts
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
02-28-2006 16:12
Put that same code in the listen, replacing llDetectedKey(0) with id. Then you can check to see if it's the owner.