Who Is Online

1
Online

Tuesday, 26 September 2017 05:30

Speedometer

// Speedometer Working By Jimmy Roo
//Here is a Speedometer I made this morning, because I got bored. It will Give your speed in KPH, rounded to the nearest KPH. It works by subtracting the x, y, z values of the current pos, and the pos from 0.5 seconds ago. it then works out the horizontal distance traveled,
 
//square root of (square root of( (x1*x2) + (y1*y2) ) * square root of ( z1 * z2 )))
 
vector current;
vector new;
float xvalue;
float yvalue;
float zvalue;
 
default
{
    state_entry()
    {
        vector current = llGetPos();
        llSetTimerEvent(0.5);
    }
 
    timer()
    {
        new = llGetPos();
        if ( new. x < current .x)
        {
 xvalue = current .x - new .x;
        }
        if ( new .x > current .x)
        {
         xvalue =  new .x - current .x ;
        }
          if ( new .x == current .x)
        {
         xvalue =  new .x - current .x ;
        }
 
                if ( new.y < current .y)
        {
 yvalue = current .y  - new .y  ;
        }
        if ( new .y > current .y)
        {
         yvalue =  new .y - current .y ;
        }
         if ( new .y == current .y)
        {
         yvalue =  new .y - current .y ;
        }
 
                        if ( new.z < current .z)
        {
 zvalue = current .z  - new .z  ;
        }
        if ( new .z > current .z)
        {
         zvalue =  new .z - current .z ;
        }
         if ( new .z == current .z)
        {
         zvalue =  new .z - current .z ;
        }
 
        float beforevalue = llSqrt((yvalue * yvalue) + (xvalue * xvalue));
        float aftervalue =  llSqrt((beforevalue * beforevalue) + (zvalue * zvalue));
 
        llSetText((string)llRound((7.2 * aftervalue)) + " kph", <1,0,0>, 1);
        current = new;
    }
 
}

 

Flash Scratch to SL - Your Scripting Tool

Script ImageNeed to write a LSL script and don't know how to script?  I know I hate trying to get my head around LSLS when I an in a time crunch. So why not give Flash Scratch a try! Its a great tool for learning and scoding your own scripts for Second Life without having to pay someone to do it and without a crash course in LSL

A Huge thanks to John Bennet of ATLAS Institute at University of Colorado and Eric Rosenbaum at MIT for writing Scratch for SL to begin with.

Read more: Flash Scratch to SL - Your Scripting Tool