Action disabled: backlink

The first script sits in the outer box of the dispenser, (together with the notecard about the instructions on how to use it) processing the initial request and responding to visitors walking by.

list recent_avatars;

add_avatar(string name) {
    if(!seen(name)) {
        recent_avatars += name;
        if (llGetListLength(recent_avatars) > 25) {
            recent_avatars = llDeleteSubList(recent_avatars,0,0);
        }
    }
}
integer seen(string name) {
    if(llListFindList(recent_avatars,[name]) > -1) { return TRUE; }
    return FALSE;
}


default
{

    state_entry() {
        llSensorRepeat("", NULL_KEY, AGENT, 15, PI, 5);
        llSetText("Click here to get the decay script", <1.0,0,0>, 1.0);
    }
    sensor(integer total_number) {
        if(!seen(llDetectedName(0))) {
        // speak out loud!
        llSay(0,"Please touch to get the decay script, to be placed inside your trashed object."); // creates text hovering above the script distributor

    add_avatar(llDetectedName(0));
    }
}


    touch_start(integer total_number)
    {
        // Sends the message 0, "Touched.", key from requester to all scripts in this prim
        // that contain a link_message() event handler.
        llMessageLinked(2, 0, "Touched.", llDetectedKey(0));       
        // The 2 sends the message to the first linked prim only.
    }

}

The second script receives the call for the decaying script and gives it to the requester.

// Receiver script, to be placed inside the inner linked object
default
{
    // Waits for another script to send a link message.
    link_message(integer sender_num, integer num, string str, key id)
    {
                // This line will pick out the first thing of the right type and give it to whomever triggered the event
        llGiveInventory(id,llGetInventoryName(INVENTORY_SCRIPT,0));

    }
}
decay_dispenser.txt · Last modified: 2016/02/15 21:12 (external edit)
www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0