LSL Scripts for 4/15

Week 2 UW Scripts

These are modified versions of various scripts from the beginning of chapter 2 of Scripting Your World.

// Script 2a
// Simple sit, rather like Listing 2.1, SYW page 39
vector sitpos = <0,0,1>;    // meters relative to the centerpoint
vector sitrot = <0,0,0>;    // degrees rotation like object edit
default {
  state_entry() {
    llSitTarget(sitpos, llEuler2Rot(sitrot * DEG_TO_RAD));
    llSetSitText("Sit Here");
  }
}

And another:

// Script 2b
// Add spinning
vector sitpos = <0,0,1>;    // meters relative to the centerpoint
vector sitrot = <0,0,0>;    // degrees rotation like object edit
default {
 state_entry() {
   llSitTarget(sitpos, llEuler2Rot(sitrot * DEG_TO_RAD));
   llSetSitText("Sit Here");
   llTargetOmega(<0,0,1>, 1.0, 1.0);
 }
}

And finally:

// Script 2c
vector sitpos = <0,0,100>;    // meters relative to the centerpoint
vector sitrot = <0,0,0>;    // degrees rotation like object edit
default {
   state_entry() {
     llSitTarget(sitpos, llEuler2Rot(sitrot * DEG_TO_RAD));
     llSetSitText("Sit Here");
     llTargetOmega(<0,0,1>, 1.0, 1.0);
   }
   changed(integer bits) {
     if (bits & CHANGED_LINK) {
       key av = llAvatarOnSitTarget();
       if (av != NULL_KEY) {
         llSleep(0.1);
         llUnSit(av);
       }
     }
   }
}