Author Topic: Improving Your Builds in Second Life  (Read 3793 times)

0 Members and 1 Guest are viewing this topic.

Offline Shawn Fitzpatrick

  • Apprentice Hero
  • ***
  • Posts: 19
  • Karma: 4
    • View Profile
    • ESL Idea Exchange
Improving Your Builds in Second Life
« on: February 22, 2009, 04:25:52 PM »
When building in "Second Life," you or your students may want a greater degree of precision than is possible with the "Object" tab editor of the "Build" menu.  For instance, you may have run into difficulties if you have ever tried placing one or more prims at non-right degree angles to one another, e.g. if you have ever tried constructing a roof for a house.

Depending on how comfortable you are with trigonometry, it's fairly straightforward to calculate such things as the position and rotation of your prim (on paper, at least).  However, when you want to enter these values into the "Object" Editor, it's sometimes difficult to get the level of precision you would like.

To deal with this problem, I wrote the following script, which you are welcome to use if you like.  To use it,

1) Open Second Life
2) Open your inventory
3) Click on "Create Menu" > "New Script"
4) Name the new script something like "Object Editor"
5) Copy (Ctrl-C) and paste (Ctrl-V) everything below into the body of your script
6) Make sure to press "Save" at the bottom of the Script editor

(By the way, the script looks messier than it actually is.  Once you get it imported into "Second Life," it should look a lot more user-friendly.)




////////////////////////////////////////////////////////////////////////
//                                                                    //
// This script allows you to edit the numeric object parameters       //
// of a BOX, CYLINDER, or PRISM, but with much greater precision      //
// than the "Object" tab of the standard "Build" menu.  This will     //
// help you to evenly align your prims when you are working with      //
// non-right angles.                                                  //
//                                                                    //
// To use this script, left-click and drag it onto the                //
// object that you wish to edit and then open the script. (Open       //
// the script by going to the "Content" tab of the object's           //
// "Build" menu.)  Then, select from the list below those object      //
// parameters that you wish to change.  Next, specify the desired     //
// numeric values.  (Specify a value by deleting everything to        //
// the right of the "=" sign, entering the desired value, and         //
// then entering ";" at the end of each line.                         //
//                                                                    //
// For those values that you do not wish to change, simply leave      //
// the command that is already indicated.                             //
//                                                                    //
// After you have made the desired changes, save the script, close    //
// the "Build" menu, and then left-click on the object. The object    //
// should change to meet your specifications.                         //
//                                                                    //
// Finally (and this is particularly important if you have changed    //
// the object's position or rotated it), delete the script from       //
// the object's "Content" menu.  Otherwise, strange things may happen //
// the next time you left-click the object!                           //
//                                                                    //
// Note: Vectors must be in the form: <x, y, z>                       //
// Note: Numeric values can be specified up to 6 decimal places.      //
// Note: If you are working with angles, I'd recommend familiarizing  //
//       yourself with llSin(), llCos(), and DEG_TO_RAD.              //
//                                                                    //
// -Shawn Sonnenkern                                                  //
//                                                                    //
////////////////////////////////////////////////////////////////////////

default
{
    touch_start(integer total_number)
    {


        //////////////////////
        //                  //
        // List begins here //
        //                  //
        //////////////////////

        vector Position     = llGetPos();                                                       // Format: <X, Y, Z>
        vector Size         = llGetScale();                                                     // Format: <X, Y, Z>
        vector Rotation     = llRot2Euler(llGetRot());                                          // Format: <X, Y, Z>
        vector PathCut      = llList2Vector(llGetPrimitiveParams([PRIM_TYPE]), 2);              // Format: <PathCutB, PathCutE, 0.0>
        float  Hollow       = 100 * llList2Float (llGetPrimitiveParams([PRIM_TYPE]), 3);        // Format: Percentage
        vector Twist        = 180 * llList2Vector(llGetPrimitiveParams([PRIM_TYPE]), 4);        // Format: <TwistB, TwistE, 0.0>
        vector Taper        = <1, 1, 0> - llList2Vector(llGetPrimitiveParams([PRIM_TYPE]), 5);  // Format: <TaperX, TaperY, 0.0>
        vector TopShear     = llList2Vector(llGetPrimitiveParams([PRIM_TYPE]), 6);              // Format: <TopShearX, TopShearY, 0.0>

        //////////////////////
        //                  //
        //  List end here   //
        //                  //
        //////////////////////

       
       
        llOwnerSay("PathCut: " + (string)llList2Vector(llGetPrimitiveParams([PRIM_TYPE]), 2) + "  -->  " + (string)PathCut);
        llOwnerSay("Hollow:  " + (string)(100 * llList2Float (llGetPrimitiveParams([PRIM_TYPE]), 3)) + "                               -->  " + (string)Hollow);
        llOwnerSay("Twist:   " + (string)(180 * llList2Vector(llGetPrimitiveParams([PRIM_TYPE]), 4)) + "  -->  " + (string)Twist);
        llOwnerSay("Taper:   " + (string)(<1, 1, 0> - llList2Vector(llGetPrimitiveParams([PRIM_TYPE]), 5)) + "  -->  " + (string)Taper);
        llOwnerSay("TopShear:" + (string)llList2Vector(llGetPrimitiveParams([PRIM_TYPE]), 6) + "  -->  "+ (string)TopShear);
       
        llSetPos(Position);
        llSetScale(Size);
        llSetRot(llEuler2Rot(Rotation));
        llSetPrimitiveParams([PRIM_TYPE, llList2Integer(llGetPrimitiveParams([PRIM_TYPE]), 0),
                                         llList2Integer(llGetPrimitiveParams([PRIM_TYPE]), 1),
                                         PathCut,
                                         Hollow/100,
                                         Twist/180,
                                         <1, 1, 0> - Taper,
                                         TopShear]);
    }
}
« Last Edit: February 22, 2009, 04:48:59 PM by Shawn Fitzpatrick »

Offline Randall Sadler

  • Administrator
  • Superhero Member
  • *****
  • Posts: 263
  • Karma: 87
  • To CMC or not to CMC. That is the question.
    • View Profile
    • ESLweb
Re: Improving Your Builds in Second Life
« Reply #1 on: February 25, 2009, 04:45:29 PM »
Shawn,

Great script!!! That must have been a lot of work--I can see that it made your hair stand on end!!!
Randall Sadler, Administrator, The CMCforum
Assistant Professor, Linguistics
The University of Illinois at Urbana-Champaign,  http://www.eslweb.org

Offline Ryan Boyd

  • Apprentice Hero
  • ***
  • Posts: 12
  • Karma: 5
    • View Profile
Re: Improving Your Builds in Second Life
« Reply #2 on: April 08, 2011, 05:35:55 PM »
Kind of piggybacking off this script idea, would it be possible to insert a script that would allow the user to change the values within the script to modify the size of a prim to be larger than 10x10x10?  There are already megaprims, but creating a script that was able to do something like this would allow for a higher level of customization.  Does this seem possible or does second life block such a script?

Offline Randall Sadler

  • Administrator
  • Superhero Member
  • *****
  • Posts: 263
  • Karma: 87
  • To CMC or not to CMC. That is the question.
    • View Profile
    • ESLweb
Re: Improving Your Builds in Second Life
« Reply #3 on: April 12, 2011, 09:24:41 AM »
Sadly, SL would block such a script so for now we are stuck with megaprims!!
Randall Sadler, Administrator, The CMCforum
Assistant Professor, Linguistics
The University of Illinois at Urbana-Champaign,  http://www.eslweb.org