Forums


Scripts Library

Creating scripts

Scripts Library

Postby Sarge Misfit » Tue Oct 08, 2013 2:50 pm

I think that Kitely needs a script library, but that is likely not a high priority with all the other things that are needed. So, how about a thread of scripts until then? Hopefully, one of the moderators will make this a sticky. (they did, thanks)

Guidelines:

1- Post only scripts that you KNOW work properly in Kitely.
2- Post ONLY scripts in the interest of keeping this thread short enough to be easy to search.
3- Please use the following format for your post;

Subject: <name of script>

<brief description of the script>
Code: Select all
script
Last edited by Sarge Misfit on Mon Oct 21, 2013 3:29 am, edited 1 time in total.
Living life on the wrong side of a one-track mind.

National Security Threat Level: Gnat

My site: Excelsior Station
My Kitely World: Misfit's Folly
User avatar
Sarge Misfit
 
Posts: 254
Joined: Thu Mar 14, 2013 4:10 pm
Has liked: 5 times
Been liked: 217 times

Walkthrough Teleporter

Postby Sarge Misfit » Tue Oct 08, 2013 2:51 pm

This is the script I use in my WarpGates. Its a Hypergrid script I got on Pathlandia and I use it everywhere.

Code: Select all
// XEngine

// For more info see http://becunningandfulloftricks.com/2010/10/29/the-metaphor-of-portals
// anti-loop code added by Jag Nishi/The Ham

string  GridName     = "Visit Pathlandia\n(4000,4000)\n";
string  SimAddress   = "pathlandia.dlinkddns.com:9000:Pathlandia"; // use region name for inworld locations
string  LastVerified = "\nLast Verified: 04/05/2012";
string  Message      = "";
string  BoilerPlate  = "\nWalk through to teleport";
vector  LandingPoint = <123.0, 130.0, 13.0>;
vector  TextColor    = <0,1,1>;
vector  LookAt       = <1.0,1.0,0.0>;

key     AgentToTransfer;
list    LastFewAgents;

string  CONTROLLER_ID       = "A";
integer AUTO_START          = TRUE;
list    particle_parameters = [];
list    target_parameters   = [];

StartEffects()
{
    // llCollisionSound("Magic Chimes", 1.0);
   
    particle_parameters = [
        PSYS_SRC_TEXTURE,          llGetInventoryName(INVENTORY_TEXTURE, 0),
        PSYS_PART_START_SCALE,     <0.10,0.10, FALSE>,
        PSYS_PART_END_SCALE,       <1.00,1.00, FALSE>,
        PSYS_PART_START_COLOR,     <1,1,1>,
        PSYS_PART_END_COLOR,       <1,1,1>,
        PSYS_PART_START_ALPHA,     (float)1.0,
        PSYS_PART_END_ALPHA,       (float)0.0,     
        PSYS_SRC_BURST_PART_COUNT, 500,
        PSYS_SRC_BURST_RATE,       (float)0.01,   
        PSYS_PART_MAX_AGE,         (float)1.0,
        PSYS_SRC_MAX_AGE,          (float)0.6, 
        PSYS_SRC_PATTERN,          2,
        PSYS_SRC_ACCEL,            <0.0,0.0,-3.0>, 
        PSYS_SRC_BURST_SPEED_MIN,  (float)1.2,
        PSYS_SRC_BURST_SPEED_MAX,  (float)5.01,
        PSYS_SRC_ANGLE_BEGIN,      (float)0.25*PI,
        PSYS_SRC_ANGLE_END,        (float)0.00*PI, 
        PSYS_SRC_OMEGA,            <0,0,0>,       
        PSYS_PART_FLAGS, ( 0
                            | PSYS_PART_INTERP_COLOR_MASK   
                            | PSYS_PART_INTERP_SCALE_MASK   
                            | PSYS_PART_EMISSIVE_MASK   
                            | PSYS_PART_FOLLOW_VELOCITY_MASK
                            | PSYS_PART_WIND_MASK           
                         )                   
    ];
       
    if ( AUTO_START ) llParticleSystem( particle_parameters );
}

PerformTeleport( key WhomToTeleport )
{
    integer CurrentTime = llGetUnixTime();
    integer AgentIndex = llListFindList( LastFewAgents, [ WhomToTeleport ] );
    if (AgentIndex != -1)
    {
        integer PreviousTime = llList2Integer ( LastFewAgents, AgentIndex+1 );
        if (PreviousTime >= (CurrentTime -5)) return;
        LastFewAgents = llDeleteSubList( LastFewAgents, AgentIndex, AgentIndex+1);
    }
    LastFewAgents += [ WhomToTeleport, CurrentTime ];
    osTeleportAgent( WhomToTeleport, SimAddress, LandingPoint, LookAt );
}

default
{   
    on_rez(integer start_param)
    {
        llResetScript();
    }
   
    state_entry()
    {
        //llSetTextureAnim(ANIM_ON | SMOOTH | LOOP, ALL_SIDES, 0, 0, 0, 0, .05);
        llSetText(GridName + SimAddress + BoilerPlate + LastVerified + Message, TextColor, 1); 
    }
   
    collision_start(integer num_detected)
    {
        StartEffects();
   
        if(llDetectedKey(0) != AgentToTransfer)
        {
            AgentToTransfer=llDetectedKey(0);
            PerformTeleport( llDetectedKey(0));
        }
        else
        {
            llSetTimerEvent(3);
        }
    }
   
    timer()
    {
        AgentToTransfer="";
        llSetTimerEvent(0);
    }
   
    touch_start(integer num_detected)
    {
        llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD, 0));
    }
   
    link_message( integer sibling, integer num, string mesg, key target_key )
    {
        if ( mesg != CONTROLLER_ID ) { // this message isn't for me.  Bail out.
            return;
        } else if ( num == 0 ) { // Message says to turn particles OFF:
            llParticleSystem( [ ] );
        } else if ( num == 1 ) { // Message says to turn particles ON:
            llParticleSystem( particle_parameters + target_parameters );
        } else if ( num == 2 ) { // Turn on, and remember and use the key sent us as a target:
            target_parameters = [ PSYS_SRC_TARGET_KEY, target_key ];
            llParticleSystem( particle_parameters + target_parameters );
        } else { // bad instruction number
            // do nothing.
        }           
    }
}

//// "Explosion" PARTICLE TEMPLATE v1 - by Jopsy Pendragon - 4/8/2008
//// You are free to use this script as you please, so long as you include this line:
//** The original 'free' version of this script came from THE PARTICLE LABORATORY. **//
Last edited by Sarge Misfit on Sun Dec 15, 2013 12:51 am, edited 1 time in total.
Living life on the wrong side of a one-track mind.

National Security Threat Level: Gnat

My site: Excelsior Station
My Kitely World: Misfit's Folly
User avatar
Sarge Misfit
 
Posts: 254
Joined: Thu Mar 14, 2013 4:10 pm
Has liked: 5 times
Been liked: 217 times

Automatic Sliding Door

Postby Sarge Misfit » Tue Oct 08, 2013 2:56 pm

This is a sliding door that open automatically, like the ones that supermarkets have.

Code: Select all
// Auto-opening sliding door
// WARNING! Make sure you change these coords BEFORE placing in your door
vector closed = <164.1,215.0500,137.77>;//XYZ coordinates of the door when closed
vector open = <162.35,215.0500,137.77>;//XYZ coordinates of the door when open
//
float time = 5;//time before the door close itself
float range = 2.1;
float scanperiod = .5;
 
default
{
    state_entry()
    {
        llSetPos(closed);
        llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, range, PI, scanperiod);
    }
    sensor(integer num_detected)
    {
        if (num_detected > 0)
        llSetPos(open);
        llPlaySound("AirHiss",.5); // chage to whatever sound you use
        llSleep(time);
        llSetPos(closed);
        llPlaySound("AirHiss",.5); // chage to whatever sound you use
    }
}
Living life on the wrong side of a one-track mind.

National Security Threat Level: Gnat

My site: Excelsior Station
My Kitely World: Misfit's Folly
User avatar
Sarge Misfit
 
Posts: 254
Joined: Thu Mar 14, 2013 4:10 pm
Has liked: 5 times
Been liked: 217 times

Door Hinge

Postby Sarge Misfit » Tue Oct 08, 2013 3:20 pm

Make sure the root prim of the door is the hinge

Code: Select all
// Swinging door LSL script

float  delay = 3.0; // time to wait before automatically closing door
float  direction = -1.0; // set to 1.0 or -1.0 to control direction the door swings
float  volume = 0.5; // 0.0 is off, 1.0 is loudest
key    open_sound  = "cb340647-9680-dd5e-49c0-86edfa01b3ac";
key    close_sound = "e7ff1054-003d-d134-66be-207573f2b535";

default
{
    state_entry()
    {
        state open;
    }
}

state closed
{
    state_entry()
    {
        llTriggerSound(close_sound, volume); // Trigger the sound of the door closing
        llSetRot(llEuler2Rot(<direction * PI_BY_TWO,0,0>) * llGetRot()); // edit to change the axis of rotation x,y,z
    }
    touch_start(integer total_number)
    {
        state open; 
    }
    collision_start(integer total_number)
    {
        state open;
    }
    timer()
    {
        llSetTimerEvent(0.0);  // Set the timer to 0.0 to turn it off
    }
}

state open
{
    state_entry()
    {
        llTriggerSound(open_sound, volume); // Trigger the sound of the door opening
        llSetRot(llEuler2Rot(<-direction * PI_BY_TWO,0,0>) * llGetRot()); // edit to change the axis of rotation x,y,z
        llSetTimerEvent(delay); // Set the timer to automatically close it
    }
    on_rez(integer start_param)
    {
        state closed;
    }
    touch_start(integer total_number)
    {
        state closed;
    }
    collision_start(integer total_number)
    {
        // Do nothing, the door is already open
    }
    timer()
    {
        llSetTimerEvent(0.0); // Set the timer to 0.0 to turn it off
        state closed; 
    }
}

Living life on the wrong side of a one-track mind.

National Security Threat Level: Gnat

My site: Excelsior Station
My Kitely World: Misfit's Folly
User avatar
Sarge Misfit
 
Posts: 254
Joined: Thu Mar 14, 2013 4:10 pm
Has liked: 5 times
Been liked: 217 times

url giver

Postby Constance Peregrine » Tue Oct 08, 2013 3:42 pm

Code: Select all
// Thishan Dezno
// 21-06-2012

string url = "http://minethere.blogspot.com/2012/10/region-creations.html";
string desc = "Region Creations Blog";

default{
    state_entry(){}
    touch_start(integer total_number){
        llLoadURL(llDetectedKey(0), desc, url);
    }
}
Laissez faire et laissez passer, le monde va de lui même!
My little sounds store https://www.kitely.com/market?store=2040306

Ephemeral wanderer...
User avatar
Constance Peregrine
 
Posts: 2307
Joined: Sun Dec 23, 2012 11:35 am
Has liked: 2761 times
Been liked: 1395 times

auto texture changer

Postby Constance Peregrine » Tue Oct 08, 2013 3:44 pm

Code: Select all
//auto texture changer
//can change set timer event to whatever seconds you want
//add textures and script to contents

integer number;
string name;
integer choice = 0;

default
{
    state_entry()
    {
        llSetTimerEvent(35.5); //How many seconds in between textures
        number = llGetInventoryNumber(INVENTORY_TEXTURE);
    }
    timer()
    {
        if (choice < number)
        {
            name = llGetInventoryName(INVENTORY_TEXTURE, choice);
            if (name != "")
            llSetTexture(name, ALL_SIDES);
            choice = choice + 1;
        }
        else
        {
            name = llGetInventoryName
//auto texture changer

(INVENTORY_TEXTURE, choice);
            if (name != "")
            llSetTexture(name, ALL_SIDES);
            choice = 0;
        }
    }
    changed(integer change)
    {
        if (change & CHANGED_INVENTORY)
        {
            llResetScript();
        }
    }
}
Laissez faire et laissez passer, le monde va de lui même!
My little sounds store https://www.kitely.com/market?store=2040306

Ephemeral wanderer...
User avatar
Constance Peregrine
 
Posts: 2307
Joined: Sun Dec 23, 2012 11:35 am
Has liked: 2761 times
Been liked: 1395 times

texture change by touch

Postby Constance Peregrine » Tue Oct 08, 2013 3:47 pm

Code: Select all
////Add script and up to 100 textures to object///

integer number;
string name;
integer choice = 0;

