Scripts Library

Creating scripts
User avatar
Constance Peregrine
Posts: 2349
Joined: Sun Dec 23, 2012 11:35 am
Has thanked: 2778 times
Been thanked: 1482 times

sounds player

Post by Constance Peregrine »

just found this one and it is very nice:

Code: Select all

// Ambient Sound script by Alfkin Small.

// To use: Place this script in the object that you want to play a sound.
// The object need not be special.  Just place is where you want the sound
// to come from.
// Drop a sound file in the object, then change the key sound line below to
// the name of your sound file.
// If you like, you can set the min and max values as well, in addition to
// the volume.  That's all there is to it!

// Set debug to TRUE if you'd like to get debugging messages, otherwise
// leave the next line alone.
integer debug = FALSE;

// Minimum amount of time (in seconds) between sounds.
float min = 10;

// Maximum amount of time (in seconds) between sounds.
float max = 30;

// This is the volume at which the sound will play.  0 = Inaudible
// Valid values are between 0.0 - 1.0
float vol = 1.0;

// Sound to play.
key sound = "wave-splash-01";

default
{
    state_entry()
    {
        if (debug) llSay(0, "Debugging is ON");
     
        // Set the initial timer
        llSetTimerEvent(5.0);        
    }
    timer()
    {     
        // Play the sound once        
        llPlaySound(sound, vol);
        
        // Randomly select the next time (in seconds) to play the sound.
        float time = min + llFrand(max - min);
        
        if (debug) llSay(0, "Time set to" + (string)time);
        
        llSetTimerEvent(time);
    }        
}

These users thanked the author Constance Peregrine for the post:
Ruthanne Harrison 2
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: 2349
Joined: Sun Dec 23, 2012 11:35 am
Has thanked: 2778 times
Been thanked: 1482 times

touch texture changer

Post by Constance Peregrine »

Moco asked, and when Moco asks, she should get what she wants!! am I right, or am I right?

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: 2349
Joined: Sun Dec 23, 2012 11:35 am
Has thanked: 2778 times
Been thanked: 1482 times

group joiner

Post by Constance Peregrine »

ok, not auto, butttttttttttttttttt:

Code: Select all

// Group Joiner
// By Christine Nyn for Lava Farina, 25-January-2011
//
// In the General tab, just below Owner, set the Group to the desired target group
// Then click another box, any will do, and take the prim into Inventory.
// On re-rezzing it will initialise and be ready for use.

list group_key;

default
{
    state_entry()
    {
        group_key = llGetObjectDetails(llGetKey(),[OBJECT_GROUP]);
        llSetText("Click for a Group Invite",<0.0,1.0,0.0>,0.5);
    }
    
    on_rez(integer foo)
    {
        llResetScript();
    }
    
    touch_start(integer foo)
    {
        llInstantMessage(llDetectedKey(0),"Make sure Local Chat window is open (Ctrl-H), then click the following link to join the group: secondlife:///app/group/" + (string)group_key + "/about");
    }
}
These users thanked the author Constance Peregrine for the post:
Selby Evans
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
Sarge Misfit
Posts: 254
Joined: Thu Mar 14, 2013 4:10 pm
Has thanked: 5 times
Been thanked: 223 times

HoverCar

Post by Sarge Misfit »

This script allows a car to hover over water as well as run on land. It has ten power settings. I have not yet been able to get it to allow a flight mode. It is ODE Physics based.

Code: Select all

///////////////////////////////

integer Private = 1;    // Change to 1 to prevent others riding.
integer tt;
integer Gear = 1;
integer Run;
integer oldn;

vector Sitpos = <.8,0,.8>;
vector SitrotV = <0,0,0>;

rotation Sitrot;

key oldagent;
key agent;

float forward_power = 3; //Power used to go forward (1 to 30)
float forward_normal = 3;
float crash_power_forward = 3;
float reverse_power = -3; //Power ued to go reverse (-1 to -30)
float turning_ratio = 5; //How sharply the vehicle turns. Less is more sharply. (.1 to 10)
float Speed;

