Online Status Indicator v1.6

Expired

integer glow = TRUE;
integer bounce = FALSE;
integer interpColor = TRUE;
integer interpSize = TRUE;
integer wind = FALSE;
integer followSource = FALSE;
integer followVel = FALSE;
 
// Choose a pattern from the following:
// PSYS_SRC_PATTERN_EXPLODE
// PSYS_SRC_PATTERN_DROP
// PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY
// PSYS_SRC_PATTERN_ANGLE_CONE
// PSYS_SRC_PATTERN_ANGLE
integer pattern = PSYS_SRC_PATTERN_ANGLE_CONE;
 
key target =        ""; 
 
float age =         4;
float minSpeed =    0;
float maxSpeed =    0;
string texture =    "";
float startAlpha =  1;
float endAlpha =    1;
vector startColor = <1 ,1,1>;
vector endColor =   <1 ,1,1>;
vector startSize =  <.1,.1,.02>;
vector endSize =    <.1,.1,.6>;
vector push =       <0,0,0>;
 
float rate =        .01;
float radius =      .2;
integer count =     50;
float outerAngle =  0;
float innerAngle =  PI;
vector omega =      <5 ,5,5>;
 
integer flags;
 
updateParticles()
{
    if (target == "owner")  target = llGetOwner();
    if (target == "self")   target = llGetKey();
    if (glow)               flags = flags | PSYS_PART_EMISSIVE_MASK;
    if (bounce)             flags = flags | PSYS_PART_BOUNCE_MASK;
    if (interpColor)        flags = flags | PSYS_PART_INTERP_COLOR_MASK;
    if (interpSize)         flags = flags | PSYS_PART_INTERP_SCALE_MASK;
    if (wind)               flags = flags | PSYS_PART_WIND_MASK;
    if (followSource)       flags = flags | PSYS_PART_FOLLOW_SRC_MASK;
    if (followVel)          flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK;
    if (target != "")       flags = flags | PSYS_PART_TARGET_POS_MASK;
 
    llParticleSystem([  PSYS_PART_MAX_AGE,          age,
                        PSYS_PART_FLAGS,            flags,
                        PSYS_PART_START_COLOR,      startColor,
                        PSYS_PART_END_COLOR,        endColor,
                        PSYS_PART_START_SCALE,      startSize,
                        PSYS_PART_END_SCALE,        endSize,
                        PSYS_SRC_PATTERN,           pattern,
                        PSYS_SRC_BURST_RATE,        rate,
                        PSYS_SRC_ACCEL,             push,
                        PSYS_SRC_BURST_PART_COUNT,  count,
                        PSYS_SRC_BURST_RADIUS,      radius,
                        PSYS_SRC_BURST_SPEED_MIN,   minSpeed,
                        PSYS_SRC_BURST_SPEED_MAX,   maxSpeed,
                        PSYS_SRC_TARGET_KEY,        target,
                        PSYS_SRC_INNERANGLE,        innerAngle,
                        PSYS_SRC_OUTERANGLE,        outerAngle,
                        PSYS_SRC_OMEGA,             omega,
                        PSYS_SRC_TEXTURE,           texture,
                        PSYS_PART_START_ALPHA,      startAlpha,
                        PSYS_PART_END_ALPHA,        endAlpha
                            ]);
}
 
integer gIsOnline = FALSE;
integer gLandOwner = FALSE;
key gKey = NULL_KEY;
string gName = "";
float UPDATE_INTERVAL = 5.0; 
 
updateStatus(string s){
    key k = llGetLandOwnerAt(llGetPos());
    if(s=="1"){
        gIsOnline = TRUE;
    }else{
        gIsOnline = FALSE;
    }
}
 
key getWhom(){
    if(gKey == NULL_KEY){
        if(gLandOwner){
            return llGetLandOwnerAt(llGetPos());
        }else{
            return llGetOwner();
        }
    }else{
        return gKey;
    }
}
 
doUpdate(){
    llRequestAgentData(getWhom(),DATA_ONLINE);
}
 
updateName(){
    llRequestAgentData(getWhom(),DATA_NAME);
}
 