default
{
    state_entry()
    {
        number = llGetInventoryNumber(INVENTORY_TEXTURE);
        number -= 1;
        name = llGetInventoryName(INVENTORY_TEXTURE, choice);
        if (name != "")
        {
            llSetTexture(name, ALL_SIDES);
            choice = choice + 1;
        }
    }

    touch_start(integer total_number)
    {
        if (choice < number)
        {
            name = llGetInventoryName(INVENTORY_TEXTURE, choice);
            if (name != "")
            {
                llSetTexture(name, ALL_SIDES);
                choice = choice + 1;
            }
        }
        else
        {
            name = llGetInventoryName(INVENTORY_TEXTURE, choice);
            if (name != "")
            {
                llSetTexture(name, ALL_SIDES);
                choice = 0;
            }
        }
    }
   
    changed(integer change)
    {
        if (change & CHANGED_INVENTORY)
        {
            llResetScript();
        }
    }
}
Laissez faire et laissez passer, le monde va de lui même!
My little sounds store https://www.kitely.com/market?store=2040306

Ephemeral wanderer...
User avatar
Constance Peregrine
 
Posts: 2307
Joined: Sun Dec 23, 2012 11:35 am
Has liked: 2761 times
Been liked: 1395 times

Browser-on-prim poster self-resetting script

Postby Selby Evans » Fri Oct 18, 2013 12:21 am

This script turns a prim into a browser-on-prim, restores it when someone scrolls or changes the link, and lets you change the url by editing the script.

Code: Select all
 

// self-resetting Browser-on-Prim script
//Enter the Url(s) for the page(s) you want to display. 
// creative commons license, attribution only
float wait = 900; //Number of seconds before refresh to script settings

default
{
 
    state_entry()
 
{  llSetTimerEvent(wait);}

  timer()
    { string  URL2="http://virtualoutworlding.blogspot.com/2013/10/2013-help-video-kitely-interview-with.html";   
//Enter the urls between the  quotes     
//The web page may not appear for 15 minutes or more --
// the change happens after the timer times out     
       llSetPrimMediaParams(1,                             // Side to display the media on (Lesser Y)
          [PRIM_MEDIA_AUTO_PLAY,TRUE,                     // Show this page immediately
             PRIM_MEDIA_CURRENT_URL, URL2  ]);
        //     
         llSetPrimMediaParams(3,                             // Side to display the media on (Greater Y)
            [PRIM_MEDIA_AUTO_PLAY,TRUE,                     // Show this page immediately
             PRIM_MEDIA_CURRENT_URL, URL2    ]); 
    }
}   
 

User avatar
Selby Evans
 
Posts: 465
Joined: Wed Sep 04, 2013 6:00 pm
Has liked: 1151 times
Been liked: 524 times

smoke

Postby Constance Peregrine » Mon Oct 28, 2013 4:40 pm

I just found this one and it is really, really smokey!! It worked for me in Kitely just now...