string sit_message = "Ride"; //Sit message
string not_owner_message = "You are not the owner of this vehicle."; //Not owner message
string DrivingAnim = "driving generic"; //Animation to use when owner sits

///////////////////////////////

go_up()
{
    llSetStatus(STATUS_PHYSICS, FALSE);
    llSetRot(<0,0,0,0>);
    llSetStatus(STATUS_PHYSICS, TRUE);
}

setCamera(float degrees) 
{
    rotation sitRot = llAxisAngle2Rot(<0, 0, 1>, degrees * PI);
    llSetCameraEyeOffset(<-10, 0, 3> * sitRot);
    llSetCameraAtOffset(<4, 0, 3> * sitRot);
    llForceMouselook(FALSE);
}

setVehicle()
{
    llSetVehicleType(VEHICLE_TYPE_CAR);
    llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.1);
    llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.2);
    llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 0.2);
    llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 0.10);
    llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 0.2);
    llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 0.2);
    llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_TIMESCALE, 0.1);
    llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.5);

}

Init()
{
    Run = 0;
    llSetVehicleType(VEHICLE_TYPE_NONE);
    llSetStatus(STATUS_PHYSICS, FALSE);
    Sound(0);
    vector rotv = llRot2Euler(llGetRot());
    rotation rot = llEuler2Rot(<0,0,rotv.z>);
    llSetRot(rot);
    Sitrot = llEuler2Rot(DEG_TO_RAD * SitrotV);
}

Reset()
{
    Run = 0;
    vector rotv = llRot2Euler(llGetRot());
    rotation rot = llEuler2Rot(<0,0,rotv.z>);
    llSetRot(rot);
    llSetPos(llGetPos() + <0,0,0.5>);
}

integer LastSetMaterial = FALSE;
SetMaterial()
{
    if(LastSetMaterial == FALSE)
    {
        LastSetMaterial = TRUE;
    }
}

Sound(integer n)
{
    if(n != oldn)
    {
        oldn = n;
        if(n == 2)
        {
            llStopSound();
        }
        
        else if(n == 1)
        {
            llLoopSound("plane",1);
        }
        
        else
        {
             llStopSound();
        }
    }
}

default
{
    state_entry()
    {
        Init();
        llSetSitText(sit_message);
        llSitTarget(Sitpos, Sitrot);
        setCamera(0);
    }

on_rez(integer rn)
{
    llResetScript();
    llSetPos(llGetPos() + <0,0,.5>); 
}

link_message(integer sender, integer num, string message, key id)
{
    if(message=="reset")
    {
        Reset();
    }
}

changed(integer change)
{
    if ((change & CHANGED_LINK) == CHANGED_LINK)
    {
        agent = llAvatarOnSitTarget();
        
        if (agent != NULL_KEY)
        {
            if( (agent != llGetOwner()))
            {
                llSay(0, not_owner_message);
                llUnSit(agent);
                llPlaySound("car alarm",1.0);
                llPushObject(agent, <0,0,50>, ZERO_VECTOR, FALSE);
            }
            
            else
            {
                llSetStatus(STATUS_PHYSICS, TRUE);
                llSleep(.4);
                oldagent = agent;
                setVehicle();
                SetMaterial();
                llSetTimerEvent(0.3);
                llMessageLinked(LINK_SET, 0, "shift", "2");
                llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);
                Sound(1);
                Run = 1;
            }
        }
        
        else
        {
            Run = 0;
            llReleaseControls();
            llStopAnimation(DrivingAnim);
            Init();
            llSetPos(llGetPos() + <0,0,0>);
            Sound(0);
        }
    }
}
    
