Once we got to know how to tackle note cards and sending emails, we were asked to create a mailbox object which allows an avatar to drop a note card and this is sent to the owner of the mailbox – in this case, my avatar. A notecard is available to be viewed at a later stage. This is the required work for the next two weeks.
The mailbox is created using a typical London red mailbox as an inspiration as shown below.
This object is made up of a number of cylinders of different sizes. At the top, a semicircle is added with custom settings in order to produce the same rotating top of a mailbox.
Color is added.
A small box which would ‘insert’ a notecard is added to the mailbox to make it more realistic.
Next, a script is added. This is discussed later on in this blog entry. The script initially asks to user to touch the mailbox and the small entry in it would light up. Also, on dropping a notecard on it, my avatar is able to read the notecard later on.
Some explanations on the script used for this mailbox is done below. Later on, a link is provided to see the full script.
Light
The light script has been researched for and found through this link:
http://wiki.secondlife.com/wiki/Category:LSL_Light. Initially, a number of variables are declared and initialised. The first method is switchit() which basically occurs on an avatar’s request to switch the light on or off. If it is not switched on, it will do so by the
llSetColor() function.
By default, the mailbox displays a message stating “Touch for light”. This is shown in the images above. One important function for this work is the llAllowInventoryDrop() function which must be set to TRUE. This is the script which allows a notecard, which is later on specified, to be added by another avatar.
Sending notecard
On clicking on the mailbox, the switchit() method is called and the light is switched on or off accordingly. Also, the llGiveInventory() function is triggered which finds the notecard to be sent to my avatar.
When the inventory is changed, which means that a notecard has been dropped in the mailbox, a message is displayed to my avatar. This has been tested by a number of my colleagues when their avatar sent a notecard to mine. This is shown in the image below.
The script for both light and sending notecard can be seen through this link: