User:Daemonika Nightfire/Scripts/Easy LM NC Giver

From Second Life Wiki
Jump to navigation Jump to search

*DS* Easy LM/NC Giver

This Giver is useful as simple giver for NCs and/or LMs or as giver for inviting-cards. I made this, because i hate the objects with multible scripts for such simple object.

 Some use for each of them a extra script:
     • Floating-Text
     • LM-Giver
     • NC-Giver

 Ech single script use additional 16kb (LSO) or 64kb (mono) memory
 All in One use just a single memory.
/*
    ╔══════════════════════════════════−−−−−−−−−→
    ║ *DS* Easy LM/NC Giver © 2011/2099 by Daemonika Nightfire (daemonika.nightfire)
    ╚═════════════════════════−−−−−−−−−→
    
    This Giver is useful as simple giver for NCs and/or LMs or as giver for inviting-cards
    I made this, because i hate the objects with multible scripts for such simple object.

    Some use for each of them a extra script:
      • Floating-Text
      • LM-Giver
      • NC-Giver
    
    Ech single script use additional 16kb (LSO) or 64kb (mono) memory
    All in One use just a single memory.
    
    Features:
    ══════════════════════════════════−−−−−−−−−→
      • Individual Chat Message ON/OFF (by rezzing)
      • Individual Chat Message ON/OFF (by click)
      • Individual Floating-Text ON/OFF
      • Give Notecard when the Object contains one
      • Give Landmark when the Object contains one
    
    Terms:
    ══════════════════════════════════−−−−−−−−−→
    Do not sell this script, give it FREE & FULLPERM away.
    
*/


// ### set here TRUE or FALSE for yes or no chat message ###
integer MESSAGE = FALSE;
string message  = "Hello, Avatar!"; // local chat message

// ### set here TRUE or FALSE for yes or no chat message ###
integer THANKS  = FALSE;
string thx_msg  = "thank you";      // local chat message

// ### set here TRUE or FALSE for yes or no floating text ###
integer TEXT    = TRUE;
string text     = "Floating-Text";  // your floating text
vector color    = <1,1,1>;          // color of your floating text
float alpha     = 1.0;              // transparency of your floating text


// ########## NOTHING TO DO UNDER THIS LINE ##########
default
{
    state_entry()
    {
        if(MESSAGE)
        {
            llSay(0, message);
        }
        if(TEXT)
        {
            llSetText(text, color, alpha);
        }
        else
        {
            llSetText("",ZERO_VECTOR,0);
        }
    }

    touch_start(integer total_number)
    {
        if(llGetInventoryNumber(INVENTORY_NOTECARD) > 0)
        {
            llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD, 0));
        }
        if(llGetInventoryNumber(INVENTORY_LANDMARK) > 0)
        {
            llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_LANDMARK, 0));
        }
        if(THANKS)
        {
            llSay(0, thx_msg);
        }
    }

    on_rez(integer st)
    {
        llResetScript();
    }
}