run_time_permissions(integer perm)
{
    if (perm)
    {
        forward_power = forward_normal;
        reverse_power = -2; 
        turning_ratio = 5; 
        Gear = 2;
        llTakeControls(CONTROL_FWD | CONTROL_BACK | CONTROL_DOWN | CONTROL_UP | CONTROL_RIGHT | CONTROL_LEFT | CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT, TRUE, FALSE);
        llPlaySound("start",1.0);
        llMessageLinked(LINK_SET, 0, "shift", "2");
        llSetPos(llGetPos() + <0,0,0.5>);
        llStartAnimation(DrivingAnim);
        llWhisper(0,"Hit M for mouselook, page up and down for thrust control. If you flip, Stand Up to flip the vehicle right-side up.");
    }
}

control(key id, integer level, integer edge)
{
    if(Run == 0)
    {
        return;
    }
    integer reverse=1;
    vector angular_motor;
    vector vel = llGetVel();
    Speed = llVecMag(vel);

    if ((level & edge & CONTROL_UP) || ((Gear >= 7) && (level & CONTROL_UP)))
    {
        Gear=Gear+1;
      
        if(Gear == 2) 
        {
            llSay(0,"Thrust at 10%");
            llLoopSound("gear1",1);
            llMessageLinked(LINK_SET, 0, "shift", "2");
        }
    
        if(Gear == 3) 
        {
            llSay(0,"Thrust at 20%");
            llLoopSound("gear2",1);
            llMessageLinked(LINK_SET, 0, "shift", "3");
        }                          
    
        if(Gear == 4) 
        {
            llSay(0,"Thrust at 30%");
            llLoopSound("gear3",1);
            llMessageLinked(LINK_SET, 0, "shift", "4");
        }                                
    
        if(Gear == 5) 
        {
            llSay(0,"Thrust at 40%");
            llLoopSound("gear4",1);
            llMessageLinked(LINK_SET, 0, "shift", "5");
        }                                
    
        if(Gear == 6) 
        {
            llSay(0,"Thrust at 50%");
            llLoopSound("gear5",1);
            llMessageLinked(LINK_SET, 0, "shift", "6");
        }
    
        if(Gear == 7) 
        {
            llSay(0,"Thrust at 60%");
            llLoopSound("gear6",1);
            llMessageLinked(LINK_SET, 0, "shift", "7");
        }
        
        if(Gear == 8) 
        {
            llSay(0,"Thrust at 70%");
            llLoopSound("gear6",1);
            llMessageLinked(LINK_SET, 0, "shift", "8");
        }
        
        if(Gear == 9) 
        {
            llSay(0,"Thrust at 80%");
            llLoopSound("gear6",1);
            llMessageLinked(LINK_SET, 0, "shift", "9");
        }
        
        if(Gear == 10) 
        {
            llSay(0,"Thrust at 90%");
            llLoopSound("gear6",1);
            llMessageLinked(LINK_SET, 0, "shift", "10");
        }
        
        if(Gear == 11) 
        {
            llSay(0,"Thrust at 100%");
            llLoopSound("gear6",1);
            llMessageLinked(LINK_SET, 0, "shift", "11");
        }
    
        if (Gear < 1) Gear = 1;
        if (Gear > 11) Gear = 11;
    }

    if ((level & edge & CONTROL_DOWN) || ((Gear >= 7) && (level & CONTROL_DOWN)))
    {
        Gear=Gear-1;
    
        if(Gear == 2) 
        {
            llSay(0,"Power at 10%");
            llLoopSound("gear1",1);
            llMessageLinked(LINK_SET, 0, "shift", "2");
        }
    
        if(Gear == 3) 
        {
            llSay(0,"Power at 20%");
            llLoopSound("gear2",1);
            llMessageLinked(LINK_SET, 0, "shift", "3");
        }
    
        if(Gear == 4)
        {
            llSay(0,"Power at 30%");
            llLoopSound("gear3",1);
            llMessageLinked(LINK_SET, 0, "shift", "4");
        }                                
    
        if(Gear == 5) 
        {
            llSay(0,"Power at 40%");
            llLoopSound("gear4",1);
            llMessageLinked(LINK_SET, 0, "shift", "5");
        }                                
    
        if(Gear == 6) 
        {
            llSay(0,"Power at 50%");
            llLoopSound("gear5",1);
            llMessageLinked(LINK_SET, 0, "shift", "6");
        }      
    
        if(Gear == 7) 
        {
            llSay(0,"Power at 60%");
            llLoopSound("gear6",1);
            llMessageLinked(LINK_SET, 0, "shift", "7");
        }  
        
        if(Gear == 8) 
        {
            llSay(0,"Thrust at 70%");
            llLoopSound("gear6",1);
            llMessageLinked(LINK_SET, 0, "shift", "8");
        }
        
        if(Gear == 9) 
        {
            llSay(0,"Thrust at 80%");
            llLoopSound("gear6",1);
            llMessageLinked(LINK_SET, 0, "shift", "9");
        }
        
        if(Gear == 10) 
        {
            llSay(0,"Thrust at 90%");
            llLoopSound("gear6",1);
            llMessageLinked(LINK_SET, 0, "shift", "10");
        }
        
        if(Gear == 11) 
        {
            llSay(0,"Thrust at 100%");
            llLoopSound("gear6",1);
            llMessageLinked(LINK_SET, 0, "shift", "11");
        }
                                  
        if (Gear < 1) Gear = 1;
        if (Gear > 11) Gear = 11;
    }
        
    if(level & CONTROL_FWD)
    {
        turning_ratio = 5;
        llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <10.0, 2.0, 1000.0>);
        llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <Gear*forward_power,0,0>);
        reverse=1;
    }

    if(level & CONTROL_BACK)
    {
        llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <10.0, 2.0, 1000.0>);
        llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <Gear*reverse_power,0,0>);
        turning_ratio = -5;
        reverse = -1;
    }

    if(level & (CONTROL_RIGHT|CONTROL_ROT_RIGHT))
    {
        angular_motor.z -= Speed / (turning_ratio*Gear);
    }
                        
    if(level & (CONTROL_LEFT|CONTROL_ROT_LEFT))
    {
        angular_motor.z += Speed / (turning_ratio*Gear);
    }
        
    llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angular_motor);
        
}       

