|
Adelle Fitzgerald
Trying...very very trying
Join date: 6 Jan 2007
Posts: 17
|
11-08-2007 14:47
Hi, I have been struggling with this script now for a couple of days. I have searched the forums but can't find anything to help me, so, any help would be greatly appreciated. I have a script where when touched displays a menu. One of the menu items is to give the the contents of the object to the avatar that touches it, and the other menu items do other things. It works great when the line "key user = " is set to llGetOwner(), but does not work when the line is set to llGetDetectedKey(0)and I get the errors: Object: Unable to give inventory list: Cannot find destination Object: Invalid Key passed to instant message Below is the script. Many thanks in advance for any help  default { state_entry() { llListen(789789, "", "", ""); } touch_start(integer num) { llDialog(llDetectedKey(0), "Please Choose:", ["Get Objects", "Menu Item 2", "Menu Item 3"], 789789); } listen(integer channel,string name,key id,string message) { if( message == "Get Objects" ) { list inventory; string name; integer num = llGetInventoryNumber(INVENTORY_OBJECT); string text = llGetObjectName() + " is unpacking...\n"; integer i; key user = llDetectedKey(0); //llGetOwner();//Set to llDetectedKey(0); to allow anyone to use for (i = 0; i < num; ++i) { name = llGetInventoryName(INVENTORY_ALL, i); if(llGetInventoryPermMask(name, MASK_OWNER) & PERM_COPY) inventory += name; else llOwnerSay("Cannot give asset \""+name+"\", owner lacks copy permission"); llSetText(text + (string)((integer)(((i + 1.0) / num) * 100))+ "%", <1, 1, 1>, 1.0); } //chew off the end off the text message. text = llGetObjectName(); //we don't want to give them this script i = llListFindList(inventory, [llGetScriptName()]); if(~i)//if this script isn't found then we shouldn't try and remove it inventory = llDeleteSubList(inventory, i, i); if (llGetListLength(inventory) < 1) llSay(0, "No items to offer."); else { llGiveInventoryList(user, "Objects", inventory); llSetText("",<1,1,1>,1); name = "Your objects can be found in your inventory, in a folder called 'Objectss'."; if(user == llGetOwner()) llOwnerSay(name); else llInstantMessage(user, name); } } } }
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
11-08-2007 14:52
llGiveInventoryList doesn't work reliably unless the target is in the same sim.
I was burnt by this yesterday.
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!
http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal
http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
|
|
Adelle Fitzgerald
Trying...very very trying
Join date: 6 Jan 2007
Posts: 17
|
11-08-2007 14:59
Hi Ordinal, I am in the same sim, stood right next to the object. Still no work  After playing some, and putting some llSay's here and there in the script to try and find out what is happening, I think that the llDetectedKey(0) isn't being passed on to the listen part of the script. I'm not fantastic with scripting, tho i do try and I have no idea on how to pass over the key to the listen, if that is what is going wrong.
|
|
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
|
11-08-2007 15:26
I guess this line
key user = llDetectedKey(0); //llGetOwner();//Set to llDetectedKey(0); to allow anyone to use
should actually read:
key user = id; //llGetOwner();//Set to llDetectedKey(0); to allow anyone to use
as the Key of the User is passed to «llListen» as «id»
Just a thought, though...
|
|
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
|
11-08-2007 15:27
You have llDetectedKey in two places. It belongs in the touch event. It won't work in the listen event. Try using a global to store the llDectectedKey from the touch event. Use the global in the listen event rather than another call to llDectedtedKey.
|
|
Adelle Fitzgerald
Trying...very very trying
Join date: 6 Jan 2007
Posts: 17
|
11-08-2007 16:25
Awesome Monica!! That worked a treat, thank you very much 
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-09-2007 03:21
why store the key in a global, you're getting it fed in right there in the listen from the dialog... as haruki said, either key user = id; or better still, replace all instances of 'user' in the listen with 'id'
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
|
11-10-2007 03:56
Adelle, if you put a script reset in an on_rez event, llGetOnwer() will work even if the item transfers ownership...
on_rez (integer foo) { llResetScript(); }
|