Difference between revisions of "Random AV Profile Projector"

From Second Life Wiki
Jump to navigation Jump to search
Line 6: Line 6:


<lsl>
<lsl>
// ~ RANDOM AV PROFILE PICTURE PROJECTOR v4.0 by Debbie Trilling ~
// ~ RANDOM AV PROFILE PICTURE PROJECTOR v5.0 by Debbie Trilling ~


// *** This script randomly selects an AV from a crowd & then projects their
// *** This script randomly selects an AV from a crowd & then displays their
// profile picture as a 'holographic' image ***
// profile picture as texture on a prim and/or a 'holographic' image projected above the prim***


// Free to use as you wish by under condition
// Free to use as you wish by under condition that the title and this introduction remain in place,
// that the title and this introduction remain in place, and that due credit
// and that due credit continues to be given to Moriash Moreau, Jana Kamachi and Solar Alter, and
// continues to be given to Moriash Moreau, Jana Kamachi and Solar Alter,
// Debbie Trilling.
// and Debbie Trilling.


// TOUCH to switch ON and OFF
// TOUCH to switch ON and OFF
Line 20: Line 19:
// ** PARAMETERS THAT YOU CAN CHANGE **
// ** PARAMETERS THAT YOU CAN CHANGE **


//************************
// GENERAL PARAMETERS
//************************
// how often in seconds the sensor fires
// how often in seconds the sensor fires
float RepeatTime = 35.00;
float RepeatTime = 35.00;
Line 26: Line 29:
float Range = 25.00;
float Range = 25.00;


// length & width size in meters of the projected image (max 4.00)
// sets the number of conseqtive times that the scanner is allowed to operate without having located an AV within range
// eg: if RepeatTime = 60.0 seconds and TotalNoScansAllowed = 30, then the toy will operate for 1800 seconds (60x30, or 30 minutes) without locating
// anyone before it automatically powers down. Set to '0.00' to disable the auto-off function
integer TotalNoScansAllowed = 20;
 
// sets whether the DefaultTexture will be projected when the toy is switched OFF. 'TRUE' to project; 'FALSE' to have no projection when off
integer ProjectDefaultTexture = TRUE;
 
// texture palette of UUID's. One will be randomly selected for display when an AV without a profile pic is selected
list DefaultTexture = ["7cfd684e-2141-941c-eac8-bd439f0d5a9f", "d02531dd-491c-45b5-2cab-2e47ec81ec0d", "c3eebd9e-ee92-a16f-f906-bc275928df86"];
 
 
//************************
// PARTICLE EMISSION PARAMETERS
//************************
// set to TRUE to display the profile picture as a particle 'holographic' image above the prim
integer DisplayBanner = TRUE;
 
// width size in meters of the projected image (max 4.00)
float Size = 2.50;
float Size = 2.50;


Line 32: Line 53:
float Height = 2.50;
float Height = 2.50;


// texture palette of UUID's. One will be randomly selected for display when an AV without a profile pic is selected
list DefaultTexture = ["7cfd684e-2141-941c-eac8-bd439f0d5a9f", "d02531dd-491c-45b5-2cab-2e47ec81ec0d", "c3eebd9e-ee92-a16f-f906-bc275928df86"];


//************************
// PRIM TEXTURE PARAMETERS
//************************
// set to TRUE to texture the prim with the profile picture on ALL_SIDES
integer TexturePrim = TRUE;
// the following 'Prim*' parameters effect the prim only if ProjectDefaultTexture = FALSE
// if ProjectDefaultTexture = TRUE then the prim is automatically set to solid blank white with full bright
// texture to use for the prim when toy is OFF
key PrimTexture = "5748decc-f629-461c-9a36-a35a221fe21f";
// set to TRUE to turn on Full Bright on ALL_SIDES when the toy is OFF
integer PrimFullBright = FALSE;
// vector for the prim colour when toy is OFF
vector PrimColour = <0.0, 0.0, 0.0>;
// set the alpha of the prim from 0.0 (clear) to 1.0 (solid) for when toy is OFF
float PrimAlpha = 1.00;
//************************
// SHOUTOUT PARAMETERS
//************************
// set to 'TRUE' to give a 'ShoutOut' to the AV once they have been selected; 'FALSE' for no 'ShoutOut'
// set to 'TRUE' to give a 'ShoutOut' to the AV once they have been selected; 'FALSE' for no 'ShoutOut'
integer ShoutOut = TRUE;
integer ShoutOut = TRUE;