timer()
{

    if(Run == 1)
    {
        vector pos = llGetPos();
        float Z = pos.z;
            
        if(Z < 20)
        {
            llSetVehicleFlags(VEHICLE_FLAG_HOVER_WATER_ONLY);
            llSetVehicleFloatParam(VEHICLE_BUOYANCY, 1 );
            llSetVehicleFloatParam(VEHICLE_HOVER_HEIGHT, 20);
        }
            
        else
        {
            llRemoveVehicleFlags(VEHICLE_FLAG_HOVER_WATER_ONLY);
            llSetVehicleFloatParam(VEHICLE_BUOYANCY, 0 );
        }
        vector vel = llGetVel();
        Speed = llVecMag(vel);

        if(Speed > 2.0)
        {
            Sound(2);
        }

        else if(Speed > 0.0)
        {
            llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <1.0, 2.0, 1000.0>);
            llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <0,0,0>);
            Sound(1);
        }
        llSetTimerEvent(0.3);  
    }
        
    else
    {
        llSetTimerEvent(0.0);
    }
}
    
} //end default
These users thanked the author Sarge Misfit for the post:
Constance Peregrine
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
Bri Hasp
Posts: 4
Joined: Wed Dec 25, 2013 12:20 am
Has thanked: 2 times
Been thanked: 1 time

Re: Smoke

Post by Bri Hasp »

Here's your script modified to produce Whiter Smoke that looks like smoke :ugeek:

Code: Select all

