Simple Sit Script: deconstructed

posted in: elearning, virtual world | 0
scriptingWithSubquark_002
Is that a torus? wow!

Ikea-wannabe chair designer Ener Hax was hoping to get Dream Walker to script some chairs but timing is everything (read: I should have gone to bed and not logged into the Level 2 Venue grid). =p

Sit scripts are basic scripts to use, but can be a pain to set up when placing in prims that have been cut, hollowed, rotated, spindled, or mutilated (showing my age and the old, old days of computer punch cards! and what is spindling anyway?)

Ener has been making a great collection of chairs for our new endeavor on our very own OpenSim grid hosted by Reaction Grid.

The goal is to create all the furniture needed for making “filming sets” for use in creating video for eLearning scenarios and video podcasts, and also furniture for use in corporate meetings and hotel events. Including details that help raise environmental awareness for meetings in the real world are part of everything we are building (Ener points out the “we” part of this sentence). =D

Apart from my love of eLearning, I taught college Environmental Science for 7 years and we have Matt Courtland from The Natural Strategy consulting with us for “best green practices” in meetings and events (see one of his blog posts on the greening of hotels).

Now for the LSL sit script, hopefully it helps, especially with rotation.

//place this sit script in a prim (poseball) or the root prim of a linked set
//adapted by David Miller - 23 November 2009
//
string text = "sit";
//what you would like the float text to say
//
default
{
    state_entry()
    {
       vector rot=<270, 0, 0>*DEG_TO_RAD;
       //rotation in degrees of avatar on Sit
       //negative values may also be used
       rotation finalRotation=llEuler2Rot(rot);
       //convert rotation
       llSitTarget(<0.2,0.55,-0.3>, finalRotation);
       //x, y, and z position of avatar on Sit
       //negative values may also be used
       //do not use <0,0,0>
       llSetSitText(text);
       llSetText(text,<1.0,1.0,1.0>,0.6);
       //first 3 values are colour of text
       //single value is text alpha - 1 is opaque, 0 is transparent
    }
    changed(integer change)
    {
       if (change & CHANGED_LINK)
       {
          if (llAvatarOnSitTarget() != NULL_KEY)
          {
             llSetText("",<1.0,1.0,1.0>,0.0);
             //hide string text on Sit
             //llSetAlpha(0, ALL_SIDES);
             //if this was a poseball, uncommenting the line above would
             //hide it on Sit
             //to uncomment a line, remove the double forward slashes //
          }
          else
          {
             llSetText(text,<1.0,1.0,1.0>,0.6);
             //restore string text on Stand Up
             //llSetAlpha(1.0, ALL_SIDES);
             //if this was a poseball, uncommenting the line above would
             //show it on Stand Up
             //to uncomment a line, remove the double forward slashes //
          }
       }
    }
}
scriptingWithSubquark_008
Good thing Ener wears shorts!

reposted from the iliveisl blog