|
Random Torok
Registered User
Join date: 19 Mar 2007
Posts: 33
|
09-18-2007 20:35
Ok, several people have asked in the script group for this kind of script. this script will give out multiple notecards regardless of the notecard name. The example will give out 2 notecards, to give out more you duplicate the llGiveInventory line and increment the number at the end. default { state_entry() { } touch_start(integer total_number) { llSay(0, "Thank you for requesting this information"  ; llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD, 0)); llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD, 1)); } on_rez(integer start_param) { llResetScript(); } }
|
|
Echo Eros
SL Mentor & Scripter
Join date: 17 Feb 2007
Posts: 2
|
2 Different ways to yours, Easy , Hard
09-24-2007 02:10
Less Lines: [Easy] default { touch_start(integer n) { llSay(0, "Thank you for requesting this information"  ; llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD, 0)); llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD, 1)); } } More Lines: [Hard] integer amount = 2; //Amount of notecards In the object default { touch_start(integer n) { llSay(0, "Thank you for requesting this information"  ; integer x; for (x = 0; x < amount; x++) { llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD,x)); } } }
_____________________
 Currently: Furry,Scripter & Lost
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
09-24-2007 04:01
Back at ya Echo 
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Buffy Wilder
Registered User
Join date: 12 Jan 2007
Posts: 16
|
09-24-2007 07:07
May i introduce the magic llGetInventoryNumber function at this point, no need to hardcode the number of things to give out  Buffy default { touch_start(integer n) { integer i; llSay(0, "Thank you for requesting this information"  ; for (i = 0; i < llGetInventoryNumber(INVENTORY_NOTECARD); i++) { llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD,i)); } } p.s. you should also really be checking to see if multiple people have clicked and not just assuming one and giving out to the id behind llDetectedKey(0) default { touch_start(integer n) { integer i; integer j; llSay(0, "Thank you for requesting this information"  ; for(j=0;j<n;j++) { for (i = 0; i < llGetInventoryNumber(INVENTORY_NOTECARD); i++) { llGiveInventory(llDetectedKey(j),llGetInventoryName(INVENTORY_NOTECARD,i)); } } }
|