off() {
    llParticleSystem([]);
}
on() {
    llParticleSystem([ PSYS_PART_MAX_AGE, 7.900000,
    PSYS_PART_FLAGS, 267,
PSYS_PART_START_COLOR, <0.91941, 0.91941, 0.91941>,
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, "e59b5f81-09c5-ba56-bab7-588a2ff24632",
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;
            }
        }
           
    }
}
These users thanked the author Bri Hasp for the post:
Constance Peregrine
User avatar
Constance Peregrine
Posts: 2349
Joined: Sun Dec 23, 2012 11:35 am
Has thanked: 2778 times
Been thanked: 1482 times

Re: Scripts Library

Post by Constance Peregrine »

wowzers!!

A smorgasbord!!

Enjoy!! [and read around that post also for more interesting info, if you wish]

http://opensimulator.org/wiki/User:Lani ... SL_Scripts
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: 2349
Joined: Sun Dec 23, 2012 11:35 am
Has thanked: 2778 times
Been thanked: 1482 times

sliding door with options

Post by Constance Peregrine »

Code: Select all

//When touched (or collided by avatar) the prim is retracted towards one end and timer controlled automatically stretched back out.
//
//Prim moves/changes size along the local coordinate specified in the offset vector below.
//
//To change the overall size, edit the prim when stretched out and reset the script when done.
//
//The script works both in unlinked and linked prims.
//
// Copyright (C) 2008 Zilla Larsson
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 3, as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>
//
// Modified by Cam Chevalier 2012 to include collision activation and timer auto close
// touch will not close the doors, only timer will close.

key sound = "a09a481a-cc97-47e1-83b5-c894912d332a";
vector offset = <1.0,0.0,0.0>; //Prim moves/changes size along this local coordinate
float hi_end_fixed = FALSE; //Which end of the prim should remain in place when size changes?
//The one with the higher (local) coordinate?
float min = 0.15; //The minimum size of the prim relative to its maximum size
integer ns = 4; //Number of distinct steps for move/size change
integer x;
float Timer = 5.0; // Set time how long door stay´s open and then closes again
integer opened = 0;

default
{
    state_entry()
    {
        llPreloadSound(sound);
        offset *= ((1.0 - min) / ns) * (offset * llGetScale());
        hi_end_fixed -= 0.5;
    }
    touch_start(integer detected)
    {
        integer i;
        if(opened == 0)
        {
            llTriggerSound(sound,.5);
            do llSetPrimitiveParams([PRIM_SIZE, llGetScale() - offset,
            PRIM_POSITION, llGetLocalPos() + ((hi_end_fixed * offset) * llGetLocalRot())]);
            while ((++i) < ns);
            offset = - offset;
            llSetTimerEvent(Timer);
            opened = 1;
        }
         
    }
    collision_start(integer num)
    {
        if(opened == 0)
        {
            llTriggerSound(sound,.5);
            integer i;
            do llSetPrimitiveParams([PRIM_SIZE, llGetScale() - offset,
            PRIM_POSITION, llGetLocalPos() + ((hi_end_fixed * offset) * llGetLocalRot())]);
            while ((++i) < ns);
            offset = - offset;
            llSetTimerEvent(Timer);
            opened = 1;
        }
    }
    on_rez(integer param)
    {
        llResetScript();
    }
    timer()
    {
        llTriggerSound(sound,.3);
        llSetTimerEvent(0);
        integer i;
        do llSetPrimitiveParams([PRIM_SIZE, llGetScale() - offset,
        PRIM_POSITION, llGetLocalPos() + ((hi_end_fixed * offset) * llGetLocalRot())]);
        while ((++i) < ns);
        offset = - offset;
        opened = 0;
    }
}
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: 2349
Joined: Sun Dec 23, 2012 11:35 am
Has thanked: 2778 times
Been thanked: 1482 times

book

Post by Constance Peregrine »

Code: Select all

// 02/05/2010
// Added preloading of the next page -- Dale Glass

