// Simple lm giver script
//
// Just finds the first landmark stored in the prim and
// gives it on touch.
//
// Also, if configured, will give out a URL or a link to a group.
//
// If a notecard is present in the inventory, it can give that too.
//
// If any of these things are not present, then they will not be
// presented as an option.
//
// Kimm Paulino
// Written for Vikki Hastings, Jan 2011
// Configure the behaviour we want
string gFloatingText = "Click for Landmark"; // Set to "" to disable
vector gFloatingTextColour = <1 .0, 1.0, 1.0>;
float gFloatingTextAlpha = 1.0;
string gLm1;
string gLm2;
string gNC;
string gUrl="https://wiki.secondlife.com/wiki/User:Kimm_Paulino/Scripts"; // HTTP URL to give out
string gGroup="OBJECT"; // UUID only for the group or OBJECT if it is to take the prims group
integer gChannel;
integer getRandomChannel ()
{
// Based on http://tali.appspot.com/html/scripting/snippets.html
// Always leaves 17th bit set (so never a number less than 65535)
// Always leaves sign bit unset (so is always positive)
integer pos_int = (((integer)llFrand(16384)) << 17) | 65536 | ((integer)llFrand(65535));
return -pos_int;
}
give_landmark (key av)
{
if (gLm1 != "")
{
llGiveInventory(av, gLm1);
}
if (gLm2 != "")
{
llGiveInventory(av, gLm2);
}
}
give_notecard (key av)
{
if (gNC != "")
{
llGiveInventory(av, gNC);
}
}
give_link (key av)
{
if (gUrl != "")
{
llLoadURL (av, "Giving Link", gUrl);
}
}
give_group (key av)
{
if (gGroup != "")
{
llWhisper (0, "Click on the following link to join the group\nsecondlife:///app/group/" + gGroup + "/about");
}
}
default
{
on_rez (integer start_param)
{
llResetScript();
}
state_entry()
{
if (gGroup == "OBJECT")
{
// Use the group from the prim
gGroup = llList2Key(llGetObjectDetails(llGetKey(), [OBJECT_GROUP]), 0);
}
// See if there are landmarks to give out
gLm1 = llGetInventoryName(INVENTORY_LANDMARK, 0);
gLm2 = llGetInventoryName(INVENTORY_LANDMARK, 1);
gNC = llGetInventoryName (INVENTORY_NOTECARD, 0);
llSetText (gFloatingText, gFloatingTextColour, gFloatingTextAlpha);
gChannel = getRandomChannel();
llListen (gChannel, "", "", "");
}
touch_start(integer total_number)
{
list buttons=[];
if (gLm1 != "")
{
buttons += ["Landmark"];
}
if (gUrl != "")
{
buttons += ["Link"];
}
if (gGroup != "")
{
buttons += ["Group"];
}
if (gNC != "")
{
buttons += ["Notecard"];
}
integer i;
for (i=0; i