Code: Select all
//start_unprocessed_text
/*default
{
state_entry()
{
llParticleSystem([ PSYS_PART_MAX_AGE, 7.900000,
PSYS_PART_FLAGS, 267,
PSYS_PART_START_COLOR, <0.3, 0.2, 0.2>,
PSYS_PART_END_COLOR, <1.00000, 1.00000, 1.00000>,
PSYS_PART_START_SCALE, <0.02150, 0.02150, 0.00000>,
PSYS_PART_END_SCALE, <2.20000, 2.20000, 0.00000>,
PSYS_SRC_PATTERN, 2,
PSYS_SRC_BURST_RATE,0.081000,
PSYS_SRC_ACCEL,<0.00000, 0.00000, 0.30000>,
PSYS_SRC_BURST_PART_COUNT,3,
PSYS_SRC_BURST_RADIUS,0.000000,
PSYS_SRC_BURST_SPEED_MIN,0.410000,
PSYS_SRC_BURST_SPEED_MAX,0.010000,
PSYS_SRC_INNERANGLE,0.000000,
PSYS_SRC_OUTERANGLE,0.000000,
PSYS_SRC_OMEGA,<0.00000, -0.20000, 0.00000>,
PSYS_SRC_MAX_AGE,0.000000,
PSYS_PART_START_ALPHA,1.000000,
PSYS_PART_END_ALPHA,0.000000,
PSYS_SRC_TEXTURE, "0cdad3a7-be05-43d1-9f58-8593ba73f69f",
PSYS_SRC_TARGET_KEY,(key)"" ]);
}
}*/
//end_unprocessed_text
//nfo_preprocessor_version 0
//program_version Phoenix Firestorm-Release v4.3.1.31155 - ChapTer Kronfeld
//mono


 
default
{
state_entry()
{
llParticleSystem([ PSYS_PART_MAX_AGE, 7.900000,
PSYS_PART_FLAGS, 267,
PSYS_PART_START_COLOR, <0.3, 0.2, 0.2>,
PSYS_PART_END_COLOR, <1.00000, 1.00000, 1.00000>,
PSYS_PART_START_SCALE, <0.02150, 0.02150, 0.00000>,
PSYS_PART_END_SCALE, <2.20000, 2.20000, 0.00000>,
PSYS_SRC_PATTERN, 2,
PSYS_SRC_BURST_RATE,0.081000,
PSYS_SRC_ACCEL,<0.00000, 0.00000, 0.30000>,
PSYS_SRC_BURST_PART_COUNT,3,
PSYS_SRC_BURST_RADIUS,0.000000,
PSYS_SRC_BURST_SPEED_MIN,0.410000,
PSYS_SRC_BURST_SPEED_MAX,0.010000,
PSYS_SRC_INNERANGLE,0.000000,
PSYS_SRC_OUTERANGLE,0.000000,
PSYS_SRC_OMEGA,<0.00000, -0.20000, 0.00000>,
PSYS_SRC_MAX_AGE,0.000000,
PSYS_PART_START_ALPHA,1.000000,
PSYS_PART_END_ALPHA,0.000000,
PSYS_SRC_TEXTURE, "0cdad3a7-be05-43d1-9f58-8593ba73f69f",
PSYS_SRC_TARGET_KEY,(key)"" ]);
}
}
Laissez faire et laissez passer, le monde va de lui même!
My little sounds store https://www.kitely.com/market?store=2040306

Ephemeral wanderer...
User avatar
Constance Peregrine
 
Posts: 2307
Joined: Sun Dec 23, 2012 11:35 am
Has liked: 2761 times
Been liked: 1395 times

Re: smoke

Postby Sherrie Melody » Mon Oct 28, 2013 5:29 pm

Minethere Always wrote:I just found this one and it is really, really smokey!! It worked for me in Kitely just now...

That's about the best smoke effect i've seen, Minethere! Here's a modified version, so you can turn it on and off:
Code: Select all
off() {
    llParticleSystem([]);
}
on() {
    llParticleSystem([ PSYS_PART_MAX_AGE, 7.900000,
        PSYS_PART_FLAGS, 267,
        PSYS_PART_START_COLOR, <0.3, 0.2, 0.2>,
        PSYS_PART_END_COLOR, <1.00000, 1.00000, 1.00000>,
        PSYS_PART_START_SCALE, <0.02150, 0.02150, 0.00000>,
        PSYS_PART_END_SCALE, <2.20000, 2.20000, 0.00000>,
        PSYS_SRC_PATTERN, 2,
        PSYS_SRC_BURST_RATE,0.081000,
        PSYS_SRC_ACCEL,<0.00000, 0.00000, 0.30000>,
        PSYS_SRC_BURST_PART_COUNT,3,
        PSYS_SRC_BURST_RADIUS,0.000000,
        PSYS_SRC_BURST_SPEED_MIN,0.410000,
        PSYS_SRC_BURST_SPEED_MAX,0.010000,
        PSYS_SRC_INNERANGLE,0.000000,
        PSYS_SRC_OUTERANGLE,0.000000,
        PSYS_SRC_OMEGA,<0.00000, -0.20000, 0.00000>,
        PSYS_SRC_MAX_AGE,0.000000,
        PSYS_PART_START_ALPHA,1.000000,
        PSYS_PART_END_ALPHA,0.000000,
        PSYS_SRC_TEXTURE, "0cdad3a7-be05-43d1-9f58-8593ba73f69f",
        PSYS_SRC_TARGET_KEY,(key)"" ]);
}
integer smoke=0;
default
{
    touch_start(integer num_detected) {
        if(llGetOwner() == llDetectedKey(0)) {
            if(smoke) {
                off();
                smoke=0;
            }
            else {
                on();
                smoke=1;
            }
        }
           
    }
}
User avatar
Sherrie Melody
 
Posts: 273
Joined: Fri Mar 29, 2013 6:56 pm
Has liked: 201 times
Been liked: 157 times

Next

Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest