Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Menu for notecard and URL

Niko Bromberg
Registered User
Join date: 30 May 2008
Posts: 14
08-13-2008 02:38
Hello!

I am trying to build what should be a simple object which when touched displays options (some providing notecards, and some a URL). I have made this script which saves fine and holds all the relevant notecards, however when an option is selected nothing happens. If the URL is selected then a "cannot find avatar" message appears! Blooming annoying!

Heres the script:

integer CHANNEL = 42;
list MENU_MAIN = ["NC1", "NC2", "NC3", "Website1"];
key id;

default
{
state_entry()
{
llTargetOmega(<0.0,0.0,0.1>,TWO_PI,1);
llListen(CHANNEL, "", "", "";);
id = llDetectedKey(0);
}

touch_start(integer total_number)
{
llDialog(llDetectedKey(0), "blahblah", MENU_MAIN, CHANNEL);
}

listen(integer channel, string name, key id, string message)
{
if (message == "NC1";)
{
llGiveInventory(llDetectedKey(0),"NC1";);
}
else if (message == "NC2";)
{
llGiveInventory(llDetectedKey(0),"NC2";);
}
else if (message == "NC3";)
{
llGiveInventory(llDetectedKey(0), "NC3";);
}
else if (message == "Website1";)
{
llLoadURL(llDetectedKey(0),"Link to ... information", "www.test.co.uk";);
}
}
}

Any help would be mega appreciated. Thanks
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
08-13-2008 02:59
The problem is your "llDetectedKey(0)" calls inside the listen event. Those functions won't work in that event. Instead, you want to use the "id" parameter that's passed in, like this:

llGiveInventory(id,"NC1";);

and

llLoadURL(id,"Link to ... information", "www.test.co.uk";);


Similarly, it won't work inside "state_entry", although you don't really have any need to use it in there, as far as I can tell.

Hope that's helpful!
Niko Bromberg
Registered User
Join date: 30 May 2008
Posts: 14
08-13-2008 03:12
You sir are a genius! thanks so much for that