// text to 'ShoutOut' when an AV's profile is projected. Text will be proceeded by their name, eg: "<AV Name>'s face is up in lights!"
// text to 'ShoutOut' when an AV's profile is projected. Text will be preceeded by their name, eg: "<AV Name>'s face is up in lights!"
string ShoutOutText = "'s face is up in lights!";
string ShoutOutText = "'s face is up in lights!";


// sets the number of consequtives times that the scanner is allowed to operate without having located an AV within range
// eg: if RepeatTime = 60.0 seconds and TotalNoScansAllowed = 30, then the toy will operate for 1800 seconds (60x30, or 30 minutes) without locating
// anyone before it automatically powers down. Set to '0.00' to disable the auto-off function
integer TotalNoScansAllowed = 20;


// sets whether the DefaultTexture will be projected when the toy is switched OFF. 'TRUE' to project; 'FALSE' to have no projection when off
integer ProjectDefaultTexture = TRUE;




Line 65: Line 102:
string Author = "Debbie Trilling";
string Author = "Debbie Trilling";
string Supplier = "The Particle Crucible";
string Supplier = "The Particle Crucible";
string Version = " v4.0";
string Version = " v5.0";




GiveShoutOut()
GiveShoutOut()
{
{
// any interaction with selected AV (give Inventory items etc) can safely be done from this function
    // any interaction with selected AV (give Inventory items etc) can safely be done from this function
// this function will only execute if ShoutOut == TRUE
    // this function will only execute if ShoutOut == TRUE


//although fondly calling it a 'ShoutOut', it actually makes more sense to keep within the 20m range of llSay
    //although fondly calling it a 'ShoutOut', it actually makes more sense to keep within the 20m range of llSay
llSay(0, llKey2Name(AVKey) + ShoutOutText);
    llSay(0, llKey2Name(AVKey) + ShoutOutText);


}
}
Line 81: Line 118:
ProjectTexture()
ProjectTexture()
{
{
if (ProjectDefaultTexture)
    // are we going to use a default texture when toy is OFF?
{
    if (ProjectDefaultTexture)
ParticleStart((key)llList2String(DefaultTexture, (integer)llFrand((float)llGetListLength(DefaultTexture))));
    {
}
        // using a default texture; if putting texture on the prim, let's make sure it is solid white, blank. full bright
else
        if (TexturePrim)
{
        {
llParticleSystem([]);
            llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, TRUE, PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0 ]);
}
        }
        else
        {
            ApplyPrimPrefs();
        }
        ParticleStart((key)llList2String(DefaultTexture, (integer)llFrand((float)llGetListLength(DefaultTexture))));
    }
    else
    {
        // we're not doing anything when the toy is OFF; change the prim to user preferences
        llParticleSystem([]);
        ApplyPrimPrefs();
    }
}
 
ApplyPrimPrefs()
{
    llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, PrimFullBright,
        PRIM_TEXTURE, ALL_SIDES, PrimTexture, <1.000000, 1.000000, 0.000000>, <0.000000, 0.000000, 0.000000>, 0.000000, PRIM_COLOR, ALL_SIDES, PrimColour, PrimAlpha ]);
}
}


