Bubble Trapper - Bubble

bubble_trapper_homing.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2011 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
///////////////////////////////////////////////////////////////////////////
//                              INTERNALS                                //
///////////////////////////////////////////////////////////////////////////
 
integer Name2Number(string name) {
    list alph = ["*", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
    integer i = llStringLength(name)-1;
    integer ahash = 0;
    do {
        ahash += llListFindList(alph, (list)llToLower(llGetSubString(name, i, i)));
    } while(--i>-1);
    return ahash;
}
 
integer hidTarget = -1;
integer nTarget = -1;
key avKey = NULL_KEY;
 
default
{
    at_target(integer tnum, vector targetpos, vector ourpos) {
        if(avKey == NULL_KEY) return;
        avKey = NULL_KEY;
        llSetTimerEvent(2);
    }
    not_at_target() {
        llTargetRemove(nTarget);
        vector pos = llList2Vector(llGetObjectDetails(avKey, [OBJECT_POS]), 0);
        nTarget = llTarget(pos, 1);
        llMoveToTarget(pos, .5);
    }
    timer() {
        llSetTimerEvent(0);
        llSetStatus(STATUS_PHYSICS, FALSE);
        vector size  = llGetScale();
        float xsize = size.z + size.z/2;
        float i = size.z;
        do {
            llSetScale(<i, i, i>);
            llSleep(1);
        } while(++i<xsize);
        llPlaySound("ff0600f0-d8f4-20f6-52ec-a03bc520fee3", 1);
        llDie();
    }
    on_rez(integer param) {
        hidTarget = param;
        llSetPrimitiveParams([PRIM_TEMP_ON_REZ, 1]);
        llPreloadSound("ff0600f0-d8f4-20f6-52ec-a03bc520fee3");
        llSensorRepeat("", "", AGENT, 96, TWO_PI, 1.1-llGetRegionTimeDilation()); 
    }
    sensor(integer num) {
        --num;
        do {
            avKey = llDetectedKey(num);
            if(Name2Number(llGetSubString(llKey2Name(avKey), 0, 12)) != hidTarget) jump continue;
            llSensorRemove();
            vector size = llGetAgentSize(avKey);
            size.z += .17 + .5;
            llSetScale(<size.z, size.z, size.z>);
            llSetStatus(STATUS_PHYSICS|STATUS_PHANTOM, TRUE);
            vector pos = llList2Vector(llGetObjectDetails(avKey, [OBJECT_POS]), 0);
            nTarget = llTarget(pos, 1);
            llMoveToTarget(pos, .5);
            return;
@continue;
        } while(--num>-1);
    }
}

Index


secondlife/bubble_trapper/bubble.txt ยท Last modified: 2022/11/24 07:46 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.