Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Script help needed for gift box, give to certain av script

Honey Something
Texture Maker
Join date: 30 Sep 2006
Posts: 24
11-06-2008 19:12
What is wrong with this? I want it to give objects in the inventory of a gift box only to an av whose name is in the descripton of the gift box. But I can't get it to compile.


From: someone
key avatar;
string desc;

default
{
touch_start(integer total_number)
{
integer i;
for (i=0; i<total_number; i++){
avatar = llKey2Name(llDetectedKey(i));
desc = llGetObjectDesc();

if (avatar == desc)
llGiveInventory(avatar,llGetInventoryName(INVENTORY_OBJECT,0);
else
llWhisper(0, 'This is not your gift!";);
}
}
}


It gets an error at the end of this line just before the semi-colon:

From: someone
llGiveInventory(avatar,llGetInventoryName(INVENTORY_OBJECT,0);
Dekka Raymaker
thinking very hard
Join date: 4 Feb 2007
Posts: 3,898
11-06-2008 19:33
you have a space between the R and Y in inventory, that would do it.
Honey Something
Texture Maker
Join date: 30 Sep 2006
Posts: 24
11-06-2008 19:54
OK, when I paste it here it puts it in, when I retype it it seems to not put it in.

llGiveInventory(avatar,llGetInventoryName(INVENTORY_OBJECT,0);

llGiveInventory(avatar, llGetInventoryName(INVENTORY_OBJECT,0);

But it still doesn't work... thanks, I appreciate the help :-)
Luke Poplin
Registered User
Join date: 2 Feb 2007
Posts: 32
11-06-2008 20:05
From: Honey Something
llGiveInventory(avatar, llGetInventoryName(INVENTORY_OBJECT,0);

But it still doesn't work... thanks, I appreciate the help :-)


The "avatar" variable is the problem. llGiveInventory needs a KEY. not a name.

llGiveInventory(key destination, string inventory)
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
11-07-2008 00:45
you also need 2 parenthesis at the end of the function
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Lennard Lopez
Registered User
Join date: 9 Oct 2007
Posts: 52
11-07-2008 01:01
The variable avatar must be of the type string and llGiveInventory needs a key.

I added the llToUpper parts to correct upper/lowercase errors in the name.

CODE

string avatar;
string desc;
default
{
touch_start(integer total_number)
{
integer i;
for (i=0; i<total_number; i++){
avatar = llToUpper(llKey2Name(llDetectedKey(i)));
desc = llToUpper(llGetObjectDesc());

if (avatar == desc)
llGiveInventory(llDetectedKey(i),llGetInventoryName(INVENTORY_OBJECT,0));
else
llWhisper(0, "This is not your gift!");
}
}
}
Dilbert Dilweg
Loading....
Join date: 27 Jun 2006
Posts: 500
11-11-2008 17:39
It would be a cool feature to add a Date setting. User can not open it untill a specified date. Would be great for Christmas gifts you can set out under a tree. With a Reply message. Sorry you can not open untill SO AND SO date.
_____________________
Founder of Sweethearts Singles Dating Site
http://date.sweetheartsjazz.com

Visit our Social network Site
http://www.sweetheartsjazz.com

To Visit us in World
Sweethearts jazz
http://slurl.com/secondlife/Sweethearts/197/148/24
Love everyone :D