Line 94: Line 149:
ParticleStart(key texture)
ParticleStart(key texture)
{
{
//core code by Moriash Moreau. Adapted to suit by Debbie Trilling
    if (DisplayBanner)
llParticleSystem([
    {
PSYS_PART_FLAGS, 0,
        //core code by Moriash Moreau. Adapted to suit by Debbie Trilling
PSYS_SRC_PATTERN, 4,
        llParticleSystem([
PSYS_PART_START_ALPHA, 0.50,
            PSYS_PART_FLAGS, 0,
PSYS_PART_END_ALPHA, 0.50,
            PSYS_SRC_PATTERN, 4,
PSYS_PART_START_COLOR, <1.0,1.0,1.0>,
            PSYS_PART_START_ALPHA, 0.50,
PSYS_PART_END_COLOR, <1.0,1.0,1.0>,
            PSYS_PART_END_ALPHA, 0.50,
PSYS_PART_START_SCALE, <Size * 1.6 ,Size,0.00>,
            PSYS_PART_START_COLOR, <1.0,1.0,1.0>,
PSYS_PART_END_SCALE, <Size * 1.6,Size,0.00>,
            PSYS_PART_END_COLOR, <1.0,1.0,1.0>,
PSYS_PART_MAX_AGE, 1.20,
            PSYS_PART_START_SCALE, <Size * 1.6 ,Size,0.00>,
PSYS_SRC_MAX_AGE, 0.00,
            PSYS_PART_END_SCALE, <Size * 1.6,Size,0.00>,
PSYS_SRC_ACCEL, <0.0,0.0,0.0>,
            PSYS_PART_MAX_AGE, 1.20,
PSYS_SRC_ANGLE_BEGIN, 0.00,
            PSYS_SRC_MAX_AGE, 0.00,
PSYS_SRC_ANGLE_END, 0.00,
            PSYS_SRC_ACCEL, <0.0,0.0,0.0>,
PSYS_SRC_BURST_PART_COUNT, 8,
            PSYS_SRC_ANGLE_BEGIN, 0.00,
PSYS_SRC_BURST_RADIUS, Height,
            PSYS_SRC_ANGLE_END, 0.00,
PSYS_SRC_BURST_RATE, 0.10,
            PSYS_SRC_BURST_PART_COUNT, 8,
PSYS_SRC_BURST_SPEED_MIN, 0.00,
            PSYS_SRC_BURST_RADIUS, Height,
PSYS_SRC_BURST_SPEED_MAX, 0.00,
            PSYS_SRC_BURST_RATE, 0.10,
PSYS_SRC_OMEGA, <0.00,0.00,0.00>,
            PSYS_SRC_BURST_SPEED_MIN, 0.00,
PSYS_SRC_TEXTURE, texture]);
            PSYS_SRC_BURST_SPEED_MAX, 0.00,
            PSYS_SRC_OMEGA, <0.00,0.00,0.00>,
            PSYS_SRC_TEXTURE, texture]);
    }
 
    if (TexturePrim)
    {
        llSetTexture(texture, ALL_SIDES);
    }
}
}


AnnounceWelcome()
AnnounceWelcome()
{
{
llOwnerSay(
    llOwnerSay(
"\nThank you for your interest in this product created by Debbie Trilling at The Particle Crucible.");
        "\nThank you for your interest in this product created by Debbie Trilling at The Particle Crucible.");
}
}


Line 127: Line 190:
ShutDown()
ShutDown()
{
{
llSensorRemove();
    llSensorRemove();
Power = FALSE;
    Power = FALSE;
ProjectTexture();
    ProjectTexture();
}
}


