Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help making a list command please

Kobra Stein
Registered User
Join date: 25 Apr 2006
Posts: 9
06-03-2006 12:38
hey all Noobie question but could some one help me with making a menu so when I click on the item it gives me options eg: Click Start and vecihle engine starts
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
06-03-2006 12:59
CODE
integer listenID = 0;
integer listenChannel;

default {
touch_start(integer x) {
key id = llDetectedOwner(--x); // Get the person who touched us
if (id == llGetOwner()) { // Only the owner can get this dialog
// If there is no active listener then open one
if (!listenID) {
listenChannel = -llRound(llFrand(DEBUG_CHANNEL));
listenID = llListen(listenChannel, "", id, "");
}

// Show the dialog
llDialog(
llDetectedOwner(--x), // Person to send to
"Please pick an option", // Tell them what to do
["Option 1", "Option 2"..."Option n"], // Options ^_^
listenChannel
);

// Add a timer to close the listen if idle
llSetTimerEvent(30.0);
}
}

listen(integer channel, string name, key id, string msg) {
// Double check it's a valid person
if (id == llGetOwner()) {
msg = llToLower(msg); // Make lower case for minor typos
if (msg == "Option 1") {
// Option 1 actions
} else if (msg == "Option 2") {
// Option 2 actions
} .... else if (msg == "Option n") {
// Option n actions
}
}
}

timer() {
llListenRemove(listenID); // Close the listen
listenID = FALSE; // Mark it as closed so a new one is opened later
llSetTimerEvent(0.0); // End this timer
}
}


I have bad flu and I am lying on my side so forgive any typos :)
_____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon
10gb DDR2 800mhz FB-DIMMS
4 x 750gb, 32mb cache hard-drives (RAID-0/striped)
NVidia GeForce 8800GT (512mb)