User:Daemonika Nightfire/Scripts/Region Reboot Messenger

From Second Life Wiki
Jump to navigation Jump to search

*DS* Region Reboot Messenger

Multi-User Version

With this script, find all that are specified in the list when the Sim is back after a restart. So you must then not always look on the map, if the sim is back there.

This is very useful if the sim is restarted during a party.

Script Time!

The Script 0.002 - 0.003 ms.
// *DS* Region Reboot Messenger by Daemonika Nightfire (daemonika.nightfire)    
// Ready for Multi-User, you can set more than one Person to get a message when the Sim where this script is running has restart.
// The Messenger tell you the SLurl to the Region too.

// change in this Memberslist the UUIDs with the Keys from the People you need to get a message.
list Members = ["61ee201a-81cf-4322-b9a8-a5eb8da777c2",  // its me
                "61ee201a-81cf-4322-b9a8-a5eb8da777c2",  // me again
                "61ee201a-81cf-4322-b9a8-a5eb8da777c2"]; // another one me (list expandable)

string SLurl;
string BuildSlurl(string region_name, vector pos)
{
    return "http://slurl.com/secondlife/" + llEscapeURL(region_name) 
            + "/"+ (string)((integer)pos.x) 
            + "/"+ (string)((integer)pos.y) 
            + "/"+ (string)(llCeil(pos.z));
}

default
{
    state_entry()
    {
        llSetText("Landmark to the Club/Mainstore",<1,1,1>,1.0); // floating text
        SLurl = BuildSlurl(llGetRegionName(),llGetPos());
    }

    changed(integer ch)
    {
        if(ch & CHANGED_REGION_START)
        {
            integer i;
            for(i=0; i<llGetListLength(Members); i++)
            {
                llInstantMessage(llList2String(Members,i),"Region has Restarted @ " + SLurl);
            }
        }
    }

    touch_start(integer nd)
    {
        if(llGetInventoryNumber(INVENTORY_LANDMARK) > 0) // LM giver
        {
            llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_LANDMARK, 0));
        }
    }

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

Single-User (Owner) Version

With this script, disguised as "LM giver" you are always up to date, how many times your rented shop, a sim restart is exposed.

Script Time!

The Script 0.002 - 0.003 ms.
key Owner;

string SLurl;
string BuildSlurl(string region_name, vector pos)
{
    return "http://slurl.com/secondlife/" + llEscapeURL(region_name) 
            + "/"+ (string)((integer)pos.x) 
            + "/"+ (string)((integer)pos.y) 
            + "/"+ (string)(llCeil(pos.z));
}

default
{
    state_entry()
    {
        Owner = llGetOwner();
        llSetText("Landmark to the Club/Mainstore",<1,1,1>,1.0); // floating text
        SLurl = BuildSlurl(llGetRegionName(),llGetPos());
    }

    changed(integer ch)
    {
        if(ch & CHANGED_REGION_START)
        {
            llInstantMessage(Owner,"Region has Restarted @ " + SLurl);
        }
    }

    touch_start(integer nd)
    {
        if(llGetInventoryNumber(INVENTORY_LANDMARK) > 0) // LM giver
        {
            llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_LANDMARK, 0));
        }
    }

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

German Diskusion