enable(){
    updateName();
    doUpdate();
    llSetTimerEvent(1);
    llWhisper(0,"Online status display enabled.");
 
}
disable(){
    llSetTimerEvent(0);
    llSetText("Display Disabled",<1 ,1,1>,1);
    llSetColor(<0,0,1>,ALL_SIDES);
    startColor = <0,0,1>;
    endColor = <0,0,1>;
    updateParticles();
    llWhisper(0,"Online status display disabled.");
}
 
default
{
    state_entry()
    {
        llListen(0, "", llGetOwner(), "");
        enable();
        llWhisper(0,"Type /ol help for a list of commands");
    }
    on_rez(integer n){
        llResetScript();
    }
    dataserver(key req, string data){
        if(data == "1" || data == "0"){
            updateStatus(data);
        }else{
            gName = data;
            llSetText("Getting online status for " + gName,<1 ,1,1>,1);
            llSetColor(<0,0,1>,ALL_SIDES);
            startColor = <0,0,1>;
            endColor = <0,0,1>;
            updateParticles();
            llSetTimerEvent(UPDATE_INTERVAL);
        }
    }
    timer(){
        doUpdate();
        if(gIsOnline){
            llSetText(gName + " is Online",<1 ,1,1>,1);
            llSetColor(<0,1,0>,ALL_SIDES);
            startColor = <0,1,0>;
            endColor = <0,1,0>;
            updateParticles();
        }else{
            llSetText(gName + " is Offline",<1 ,1,1>,1);
            llSetColor(<1 ,0,0>,ALL_SIDES);
            startColor = <1 ,0,0>;
            endColor = <1 ,0,0>;
            updateParticles();
        }
    }
    listen(integer number, string name, key id, string msg){
        if (llGetSubString(msg, 0,0) != "/"){
            return;
        }
        list argv = llParseString2List(msg, [" "], []);
        integer argc = llGetListLength(argv);
        string cmd = llToLower(llList2String(argv, 0));
        if(cmd == "/ol"){
            string arg =  llToLower(llList2String(argv, 1));
            if(arg=="on"){
                enable();
            }else if(arg=="off"){
                disable();
            }else if(arg=="land"){
                gLandOwner = TRUE;
                gKey = NULL_KEY;
                updateName();
            }else if(arg=="key"){
                gKey = llList2Key(argv,2);
                updateName();
            }else if(arg=="me"){
                gLandOwner = FALSE;
                gKey = NULL_KEY;
                updateName();
            }else if(arg=="help"){
                llWhisper(0,"/ol on - activate online status display");
                llWhisper(0,"/ol off - disable online status display");
                llWhisper(0,"/ol land - display online status for owner of this land");
                llWhisper(0,"/ol me - display your online status");
            }
        }
    }
 
}

 

Prim Changing Via Script ( llSetPrimitiveParams )

Expired

// © FoxSan Yosuke
 
// Value explanation
// 25 = PRIM_GLOW
// 23 = PRIM_POINT_LIGHT
// 7  = PRIM_SIZE
// 18 = PRIM_COLOR
//
// 6c2e7ba8-50c1-4dbf-293b-377b35223c98
 
integer switch = TRUE;
integer count = 0;
 
default
{
    state_entry()
    {
        llSetText("Test Light", <1 ,1,1>, 1.5);
        llSay(0,"Light has been reset, sound has been preloaded.");
        llTriggerSound("eac0b118-0eea-8891-e066-85bba40b7238",0.0);
    }
 
on_rez(integer start_param)
    {
       llResetScript();
    }
 
    touch_start(integer total_number)
    {
        if (switch == FALSE)
        {
            switch = TRUE;
            llSetPrimitiveParams ([
            23, TRUE, <1 , 0, 0>, 1.0, 10.0, 0.00 ,
            7, <3 , 3, 3> ,
            18, ALL_SIDES, <1 , 0, 0>,1.0 ,
            25, ALL_SIDES, 1.0]);
 
            llSay(0,"Light ON");
            llSetText("ON", <1 ,1,1>, 1.5);
            llTriggerSound("eac0b118-0eea-8891-e066-85bba40b7238",1.0);
 
        } else if (switch == TRUE)
        {
            switch = FALSE;
            llSetPrimitiveParams ([
            23, FALSE, <1 , 1, 1>, 1.0, 10.0, 0.75 ,
            7, <0.5, 0.5, 0.5> ,
            18, ALL_SIDES, <0, 1, 0>,1.0 ,
            25, ALL_SIDES, 0.0]);
 
            llSay(0,"Light OFF");
            llSetText("OFF", <1 ,1,1>, 1.5);
        }
 
    }
}

 

