Thursday, September 11, 2014

Scratch for Second Life [Level II]


Finding Scratch for Second Life was huge for me. It enabled me to move prims nonphysically, something I had been trying and failing to do.

Scratch does a lot more than move prims, however.

Scratch is a program developed by Eric Rosenbaum at at the MIT Media Lab. In essence, it's a programming language that allows you to build a script by assembling modules which are respresented as blocks. When you're finished, Scratch will generate code which you then paste into a script inside your prim.

To use Scratch, watch the three-minute tutorial, then download and run the small program and start moving blocks about. It will take you only a few minutes to create your first Scratch script.

Scratch doesn't do everything one can do with LSL, but it can do quite a lot. Here are its functions:

Moving Prims

  • Move prims forward or backward X meters.
  • Turn prims X degrees left or right
  • Move up or down X meters
  • Roll plus or minus X degrees
  • Pitch plus or minus X degrees
  • Point toward nearest avatar
  • Point toward owner of prim
  • Point in direction X

This allows you to turn a prim and move it in any direction. Movement is limited to ten meters, but it's easy to do sequential movements.

Control

  • Respond to touch
  • Respond to collision
  • Respond when rezzed
  • Respond to chat
  • Wait X seconds
  • Repeat an action X times
  • Broadcast (Say things)
  • Respond differentially using if and else

Looks

  • Say
  • Set hover text to specified color
  • Change color by X amount
  • Set color to specified vector
  • Set level of transparency
  • Change size of linkset by plus or minus X percent

Sound

  • Play sound from Script's short list of sounds
  • Play your own sound

Sensing

  • Determine distance to nearest avatar
  • Determine distance to owner
  • Determine number of avatars within range X meters

Numerical Calculations


  • Addition
  • Subtraction
  • Multiplication
  • Division
  • Generate random number between 1 and 10
  • Less than
  • Equal to
  • Greater than

Variables

  • Create or delete a variable

Pen

  • Clear
  • Pen down
  • Pen up
  • Change pen color by X amount
  1. Set pen color to X

The pen requires a scripted prim called lineSegment. I don't remember how I acquired mine, but it's full perm and I'll be happy to pass a copy to you. Just IM me in world or drop me a notecard.


No comments:

Post a Comment