|
raven Blair
Registered User
Join date: 2 Feb 2004
Posts: 39
|
03-20-2008 18:26
ok i need help here with something a little crazy, i need a script that will give items to people when i click it but to people i pick by name,,, like say i want to give a happy easter gift to 50 people on my friends list so say i load a notecard with the names of the people i want to give it to then the script reads the names from that card and give them the item for me so i dont have to look for them on my friends list and open there profile one by one and drop the item to them... is this doable and if so please help....
Edit: sorry for any mistakes very very sleepy here lol
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
03-20-2008 21:30
llGiveInventory
_____________________
| | . "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... | - 
|
|
raven Blair
Registered User
Join date: 2 Feb 2004
Posts: 39
|
03-21-2008 02:56
ya i know llGiveInventory i can make a script that will give someone something if they click on it and make it so it will give the item only to the owner but i dont know how to do it in mass amounts at a time.
|
|
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
|
03-21-2008 05:19
Untested but should work. you will need a notcard with a list of user keys not names. If you do not have the keys take a look at w-hat name2key.  key Query; string notename; integer noteline;
default { changed(integer change) { if (change & CHANGED_INVENTORY) { notename = llGetInventoryName(INVENTORY_NOTECARD, 0); Query = llGetNotecardLine(notename, noteline++); } } dataserver(key query_id, string datlin) { if (query_id != Query) // if it's not what we requested return; // ignore invalid data
if (datlin == EOF) // if we are at end of notecard { llRemoveInventory(notename); return; } llGiveInventory((key)datlin,"name of object"); Query = llGetNotecardLine(notename, noteline++); // get next line } }
to use it place the object you want to give into the prim with this script. drop the notecard with the list of keys onto the prim and it will do the rest.
|
|
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
|
03-21-2008 09:12
I had some more time so I created this one to use the w-hat name2key service. again it is not tested in\ SL but works fine in LSLEditor.exe same as above but drop a list of names rather than keys. key Query; key reqid; string object = "Name of your object"; string name; string URL = "http://w-hat.com/name2key"; // name2key url string notename; integer noteline; integer failed; default { changed(integer change) { if (change & CHANGED_INVENTORY) { notename = llGetInventoryName(INVENTORY_NOTECARD, 0); Query = llGetNotecardLine(notename, noteline++); } } dataserver(key query_id, string data) { if (query_id != Query) // if it's not what we requested return; // ignore invalid data
if (data == EOF) // if we are at end of notecard { llOwnerSay("sent "+(string)(noteline - failed) + ", "+(string)failed + " Key(s) were not found"); llRemoveInventory(notename); return; } reqid = llHTTPRequest( URL + "?terse=1&name=" + llEscapeURL(name = data), [], "" ); } http_response(key id, integer status, list meta, string uuid) { if ( id != reqid ) return; if ( status == 499 ) llOwnerSay("name2key request timed out"); else if ( status != 200 ) llOwnerSay("the internet exploded!!"); else if ( (key)uuid == NULL_KEY ) {llOwnerSay("No key found for " + name); failed++;} else //llOwnerSay(name + "'s key is: " + uuid ); llGiveInventory((key)uuid,object); Query = llGetNotecardLine(notename, noteline++); } }
Don't forget to enter the object name to give in the object string. With a slight modification it could read the object name as the first line of the note card, but as I am aready late to meet RL friends (yes RL) I will leave that as an exercise for the user 
|
|
raven Blair
Registered User
Join date: 2 Feb 2004
Posts: 39
|
03-21-2008 11:36
great got it and added changed some things around,,, it now wont auto send the items when you drop in the notecard but rather send it when you touch it 
|
|
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
|
03-21-2008 12:43
OK  I'n my opinion this is less flexible, but as an aid to help you learn LSL: //Very Keynes 2008-03-21 //public domain - use as you wish // key Query; key reqid; string object; string name; string URL = "http://w-hat.com/name2key"; // name2key url string notename = "names.txt"; integer noteline; integer failed;
default { touch_start(integer total_number) { //notename = llGetInventoryName(INVENTORY_NOTECARD, 0); Query = llGetNotecardLine(notename, noteline++); } dataserver(key query_id, string data) { if (query_id != Query) // if it's not what we requested return; // ignore invalid data
if (data == EOF) // if we are at end of notecard { llOwnerSay("sent "+object+" to "+(string)(noteline - failed - 2) + " people, "+(string)failed + " Key(s) were not found"); return; } if(1 == noteline){object = data; Query = llGetNotecardLine(notename, noteline++);} else reqid = llHTTPRequest( URL + "?terse=1&name=" + llEscapeURL(name = data), [], "" ); } http_response(key id, integer status, list meta, string uuid) { if ( id != reqid ) return; if ( status == 499 ) llOwnerSay("name2key request timed out"); else if ( status != 200 ) llOwnerSay("the internet exploded!!"); else if ( (key)uuid == NULL_KEY ) {llOwnerSay("No key found for " + name); failed++;} else llOwnerSay(name + " was Given "+object); llGiveInventory((key)uuid,object); Query = llGetNotecardLine(notename, noteline++); } }
But I did add the code to read the object name from the card. format the card like the following, but please use your own list of names for testing, dont spam my friends :) and rep-lace the lane that says object neme with the name of the object.
object name Imogen Spark judy Gourdou Ted Mathy Zandra Fraisse Stasy Latte Artistpainter Rossini Zai Jewell Hincapie Schmertzin Arriea Haight Nardi Beaumont 2Crazy4WordsRobin Pfeffer Lancelot Umarov Fox Obviate Triton Abel
As I removed the drop i have also removed the delete, and made the output more verbose.
|