Line 136: Line 199:
{
{


on_rez(integer start_param)
    on_rez(integer start_param)
{
    {
// reset script on rez
        // reset script on rez
AnnounceWelcome();
        AnnounceWelcome();
llResetScript();
        llResetScript();
}
    }


changed( integer change )
    changed( integer change )
{
    {
if(change & CHANGED_OWNER )
        if(change & CHANGED_OWNER )
{
        {
// reset script on change of owner
            // reset script on change of owner
AnnounceWelcome();
            AnnounceWelcome();
llResetScript();
            llResetScript();
}
        }
}
    }


state_entry()
    state_entry()
{
    {
//initialise system
        //initialise system
llParticleSystem([]);
        llParticleSystem([]);
ObjectOwner = llGetOwner();
        ObjectOwner = llGetOwner();
OwnerName = llKey2Name(ObjectOwner);
        OwnerName = llKey2Name(ObjectOwner);
llSetObjectName(ObjectName + Version);
        llSetObjectName(ObjectName + Version);
llSetObjectDesc("Supplied by " + Author + "'s " + Supplier);
        llSetObjectDesc("Supplied by " + Author + "'s " + Supplier);
ProjectTexture();
        ProjectTexture();
llOwnerSay("\nTOUCH the " + ObjectName + " to switch it ON and OFF.");
        llOwnerSay("\nTOUCH the " + ObjectName + " to switch it ON and OFF.");
}
    }


touch_start(integer total_number)
    touch_start(integer total_number)
{
    {
if (llDetectedKey(0) == ObjectOwner)
        if (llDetectedKey(0) == ObjectOwner)
{
        {
// operation by Owner Only
            // operation by Owner Only
if (Power)
            if (Power)
{
            {
// touch to OFF
                // touch to OFF
ShutDown();
                ShutDown();
llOwnerSay("\nThe " + ObjectName + " is now switched OFF.");
                llOwnerSay("\nThe " + ObjectName + " is now switched OFF.");
}
            }
else
            else
{
            {
// touch to ON
                // touch to ON
Power = TRUE;
                Power = TRUE;
NoSensorCounter = 0;
                NoSensorCounter = 0;
llSensorRepeat("",NULL_KEY,AGENT,Range,PI,RepeatTime);
                llSensorRepeat("",NULL_KEY,AGENT,Range,PI,RepeatTime);
llOwnerSay("\nThe " + ObjectName + " is now switched ON. Please wait...");
                llOwnerSay("\nThe " + ObjectName + " is now switched ON. Please wait...");
}
            }
}
        }
else
        else
{
        {
// touched by someone other than Owner
            // touched by someone other than Owner
llInstantMessage(llDetectedKey(0), "\nThank you for your interest in the " + ObjectName + " created by " + Author +
            llInstantMessage(llDetectedKey(0), "\nThank you for your interest in the " + ObjectName + " created by " + Author +
".\nThis script is available free from https://wiki.secondlife.com/wiki/Random_AV_Profile_Projector.");
                ".\nThis script is available free from https://wiki.secondlife.com/wiki/Random_AV_Profile_Projector.");
}
        }
}
    }




sensor(integer total_number)
    sensor(integer total_number)
{
    {
// save the AV key in case it is needed for a 'ShoutOut'
        // save the AV key in case it is needed for a 'ShoutOut'
AVKey = llDetectedKey((integer)llFrand(total_number));
        AVKey = llDetectedKey((integer)llFrand(total_number));
// core code by Jana Kamachi and Solar Alter. Adapted to suit by Debbie Trilling
        // core code by Jana Kamachi and Solar Alter. Adapted to suit by Debbie Trilling
llHTTPRequest( URL_RESIDENT + (string)AVKey,[HTTP_METHOD,"GET"],"");
        llHTTPRequest( URL_RESIDENT + (string)AVKey,[HTTP_METHOD,"GET"],"");
}
    }




no_sensor()
    no_sensor()
{
    {
// counts the number of times that the scanner doesn't find anyone in range. If TotalNoScansAllowed is set to greater than zero, automatically powers down the toy
        // counts the number of times that the scanner doesn't find anyone in range. If TotalNoScansAllowed is set to greater than zero, automatically powers down the toy
// when the number of no_sensors exceeds TotalNoScansAllowed. However, this functionality is disabled if TotalNoScansAllowed is set to zero.
        // when the number of no_sensors exceeds TotalNoScansAllowed. However, this functionality is disabled if TotalNoScansAllowed is set to zero.
NoSensorCounter++;
        NoSensorCounter++;
if ((NoSensorCounter > TotalNoScansAllowed) && (TotalNoScansAllowed > 0))
        if ((NoSensorCounter > TotalNoScansAllowed) && (TotalNoScansAllowed > 0))
{
        {
ShutDown();
            ShutDown();
llInstantMessage(ObjectOwner, "\nThe " + ObjectName + " has been automatically switched OFF as no Agents have been detected within the set timeframe.");
            llInstantMessage(ObjectOwner, "\nThe " + ObjectName + " has been automatically switched OFF as no Agents have been detected within the set timeframe.");
}
        }
else
        else
{
        {
ParticleStart((key)llList2String(DefaultTexture, (integer)llFrand((float)llGetListLength(DefaultTexture))));
            ParticleStart((key)llList2String(DefaultTexture, (integer)llFrand((float)llGetListLength(DefaultTexture))));
}
        }
}
    }




http_response(key req,integer stat, list met, string body)
    http_response(key req,integer stat, list met, string body)
{
    {
// core code by Jana Kamachi and Solar Alter. Adapted to suit by Debbie Trilling
        // core code by Jana Kamachi and Solar Alter. Adapted to suit by Debbie Trilling
integer s1 = 0;
        integer s1 = 0;
integer s2 = 0;
        integer s2 = 0;
integer s1l= 0;
        integer s1l= 0;
integer s2l= -3;
        integer s2l= -3;
s1 = llSubStringIndex(body,"<img alt=\"profile image\" src=\"http://secondlife.com/app/image/");
        s1 = llSubStringIndex(body,"<img alt=\"profile image\" src=\"http://secondlife.com/app/image/");
s1l = llStringLength("<img alt=\"profile image\" src=\"http://secondlife.com/app/image/");
        s1l = llStringLength("<img alt=\"profile image\" src=\"http://secondlife.com/app/image/");
s2 = llSubStringIndex(body,"\" class=\"parcelimg\" />");
        s2 = llSubStringIndex(body,"\" class=\"parcelimg\" />");


if(s1 == -1)
        if(s1 == -1)
{
        {
// selected AV doesn't have a profile picture, so use the default instead
            // selected AV doesn't have a profile picture, so use the default instead
ParticleStart((key)llList2String(DefaultTexture, (integer)llFrand((float)llGetListLength(DefaultTexture))));
            ParticleStart((key)llList2String(DefaultTexture, (integer)llFrand((float)llGetListLength(DefaultTexture))));
}
        }
else
        else
{
        {
//check whether this was the texture used last time
            //check whether this was the texture used last time
if ((key)llGetSubString(body,s1+s1l,s2+s2l) == LastTexture)
            if ((key)llGetSubString(body,s1+s1l,s2+s2l) == LastTexture)
{
            {
// same profile pic as last time. so display a random default instead
                // same profile pic as last time. so display a random default instead
ParticleStart((key)llList2String(DefaultTexture, (integer)llFrand((float)llGetListLength(DefaultTexture))));
                ParticleStart((key)llList2String(DefaultTexture, (integer)llFrand((float)llGetListLength(DefaultTexture))));
// clear the last texture out
                // clear the last texture out
LastTexture = "";
                LastTexture = "";
}
            }
else
            else
{
            {
// different profile from last time, so display it
                // different profile from last time, so display it
ParticleStart((key)llGetSubString(body,s1+s1l,s2+s2l));
                ParticleStart((key)llGetSubString(body,s1+s1l,s2+s2l));
// save the key for comparison purposes next time tho'
                // save the key for comparison purposes next time tho'
LastTexture = (key)llGetSubString(body,s1+s1l,s2+s2l);
                LastTexture = (key)llGetSubString(body,s1+s1l,s2+s2l);


// give a 'ShoutOut', if set to do so
                // give a 'ShoutOut', if set to do so
if (ShoutOut)
                if (ShoutOut)
{
                {
GiveShoutOut();
                    GiveShoutOut();
}
                }
}
            }
}
        }
}
    }


//default end
    //default end
}
}
</lsl>
</lsl>

