-->

FoxSan's 3D Tools and LSL Script Repository

Tons of LSL scripts, examples and 3D tools, free for all. There are currently 207 scripts and articles in this database.

Rotate On Click

integer switch = TRUE;
integer count = 0;
 
default
{
    state_entry()
    {
        llPlaySound("2df2a3b9-9b73-9f90-75e1-9cd98e9a713d",1.0);
        llSay(0,"WaterWheel Pulley Initialized");
    }
 
on_rez(integer start_param)
    {
       llResetScript();
    }
 
    touch_start(integer total_number)
    {
        if (llDetectedKey(0) == llGetOwner())
        {
            if (switch == FALSE)
            {
            switch = TRUE;
            llSay(0,"Started");
            llTriggerSound("091402dc-f0ea-81d4-6ca0-728649a1c0c5",1.0);
            llTargetOmega(<0,0.2,0>,PI,1.0);
            } 
 
            else if (switch == TRUE)
 
            {
            switch = FALSE;
            llSay(0,"Stopped");
            llTriggerSound("091402dc-f0ea-81d4-6ca0-728649a1c0c5",1.0);
            llTargetOmega(<0,0,0>,PI,1.0);
            }
        }
        else
         llInstantMessage(llDetectedKey(0),"Owner says no.");
    }
}

Touchy Feely Script

////////////////////////////TOUCHMENU///////////////////////////////////////////////////
list list_one = ["Tug","Squeeze","Lick","Play","Stroke","Tease","Rub","Nibble","Fondle","Bite","Flick"];
string owner;
integer lock = FALSE;
integer chan;
////////////////////////////TOUCHMENU///////////////////////////////////////////////////
////////////////////////////TAIL////////////////////////////////////////////////////////
// holds the tail position before starting the script
vector originalPosition;
// do the actual wagging
doWag()
{
integer amplitude=25;   // maximum wagging width in degrees
integer numOfWags=2;    // how many times to be wagged
float steps=12;         // how many steps per wag, higher is slower
float moveBy=0;         // current wagging position
// start wagging, count the steps
integer num=0;
while(num<(steps*numOfWags))
{
// calculate new tail position
moveBy=llSin(num/(steps/2)*PI)*amplitude;
// rotate tail
llSetRot(llEuler2Rot(DEG_TO_RAD*(originalPosition+<moveBy,0,0>)));
// next step
num++;
}
// set back to original position
llSetRot(llEuler2Rot(DEG_TO_RAD*(originalPosition)));
}
////////////////////////////TAIL////////////////////////////////////////////////////////
default
{
////////////////////////////TAIL////////////////////////////////////////////////////////
state_entry()
{
// remember tail position when not wagging
originalPosition=(RAD_TO_DEG*llRot2Euler(llGetLocalRot()));
// start first wagging almost immediately
llSetTimerEvent(1);
}
// every ten seconds
timer()
{
// wag the tail
doWag();
// restart timer, next ten seconds
llSetTimerEvent(10+llFrand(10));
state menu;
}
}
////////////////////////////TAIL////////////////////////////////////////////////////////
////////////////////////////TOUCHMENU///////////////////////////////////////////////////
state menu
{
on_rez(integer n)
{
llResetScript();
}
attach(key a)
{
llResetScript();
}
state_entry()
{
chan = 8000 + (integer)llFrand(8000);
owner = llKey2Name(llGetOwner());
llListen(chan,"","","");
llListen(1,"",llGetOwner(),"");
}
touch_start(integer total_number)
{
if(lock == FALSE){
llDialog(llDetectedKey(0),"What do you want to do with "+owner+"'s tail",list_one,chan);
} else {
llInstantMessage(llDetectedKey(0),"These tail are locked >.>");
}
}
listen(integer c, string n, key i, string m)
{
if(m == "lock" && c != chan)
{
lock = TRUE;
llOwnerSay("Locked");
}
if(m == "unlock" && c != chan)
{
lock = FALSE;
llOwnerSay("Unlocked");
}
if(m == "Flick")
{
llSay(0, " "+n + " flicks " + owner + "'s tail sharply with their finger!");
}
if(m == "Nibble")
{
llSay(0, " "+n + " takes a hold of " + owner + "'s tail and nibbles them softly between their lips...");
}
if(m == "Fondle")
{
llSay(0, " "+n + " grabs " + owner + "'s tail and fondles them playfully in their fingers...");
}
if(m == "Rub")
{
llSay(0," "+n + " holds " + owner + "'s tail between their thumb and finger and rubs them up and down... ");
}
if(m == "Bite")
{
llSay(0," "+n + " grabs " + owner + "'s tail and bites down firmly.");
}
if(m == "Tug")
{
llSay(0," "+n + " tugs on " + owner + "'s tail to the side a few times!");
}
if(m == "Squeeze")
{
llSay(0," "+n + " grabs " + owner + "'s tail and squeezes em in their hand!");
}
if(m == "Lick")
{
llSay(0," "+n + " leans over and licks " + owner + "'s tail!");
}
if(m == "Play")
{
llSay(0," "+n + " plays around with " + owner + "'s tail, just being silly. xP");
}
if(m == "Stroke")
{
llSay(0," "+n + " reaches over and strokes " + owner + "'s tail.");
}
if(m == "Tease")
{
llSay(0," "+n + " teases " + owner + " by running their finger lightly over their tail back and forth...");
}
}
}
////////////////////////////TOUCHMENU///////////////////////////////////////////////////

