Tutorial: Create a box that gives an item when clicked (beginner)
Tutorial: Create a box that gives an item when clicked (beginner)
In this tutorial, I will add a simple script to a box that gives a notecard containing a landmark to someone when they click on it. It does not require any scripting knowledge, other than the ability to replace some sample text in a script. This tutorial assumes that you know how to create a box and add a texture to it.
The tutorial begins with the box that will be used already created and textured. You can use an item that you have modify permissions on, and the item given does not have to be a notecard. The same basic principles apply for all item types, which I will explain below.
Step 1: Take the box or item out of inventory that you would like to add the script to.
2. I am going to create a new notecard to be given by the box. Go into the inventory window and click Create-->New Note. If you already have an item, you can skip to step 6.
3. This will create a blank notecard in your inventory. Double click on it to open it.

4. Add some text to the notecard, change the description if you would like. I also dragged a landmark from my Landmarks folder onto the notecard. Save the notecard by clicking on Save. Note: If you cannot drag a landmark, right click on it, select Properties, and make sure you turn on copy and modify permissions for the landmark. You should then be able to drag it into the notecard.
5. Right click on the notecard in your Note Cards folder and Rename it to something descriptive. I named my notecard Azura Note. 
6. Right click on the object from step 1 that you are using to give the item, and go into Edit mode. Click on Content, and drag the notecard or other item that you are using into the Contents folder of the object.
7. Click on the New Script button on the Content tab of the object. This will create a new script in the object. Double click the script to edit it. You will see the following window - each new script starts out with a basic script already in place. Remove the line that says llSay(0,"Touched."); completely, leaving just a blank line between the { } under touch_start.
8. Type the following line in the place where you removed the previous line, replacing Azure Note with the name of your item (keeping the " " ) around it.
llGiveInventory(llDetectedKey(0), "Azura Note");
Be careful, case is important, so type it exactly as the line appears, and with the exact name of your item. Don't forget the ; at the end of the line. Also note that those are two lower case L's before GiveInventory and DetectedKey (as in Linden Lab).
9. Click Save and if you did not make any mistakes, you should see Compile Succesful, saving... and then Save Complete in the script window. You should also then see Hello, Avatar! appear. This will only happen when the script is reset. Close the script window and the edit window for your object, and try clicking on the object. Be certain the edit window is closed, or the touch event will not function.
If done correctly, the object should give you a notecard (or whatever item you used), with the option to keep or discard it when you click on it (if the item is a notecard).
Good luck and feel free to send me a message if you need assistance with this or any of the tutorials.
Cristiano