Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Menu Notecard Giver

Lorathana Eldrich
Registered User
Join date: 6 Apr 2006
Posts: 45
05-04-2008 05:48
I'm trying to create a menu driven notecard giver..its based off the freebie script: DIALOG MENU by Kyrah Abattoir

Unfortunately, its not giving the notecards, I can't seem to figure out why...anyone have any tips on how to fix this?

this is the script below that I have done so far:

From: someone

integer menu_handler;
integer menu_channel;
menu(key user,string title,list buttons)
{
menu_channel = (integer)(llFrand(99999.0) * -1);
menu_handler = llListen(menu_channel,"","","";);
llDialog(user,title,buttons,menu_channel);
llSetTimerEvent(5.0);
}

default
{
touch_start(integer t)
{
menu(llDetectedKey(0),"hello world",["test1","test2"]);//Names you want to show in the menu, also change the "hellow world" to what you would like it to say.
}
timer()
{
llSetTimerEvent(0.0);
llListenRemove(menu_handler);
}
listen(integer channel,string name,key id,string message)
{
if (channel == menu_channel)
{
if(message == "test1";) //Should match exactly to the names listed above for the menu
{
llGiveInventory(llDetectedKey(0), "notecard name 1";); //name of notecard to give
}
else if(message == "test2";)
{
llGiveInventory(llDetectedKey(0), "notecard name 2";);
}
}
}
}
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
05-04-2008 07:56
llDetectedKey isn't going to work in the Listen event handler (it has nothing to detect), it does however give you both the key and the name of the agent. Which is good. :)



Kahiro Watanabe
Registered User
Join date: 28 Sep 2007
Posts: 572
05-04-2008 08:31
From: Pale Spectre
llDetectedKey isn't going to work in the Listen event handler (it has nothing to detect), it does however give you both the key and the name of the agent. Which is good. :)

http://www.lslwiki.net/lslwiki/wakka.php?wakka=llDetectedKey
http://www.lslwiki.net/lslwiki/wakka.php?wakka=detected
http://www.lslwiki.net/lslwiki/wakka.php?wakka=listen


Right, so if you check listen() event's header you can take user's key from the "id" variable:
listen(integer channel,string name,**key id**,string message)

So your line would be:

llGiveInventory(id,"notecard name 1";);
Lorathana Eldrich
Registered User
Join date: 6 Apr 2006
Posts: 45
05-04-2008 17:21
Thankyou very much :) totally cleared up where I was confused at hehe got it working now.