MLPV2 Give Item Add-on

From Second Life Wiki
Revision as of 16:43, 14 June 2008 by Chaz Longstaff (talk | contribs) (New page: Add on tool for MLPV2 that puts a button on the MLPV2 menu that, when clicked, gives a user an object that you wish them to use with an animation. Steps to use:<br /> 1) Copy and paste ev...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Add on tool for MLPV2 that puts a button on the MLPV2 menu that, when clicked, gives a user an object that you wish them to use with an animation.

Steps to use:
1) Copy and paste everything below the double-line into a script called, for the sake of argument, "~give" (the script name is actually irrelevant; you may call it kumquat if you wish;)
2) Drop the script into the prim where you have the rest of the MLPV2 scripts;
3) Add the object that you wish to give out. Usually, it is either a prim object, or clothing. Note that this object to be given out needs to have both copy and transfer permissions set on it;
4) Add to the menu in an MLPV2 menu notecard the following line:

LINKMSG MyButtonName | 1,LINK_ALL,987789,NameOfObjectToOffer##MsgToPerson

In the above line, there are three elements for you to customize as appropriate:
MyButtonName -- the wording that you want to appear for the button on the blue menu
NameOfObjectToOffer -- the name of the object you are offering
MsgToPerson -- A message to be instant messaged to the person being offered the item, so they know what it is for, and don't think it's a random spammer or griefer passing by, etc.

Note that NameOfObjectToOffer and MsgToPerson are separated by a ## separator.

What you don't need to change in the above sample line:
1 -- means whether to make the MLPV2 menu go away or not -- generally set it to 1 as per the example, as otherwise the user might not see the accept prompt for the inventory being given
LINK_ALL -- no real reason generally to ever change this, though you may as you wish
987789 -- don't change this, this is the communication channel

_______________________________________________________
_______________________________________________________

//add-on by Chaz Longstff for MLPV2 by Lear Cale
//Function: gives object to someone on an MLPV2 ball
//in a menu card, format a menu button like this, for example:
//LINKMSG Give Book | 1,LINK_ALL,987789,little book(wear)##Wear This
//In this example, Give Book is the button name
//1 means whether to make the MLPV2 menu go away or not -- generally set it to 1 as per the example, as otherwise the user might not see the accept prompt for the inventory being given
//LINK_ALL -- no real reason to ever change this
//987789 -- don't change this, this is the communication channel
//little book(wear)##Wear This -- this is the item to give, followed by a message to be instant messaged to the recipient of the object. It's good to include a msg, so that they don't just think it's a griefer trying to hand them something. Notice the object to give, and the accompanying msg, are separate by ##

//parameters 
string ObjectToGive;
string message;
//_________________________
default{
   link_message(integer from, integer num, string str, key id) { 
       if (num == 987789) {
           list TempList = llParseStringKeepNulls(str,["##"],[]);
           ObjectToGive = llStringTrim(llList2String(TempList, 0),STRING_TRIM);
           message = llStringTrim(llList2String(TempList, 1),STRING_TRIM);
           if (  ( llGetInventoryType(ObjectToGive) != INVENTORY_NONE)
           && ( llGetInventoryPermMask(ObjectToGive, MASK_NEXT) & PERM_COPY)
           && ( llGetInventoryPermMask(ObjectToGive, MASK_NEXT) & PERM_COPY) ) {
               if (message != "") {
                   llInstantMessage(id,message + " " + ObjectToGive);
               }
               llGiveInventory(id,ObjectToGive);
           }
       } //end if checking for right channel
   }//end link_message event
} //end default state