Revision as of 14:57, 5 January 2008

~ RANDOM AV PROFILE PICTURE PROJECTOR v4.0 by Debbie Trilling ~

Profile: http://wiki.secondlife.com/wiki/User:Debbie_Trilling

<lsl> // ~ RANDOM AV PROFILE PICTURE PROJECTOR v5.0 by Debbie Trilling ~

// *** This script randomly selects an AV from a crowd & then displays their // profile picture as texture on a prim and/or a 'holographic' image projected above the prim***

// Free to use as you wish by under condition that the title and this introduction remain in place, // and that due credit continues to be given to Moriash Moreau, Jana Kamachi and Solar Alter, and // Debbie Trilling.

// TOUCH to switch ON and OFF

// ** PARAMETERS THAT YOU CAN CHANGE **


//************************ // GENERAL PARAMETERS //************************ // how often in seconds the sensor fires float RepeatTime = 35.00;

// sensor range in meters. Maximum 96m but in practice 10 to 30m because of particle draw distance float Range = 25.00;

// sets the number of conseqtive times that the scanner is allowed to operate without having located an AV within range // eg: if RepeatTime = 60.0 seconds and TotalNoScansAllowed = 30, then the toy will operate for 1800 seconds (60x30, or 30 minutes) without locating // anyone before it automatically powers down. Set to '0.00' to disable the auto-off function integer TotalNoScansAllowed = 20;