Touchbox (fun)

// OPEN SOURCE!! DO NOT RESELL!!
// © 2008 by FoxSan Yosuke
 
integer second;
vector startPosition;
 
default
{
    state_entry()
    {
        llSetText("I am just a box. \n But whatever you do, do NOT touch me! D:", <1,1,1>, 1.5);
        startPosition = llGetPos();
    }
 
on_rez(integer start_param)
    {
       llResetScript();
    }
 
    touch_start(integer total_number)
    {
        llSay(0, "OMG! You touched me! D: RAEP! HEEELP! O.o");
        llPlaySound("Sound1", 1.0);
        llPlaySound("Sound1", 1.0);
        llSetTimerEvent( 0.5 );
    }
 
timer()
  {
      second++;
      float X_dis = llFrand( 10.0 );
      float Y_dis = llFrand( 10.0 );
      float Z_dis = llFrand( 10.0 );
      vector displacement = < X_dis, Y_dis, Z_dis >;
      vector newPosition = startPosition + displacement;
      llSetPos( newPosition );
      if ( second > 15 )
      {
          while ( llVecDist( llGetPos(), startPosition ) > 0.001)
          {
              llSetPos( startPosition );
          }
          llSay( 0, "I feel SO violated! ._." );
          llPlaySound("Sound2", 1.0);
          llResetScript();
      }
  }
}

Height Detector (by click)

//Title: Height Detector
//Date:11-16-2003 7:24 PM
//Scripter: Francis Chung
 
default
{
    state_entry()
    {
        llSetStatus(STATUS_PHANTOM, TRUE);
        llSetText( "Touch to find out your height", < 1,1,1>, 1 );
    } 
 
    touch_start(integer total_number)
    {
        key avatar;
        string name;
        vector size;
        vector pos;
        string saeheight = "";
        float heightfeet; 
 
        avatar = llDetectedKey(0);
        size   = llGetAgentSize( avatar );
        name   = llDetectedName(0);
        pos    = llDetectedPos(0); 
 
        heightfeet = size.z * 3.28083;
        saeheight  = (string)((integer) llFloor(heightfeet)) + " feet "; 
 
        heightfeet -= llFloor(heightfeet);
        saeheight  += (string)((integer)(llRound(heightfeet * 12))) + " inches"; 
 
        llSay( 0, name + " is " + (string)size.z + " m (" + saeheight + ") tall. (counting your shoes)" ); 
 
        size.x = 0.5;
        size.y = 0.5;
        llSetScale( size );
        // pos.x += 0.5;
        llSetPos( pos ); 
 
    }
}