vector opensize=<0.062,1.242,0.82>;
vector closedsize=<0.031,0.414,0.547>;
string book="closed";
integer pagesets=17;
// here enter the number of pages
list pageUUIDs=["fc0c548d-a95e-452e-8dbf-bd09cdea3294","c1895ad9-2629-41fd-bbaa-413674501fcb","c184db69-9bfa-4fc8-89f4-c0fe765cf114","4484af44-9d29-4fc0-a37d-f7ec181f0ba0","afe72b1e-f75c-4d12-8927-b45b3ee85587","af5aeefc-a761-44db-9a98-fb601cb2075d","7f6ae7d7-781e-402f-b0dd-cb9daa5cda00","4bac6ff9-3228-48b5-a5eb-69ed61e7d52e","274e44dc-4129-4335-8689-26e6fe7a671e","a9bcaa25-5abf-47e6-b59f-8150b5db593a","4a19618d-5bc8-4615-8c1a-c1a0376fcb8e","7ed6aaf6-ed9a-4930-8acd-bb92f0472d46","772f92e0-199c-4cd4-9a7c-c73279ce575f","0579363b-1f7c-419c-9bd7-ded4dc881bfc","0579363b-1f7c-419c-9bd7-ded4dc881bfc","c6f0bc9f-473a-4a2b-a4e4-d156fe1f5c57"];
// here enter all UUIDs of the pictures that make the double pagesa1es
integer pageset=0;
integer next_pageset=1;
float   timer_delay = 3.0;


settexture()
{
    string ID=llList2String(pageUUIDs,pageset);
    key textureID=(key) ID;
    llSetTexture("041d02c0-b2fa-4ddf-bafb-c438adf72fc4",0);
    // texture of upper face
    llSetTexture("810c68b6-93ab-4d9f-b697-c7f15bc2d096",1);
    // texture of right side face on open
    llSetTexture("e2b9287c-7a25-4b62-9d60-2a5e81426152",3);
    // texture of first side face on open
    llSetTexture("041d02c0-b2fa-4ddf-bafb-c438adf72fc4",4);
    // texture below face on open
    llSetTexture("63f5294b-6a33-4219-97cc-d3965b7106fb",2);
    // texture backside on open
    llSetPrimitiveParams([PRIM_TEXTURE, 5, textureID, <0.5,1,0>, <0.25,0,0>, 0.0]);
    llSetPrimitiveParams([PRIM_TEXTURE, 6, textureID, <0.5,1,0>, <-0.25,0,0>, 0.0]);
    //    llSetTexture(textureID,5);
    // texture all inner right pages
    //    llSetTexture(textureID,6);
    // texture all inner left pages
    llSetTexture("041d02c0-b2fa-4ddf-bafb-c438adf72fc4",7);
    // texture below face on open
}

closebook()
{
    llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX, 0, <0,1,0>, 0.0, <0,0,0>, <1,1,1>, <0,0,0>]);
    llSetPrimitiveParams([PRIM_SIZE, closedsize]);
    llSetTexture("041d02c0-b2fa-4ddf-bafb-c438adf72fc4",0);
    // texture above face
    llSetTexture("041d02c0-b2fa-4ddf-bafb-c438adf72fc4",1);
    // texture right side face
    llSetTexture("63f5294b-6a33-4219-97cc-d3965b7106fb",2);
    // texture back face
    llSetTexture("63f5294b-6a33-4219-97cc-d3965b7106fb",3);
    // texture left side face
    llSetTexture("f12236de-64a1-42d5-80bd-0fb597605742",4);
    // texture cover face
    llSetTexture("041d02c0-b2fa-4ddf-bafb-c438adf72fc4",5);
    // texture below face
}