// sets whether the DefaultTexture will be projected when the toy is switched OFF. 'TRUE' to project; 'FALSE' to have no projection when off integer ProjectDefaultTexture = TRUE;

// texture palette of UUID's. One will be randomly selected for display when an AV without a profile pic is selected list DefaultTexture = ["7cfd684e-2141-941c-eac8-bd439f0d5a9f", "d02531dd-491c-45b5-2cab-2e47ec81ec0d", "c3eebd9e-ee92-a16f-f906-bc275928df86"];


//************************ // PARTICLE EMISSION PARAMETERS //************************ // set to TRUE to display the profile picture as a particle 'holographic' image above the prim integer DisplayBanner = TRUE;

// width size in meters of the projected image (max 4.00) float Size = 2.50;

// height above object the centre of projected image will be (theoretical max. 50.0, in practice 2.0 to 10.0)) float Height = 2.50;


//************************ // PRIM TEXTURE PARAMETERS //************************ // set to TRUE to texture the prim with the profile picture on ALL_SIDES integer TexturePrim = TRUE;

// the following 'Prim*' parameters effect the prim only if ProjectDefaultTexture = FALSE // if ProjectDefaultTexture = TRUE then the prim is automatically set to solid blank white with full bright // texture to use for the prim when toy is OFF key PrimTexture = "5748decc-f629-461c-9a36-a35a221fe21f";

// set to TRUE to turn on Full Bright on ALL_SIDES when the toy is OFF integer PrimFullBright = FALSE;

// vector for the prim colour when toy is OFF vector PrimColour = <0.0, 0.0, 0.0>;

// set the alpha of the prim from 0.0 (clear) to 1.0 (solid) for when toy is OFF float PrimAlpha = 1.00;


//************************ // SHOUTOUT PARAMETERS //************************ // set to 'TRUE' to give a 'ShoutOut' to the AV once they have been selected; 'FALSE' for no 'ShoutOut' integer ShoutOut = TRUE;

// text to 'ShoutOut' when an AV's profile is projected. Text will be preceeded by their name, eg: "<AV Name>'s face is up in lights!" string ShoutOutText = "'s face is up in lights!";



// ** DO NOT CHANGE BELOW THIS LINE **