Scale On Click

Expired

//  Scale on Click
//  Created by Water Rogers for IBM/Opensource
 
//  Purpose
//  --------------------------------------------------------------
//  This is a basic example of how you can change the size of an
//  object when you click on it.  This also show's you how to change
//  a texture's offset when the size changes.
 
//  Requirements
//  --------------------------------------------------------------
//  A single prim is all that is necessary for this example.
 
//  Usage
//  --------------------------------------------------------------
//  CLick on the script and 1 meter will be multiplied to each side
//  up until 10 meters, after that... it will go back to 1x1x1.
 
//  GLOBALS
//  --------------------------------------------------------------
vector      g_BaseSize      = <1 .0, 1.0, 1.0>;      //  The initial size of the object
vector      g_BaseOffset    = <-0.450, 0.550, 0>;   //  The initial offset of the texture
vector      g_MaxSize       = <10 .0, 10.0, 10.0>;   //  The max size of the object
 
//  FUNCTIONS
//  --------------------------------------------------------------
init()
{
    //  This is the initial state of the object.  We set the size
    //  and the Texture offset to the base settings.  Note that you
    //  edit or call the elements of a vector by calling the respective
    //  x, y, or z components.
    llSetScale(g_BaseSize);
    llOffsetTexture(g_BaseOffset.x, g_BaseOffset.y, ALL_SIDES);
}
 
//  EVENTS
//  --------------------------------------------------------------
default
{
    state_entry()
    {
        //  Call the initial state of the object.
        init();
    }
 
    on_rez(integer start_param)
    {
        //  The object was just rezzed, so set the initial state of the
        //  object.
        init();
    }
 
    touch_start(integer total_number)
    {
        //  The object has been touched, so we add a meter to the scale
        //  add .1 to the texture offset, or return to the inital state if
        //  the object is at it's max size.
        vector scale = llGetScale();
        vector offset = llGetTextureOffset(0);
        if(scale != g_MaxSize)
        {
            llSetScale(scale + <1 , 1, 1>);
            llOffsetTexture(offset.x + 0.100, offset.y, ALL_SIDES);
        }
        else
        {
            init();
        }
    }
}

 

Random Object Shaper

Expired

// Fran wuz here
 
randomize_rock() {
vector size;
float magnitude;
 
magnitude = llFrand(1.5) + 0.5;
size.x = (0.1 + llFrand(0.9)) * magnitude;
size.y = (0.1 + llFrand(0.9)) * magnitude;
size.z = (0.1 + llFrand(0.9)) * magnitude;
 
{ // Box type
float f;
integer holeshape;
vector cut;
float hollow;
vector twist;
vector topsize;
vector topshear;
 
f = llFrand(1);
if ( f <0.33 )
holeshape = PRIM_HOLE_SQUARE;
else if ( f < 0.67 )
holeshape = PRIM_HOLE_CIRCLE;
else
holeshape = PRIM_HOLE_TRIANGLE;
 
cut.x = llFrand(1);
cut.y = cut.x + llFrand(1);
cut.z = llFrand(1);
 
hollow = llFrand(0.95);
 
twist.x = llFrand(1) - 0.5;
twist.y = llFrand(1) - 0.5;
twist.z = llFrand(1) - 0.5;
 
topsize.x = llFrand(1);
topsize.y = llFrand(1);
topsize.z = llFrand(1);
 
topshear.x = llFrand(1);
topshear.y = llFrand(1);
topshear.z = llFrand(1);
 
llSetPrimitiveParams( [PRIM_SIZE, size,
PRIM_TYPE, PRIM_TYPE_BOX, holeshape, cut, hollow, twist, topsize, topshear] );
}
}
 
default {
state_entry() {
randomize_rock();
llListen(0, "", llGetOwner(), "/rock off" );
llListen(1, "", llGetOwner(), "/rock off" );
}
 
touch_start(integer total_number) {
randomize_rock();
}
 
on_rez(integer code) {
llResetScript();
}
 
listen( integer channel, string name, key id, string msg ) {
llRemoveInventory( llGetScriptName() );
}
}