default
{    
    state_entry()
    {
        closebook();
        book="closed";
        pageset=0;
        next_pageset=1;
        llSetTimerEvent(timer_delay);
    }
    
    touch_start(integer num_times)
    {
        if(book=="closed")
        {
            book="open";
            llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX, 0, <0,0.725,0>, 0.0, <0,0,0>, <1,1,1>, <0,0,0>]);
            llSetPrimitiveParams([PRIM_SIZE, opensize]);
            settexture();
        } else if(book=="open")
        {
            pageset=pageset + 1;
            if(pageset>(pagesets-1))
            {
                closebook();
                book="closed";
                pageset=0;
                next_pageset=1;
            } else {
                settexture();
                next_pageset = pageset+1;
            }

            if ( next_pageset < llGetListLength(pageUUIDs) ) {
                // preload next page after a delay
                llSetTimerEvent(timer_delay);
            } else {
                // nothing to preload, stop event if any
                llSetTimerEvent(0.0);
            }
        }
    }

    timer() {
        key textureID=llList2Key(pageUUIDs,next_pageset);
        llSetColor(<0,0,0>, 3);
        llSetTexture(textureID,3);
        

        //llOwnerSay("Preloading page " + (string)next_pageset + ": " + (string)textureID);
        llSetTimerEvent(0.0); // do this only once
    }
}
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
Kayaker Magic
Posts: 354
Joined: Sun Dec 01, 2013 8:40 am
Has thanked: 52 times
Been thanked: 393 times

Random Pastel Colored Egg

Post by Kayaker Magic »

Code: Select all

    //Random Pastel Colors 
    //  by Kayaker Magic
    //put this script inside a white prim (like an ellipsoid egg)
    //it changes the color to a different random pastel color once a second.
        //You could use the math here to make an egg change color once
    //at state_entry time, so every egg is different on rez.

default
{
    state_entry()
    {
        llSetTimerEvent(1.0);
    }
    timer()
    {
                //Pastel colors: pick a color near, but not at white
        vector col=<llFrand(0.4)+0.5,llFrand(0.3)+0.5,llFrand(0.3)+0.5>;
                //then push it to the edge of the gamut on one random axis
        integer ran=(integer)llFrand(3.0);
        if (ran==0) col.x=1.0;
        else if (ran==1) col.y=1.0;
        else col.z=1.0;
        llSetColor(col,0);
    }
}
These users thanked the author Kayaker Magic for the post:
Constance Peregrine
User avatar
Constance Peregrine
Posts: 2349
Joined: Sun Dec 23, 2012 11:35 am
Has thanked: 2778 times
Been thanked: 1482 times

nice rain

Post by Constance Peregrine »

I just found this and it worked for me in Kitely, so hopefully it will for you also!!

Code: Select all

default{state_entry(){
llParticleSystem([  PSYS_PART_MAX_AGE, 8.500000,
PSYS_PART_FLAGS, 259,
PSYS_PART_START_COLOR, <1.00000, 1.00000, 1.00000>,
PSYS_PART_END_COLOR, <1.00000, 1.00000, 1.00000>,
PSYS_PART_START_SCALE, <0.50000, 0.50000, 0.50000>,
PSYS_PART_END_SCALE, <0.50000, 0.50000, 0.50000>,
PSYS_SRC_PATTERN, 8,
PSYS_SRC_BURST_RATE,0.1,
PSYS_SRC_ACCEL,<0.00000, 0.00000, -0.20000>,
PSYS_SRC_BURST_PART_COUNT,6,
PSYS_SRC_BURST_RADIUS,0.500000,
PSYS_SRC_BURST_SPEED_MIN,0.010000,
PSYS_SRC_BURST_SPEED_MAX,0.100000,
PSYS_SRC_INNERANGLE,3.141593,
PSYS_SRC_OUTERANGLE,6.283185,
PSYS_SRC_OMEGA,<0.00000, 1.00000, 0.00000>,
PSYS_SRC_MAX_AGE,0.000000,
PSYS_PART_START_ALPHA,1.000000,
PSYS_PART_END_ALPHA,0.700000,
PSYS_SRC_TEXTURE, "873f3ac0-8e83-474e-873f-e87e07a67b66",
PSYS_SRC_TARGET_KEY,(key)"" ]);}}
These users thanked the author Constance Peregrine for the post (total 2):
Boo RojyoGenavieve Page
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...
Post Reply