string URL_RESIDENT = "http://world.secondlife.com/resident/"; key LastTexture = ""; integer Power = FALSE; integer NoSensorCounter = 0; key AVKey = ""; key ObjectOwner = ""; string OwnerName = ""; string ObjectName = "Profile Projector"; string Author = "Debbie Trilling"; string Supplier = "The Particle Crucible"; string Version = " v5.0";


GiveShoutOut() {

   // any interaction with selected AV (give Inventory items etc) can safely be done from this function
   // this function will only execute if ShoutOut == TRUE
   //although fondly calling it a 'ShoutOut', it actually makes more sense to keep within the 20m range of llSay
   llSay(0, llKey2Name(AVKey) + ShoutOutText);

}


ProjectTexture() {

   // are we going to use a default texture when toy is OFF?
   if (ProjectDefaultTexture)
   {
       // using a default texture; if putting texture on the prim, let's make sure it is solid white, blank. full bright 
       if (TexturePrim)
       {
           llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, TRUE, PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0 ]);
       }
       else
       {
           ApplyPrimPrefs();
       }
       ParticleStart((key)llList2String(DefaultTexture, (integer)llFrand((float)llGetListLength(DefaultTexture))));
   }
   else
   {
       // we're not doing anything when the toy is OFF; change the prim to user preferences
       llParticleSystem([]);
       ApplyPrimPrefs();
   }

}

ApplyPrimPrefs() {

   llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, PrimFullBright,
       PRIM_TEXTURE, ALL_SIDES, PrimTexture, <1.000000, 1.000000, 0.000000>, <0.000000, 0.000000, 0.000000>, 0.000000, PRIM_COLOR, ALL_SIDES, PrimColour, PrimAlpha ]);

}


ParticleStart(key texture) {

   if (DisplayBanner)
   {
       //core code by Moriash Moreau. Adapted to suit by Debbie Trilling
       llParticleSystem([
           PSYS_PART_FLAGS, 0,
           PSYS_SRC_PATTERN, 4,
           PSYS_PART_START_ALPHA, 0.50,
           PSYS_PART_END_ALPHA, 0.50,
           PSYS_PART_START_COLOR, <1.0,1.0,1.0>,
           PSYS_PART_END_COLOR, <1.0,1.0,1.0>,
           PSYS_PART_START_SCALE, <Size * 1.6 ,Size,0.00>,
           PSYS_PART_END_SCALE, <Size * 1.6,Size,0.00>,
           PSYS_PART_MAX_AGE, 1.20,
           PSYS_SRC_MAX_AGE, 0.00,
           PSYS_SRC_ACCEL, <0.0,0.0,0.0>,
           PSYS_SRC_ANGLE_BEGIN, 0.00,
           PSYS_SRC_ANGLE_END, 0.00,
           PSYS_SRC_BURST_PART_COUNT, 8,
           PSYS_SRC_BURST_RADIUS, Height,
           PSYS_SRC_BURST_RATE, 0.10,
           PSYS_SRC_BURST_SPEED_MIN, 0.00,
           PSYS_SRC_BURST_SPEED_MAX, 0.00,
           PSYS_SRC_OMEGA, <0.00,0.00,0.00>,
           PSYS_SRC_TEXTURE, texture]);
   }
   if (TexturePrim)
   {
       llSetTexture(texture, ALL_SIDES);
   }

}

AnnounceWelcome() {

   llOwnerSay(
       "\nThank you for your interest in this product created by Debbie Trilling at The Particle Crucible.");

}


ShutDown() {

   llSensorRemove();
   Power = FALSE;
   ProjectTexture();

}


