Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Why this code isnt work?

Vuldalack Newall
Registered User
Join date: 8 Dec 2006
Posts: 10
02-09-2007 14:35
Hi m8s,

im a noobie scripter and cant see why this code isnt work.

If i put the llGiveInventory outside the dialog option it works fine, but inside of the function no.

CODE

integer CHANNEL = 20; // dialog channel
list MENU = ["Yes", "No"]; // boolean menu

default {
state_entry() {
llListen(CHANNEL, "", NULL_KEY, ""); // listen for dialog answers (from multiple users)
}
touch_start(integer total_number)
{
llDialog(llDetectedKey(0), "ABSOLUT LEGAL. Are you of legal drinking age?", MENU, CHANNEL); // present dialog on click
}


listen(integer channel, string name, key id, string message)
{
string response_string;

if (llListFindList(MENU, [message]) != -1) // verify dialog choice
{
response_string = name + " picked the option '" + message + "'.";
if (message == "Yes")
llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_OBJECT, 0));
else if (message == "No")
llSay(0, "Have fun!");
}
else
{
response_string = name + " picked invalid option '" + llToLower(message) + "'.\n";
response_string = response_string + "Click for options";
}

}
}


Can some one help me?
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
02-09-2007 14:41
llDetectedKey(0) is not known to the listen Event, however, 'id', from the listen's 'key id' parameter should do the trick.
Vuldalack Newall
Registered User
Join date: 8 Dec 2006
Posts: 10
02-10-2007 06:56
From: Pale Spectre
llDetectedKey(0) is not known to the listen Event, however, 'id', from the listen's 'key id' parameter should do the trick.


Bingo!

Tanks M8