Difference between revisions of "User:Dora Gustafson"

From Second Life Wiki
Jump to navigation Jump to search
(Dora's directory)
Line 1: Line 1:
{{LSL Header}}
{{LSL Header}}
==The Talking Die script==
<div id="box">
Place this script in a cube and you have a Die.<br>
== About ==
The Die will say how many pips are on the upward face, after the Die is tossed.
: I have had a premium account since spring 2007.
<lsl>
: Over the time I have made quite a few scripts.
/////
: The scripts are the base for my successful busines.
//  The talking Die script, studio Dora, Dora Gustafson 2008
: Many are published in the SL forums and some are given away.
//  v1.20 Basics
: Here are some fundamental LSL functions in working scripts.
/////
</div>
//  Place this script in a cube and you have a Die.
<div id="box">
//  The Die will say how many pips are up after it is tossed.
== Some fundamental scripts ==
//  Free ware! feel free to utilize this script
* [https://wiki.secondlife.com/wiki/User:Dora_Gustafson/talking_die] Talking Die
//    and texture, partially or as a whole
* [https://wiki.secondlife.com/wiki/User:Dora_Gustafson/llAxes2Rot_right_and_wrong] llAxes2Rot Right and Wrong
//  Please give credit to the creator: Dora Gustafson
</div>
//  You can do that by keeping this header unchanged
/////
 
list pr;
string dieTexture = "b88d3ced-e298-83d7-7da6-e130a337b6ac"; // terning 2x6 SD.png
 
string pips_up()
{
    vector u = llRot2Fwd( llGetRot() );
    vector v = llRot2Left( llGetRot() );
    vector w = llRot2Up( llGetRot() );
 
    // Vectors associated with die pip numbers
    list pips_list = [ u.z, 1, -u.z, 6, v.z, 2, -v.z, 5, w.z, 3, -w.z, 4 ];
    // sort for the one with the biggest Z (vertical up) component,
    // the associated pip number is upward
    return llList2String( llListSort( pips_list, 2, FALSE ), 1 );
}
 
default
{
    state_entry()
    {
        llSetPrimitiveParams([
        PRIM_TEXTURE, 0, dieTexture, < 0.5, 0.333, 0.0>, < 0.75, -0.333, 0.0>, 0.0,
        PRIM_TEXTURE, 1, dieTexture, < 0.5, 0.333, 0.0>, < -0.75, 0.0, 0.0>, 0.0,
        PRIM_TEXTURE, 2, dieTexture, < 0.5, 0.333, 0.0>, < 0.75, 0.333, 0.0>, 0.0,
        PRIM_TEXTURE, 3, dieTexture, < 0.5, 0.333, 0.0>, < 0.75, 0.0, 0.0>, 0.0,
        PRIM_TEXTURE, 4, dieTexture, < 0.5, 0.333, 0.0>, < -0.75, 0.333, 0.0>, 0.0,
        PRIM_TEXTURE, 5, dieTexture, < 0.5, 0.333, 0.0>, < -0.75, -0.333, 0.0>, 0.0 ]);
        llSetStatus( STATUS_PHYSICS, TRUE );
        llSetBuoyancy( 0.5 );
    }
 
    collision_start(integer n)
    {
        llSetTimerEvent( 2.0 );
        pr = llGetPrimitiveParams([PRIM_POSITION, PRIM_ROTATION ]);
    }
 
    land_collision_start(vector v)
    {
        llSetTimerEvent( 2.0 );
        pr = llGetPrimitiveParams([PRIM_POSITION, PRIM_ROTATION ]);
    }
 
    timer()
    {
        list prnu = llGetPrimitiveParams([PRIM_POSITION, PRIM_ROTATION ]);
        if ( pr == prnu )
        {
            llSetTimerEvent( 0.0 );
            llWhisper( PUBLIC_CHANNEL, pips_up() + " pips" );
        }
        else pr = prnu;
    }
}</lsl>
{{LSLC|Library}}

Revision as of 09:36, 17 December 2011

About

I have had a premium account since spring 2007.
Over the time I have made quite a few scripts.
The scripts are the base for my successful busines.
Many are published in the SL forums and some are given away.
Here are some fundamental LSL functions in working scripts.

Some fundamental scripts

  • [1] Talking Die
  • [2] llAxes2Rot Right and Wrong