default {

   on_rez(integer start_param)
   {
       // reset script on rez
       AnnounceWelcome();
       llResetScript();
   }
   changed( integer change )
   {
       if(change & CHANGED_OWNER )
       {
           // reset script on change of owner
           AnnounceWelcome();
           llResetScript();
       }
   }
   state_entry()
   {
       //initialise system
       llParticleSystem([]);
       ObjectOwner = llGetOwner();
       OwnerName = llKey2Name(ObjectOwner);
       llSetObjectName(ObjectName + Version);
       llSetObjectDesc("Supplied by " + Author + "'s " + Supplier);
       ProjectTexture();
       llOwnerSay("\nTOUCH the " + ObjectName + " to switch it ON and OFF.");
   }
   touch_start(integer total_number)
   {
       if (llDetectedKey(0) == ObjectOwner)
       {
           // operation by Owner Only
           if (Power)
           {
               // touch to OFF
               ShutDown();
               llOwnerSay("\nThe " + ObjectName + " is now switched OFF.");
           }
           else
           {
               // touch to ON
               Power = TRUE;
               NoSensorCounter = 0;
               llSensorRepeat("",NULL_KEY,AGENT,Range,PI,RepeatTime);
               llOwnerSay("\nThe " + ObjectName + " is now switched ON. Please wait...");
           }
       }
       else
       {
           // touched by someone other than Owner
           llInstantMessage(llDetectedKey(0), "\nThank you for your interest in the " + ObjectName + " created by " + Author +
               ".\nThis script is available free from https://wiki.secondlife.com/wiki/Random_AV_Profile_Projector.");
       }
   }


   sensor(integer total_number)
   {
       // save the AV key in case it is needed for a 'ShoutOut'
       AVKey = llDetectedKey((integer)llFrand(total_number));
       // core code by Jana Kamachi and Solar Alter. Adapted to suit by Debbie Trilling
       llHTTPRequest( URL_RESIDENT + (string)AVKey,[HTTP_METHOD,"GET"],"");
   }


   no_sensor()
   {
       // counts the number of times that the scanner doesn't find anyone in range. If TotalNoScansAllowed is set to greater than zero, automatically powers down the toy
       // when the number of no_sensors exceeds TotalNoScansAllowed. However, this functionality is disabled if TotalNoScansAllowed is set to zero.
       NoSensorCounter++;
       if ((NoSensorCounter > TotalNoScansAllowed) && (TotalNoScansAllowed > 0))
       {
           ShutDown();
           llInstantMessage(ObjectOwner, "\nThe " + ObjectName + " has been automatically switched OFF as no Agents have been detected within the set timeframe.");
       }
       else
       {
           ParticleStart((key)llList2String(DefaultTexture, (integer)llFrand((float)llGetListLength(DefaultTexture))));
       }
   }


   http_response(key req,integer stat, list met, string body)
   {
       // core code by Jana Kamachi and Solar Alter. Adapted to suit by Debbie Trilling
       integer s1 = 0;
       integer s2 = 0;
       integer s1l= 0;
       integer s2l= -3;
       s1 = llSubStringIndex(body,"<img alt=\"profile image\" src=\"http://secondlife.com/app/image/");
       s1l = llStringLength("<img alt=\"profile image\" src=\"http://secondlife.com/app/image/");
       s2 = llSubStringIndex(body,"\" class=\"parcelimg\" />");
       if(s1 == -1)
       {
           // selected AV doesn't have a profile picture, so use the default instead
           ParticleStart((key)llList2String(DefaultTexture, (integer)llFrand((float)llGetListLength(DefaultTexture))));
       }
       else
       {
           //check whether this was the texture used last time
           if ((key)llGetSubString(body,s1+s1l,s2+s2l) == LastTexture)
           {
               // same profile pic as last time. so display a random default instead
               ParticleStart((key)llList2String(DefaultTexture, (integer)llFrand((float)llGetListLength(DefaultTexture))));
               // clear the last texture out
               LastTexture = "";
           }
           else
           {
               // different profile from last time, so display it
               ParticleStart((key)llGetSubString(body,s1+s1l,s2+s2l));
               // save the key for comparison purposes next time tho'
               LastTexture = (key)llGetSubString(body,s1+s1l,s2+s2l);
               // give a 'ShoutOut', if set to do so
               if (ShoutOut)
               {
                   GiveShoutOut();
               }
           }
       }
   }
   //default end

} </lsl>