Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Dialog Menu Question

Taft Worsley
Registered User
Join date: 6 Aug 2006
Posts: 4
09-12-2007 18:00
I am attempting to put together an infotmation based dialog menu and i am trying to have the menu on button click deliver a notecard from object inventory. ISSUE: The menu dialog menu works, however it will only deliver the inventory item to the object owner- not to the person who touch and requested it - they touch - i get the notecard -- Any help would be great - Thanx TW

//Dialog Menu System

integer menu_handler;
integer menu_channel;
menu(key user,string title,list buttons) //make dialog easy, pick a channel by itself and destroy it after 5 seconds
{
menu_channel = (integer)(llFrand(99999.0) * -1); //a different channel at each use
menu_handler = llListen(menu_channel,"","","";);
llDialog(user,title,buttons,menu_channel);
llSetTimerEvent(5.0);
}

default
{
touch_start(integer t)
{
menu(llDetectedKey(0),"Information Option Menu",["Info","Other","Other","Other"]);
}
timer() //so the menu timeout and close its listener
{
llSetTimerEvent(0.0);
llListenRemove(menu_handler);
}
listen(integer channel,string name,key id,string message)
{
if (channel == menu_channel) //in case you have others listeners
{
if(message == "Info";)

{
llSay(0, "Here's Your Information";);
llGiveInventory(llDetectedKey(0), "Information";);
}

else if(message == "Other";)
{
//do other stuffs
}
}
}
}
Auron Reardon
Registered User
Join date: 30 Jun 2006
Posts: 41
09-12-2007 19:21
Change this:

llGiveInventory(llDetectedKey(0), "Information";);

to this:

llGiveInventory(id, "Information";);

The id argument from the listen event is the user that clicked the button - which is what you are looking for. The user that clicks the button is the one "saying" the message.

The dialog is appearently operating in the context of the owner - therefore, it is the one passed to llDetected*. I never came across this, but it makes sense.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
09-12-2007 19:22
change
From: someone

llGiveInventory(llDetectedKey(0), "Information";);

to
From: someone

llGiveInventory(id, "Information";);
Taft Worsley
Registered User
Join date: 6 Aug 2006
Posts: 4
Ty
09-12-2007 19:26
thanx - thats was bothering the sh#$ out of me :)
Auron Reardon
Registered User
Join date: 30 Jun 2006
Posts: 41
09-12-2007 19:26
Btw, listen is not an event that "officially" supports llDetected functions. According to the wiki, they are only supported by collision, sensor and touch events.