Monday, February 20, 2012

2/20/12 Simple Scripts with Scratch 4SL. Example.

Simple Scripting with Scratch

Here is a concrete example of creating a script with Scratch.  We will put a script into an object to make it rattle and roll when touched.  The object is a crate which has fallen off of a pirate ship.

Think about your screen as divided into 4 parts:
  • the Commands (in Scratch), 
  • the Script a place where commands are assembled (in Scratch), 
  • your Inventory where you save the script on your grid, and 
  • the contents of the OBJECT you are scripting for. 
You move from left to right, going through each one of these sections.
In this video you can see the crate outlined in yellow - this is the object we are scripting for.

Scratch Commands --> Scratch Script   First move commands into the script window.  
From the control menu:  When I am touched
From the sound menu (the rattle):  Play Sound  (type in the name of the sound.  I put in rattle441)
From the Motion menu (the roll): Roll 15 (this is the motion.  Change 15 to 90 = 90 degrees)

From the control menu:  Repeat (type in how many times you want it to repeat.  I put in 6 times)

Scratch Script -->  Linden Script --> Inventory 
Save the Scratch script as a Linden script (Copy Linden Script button).
Then, Create a New Script in your inventory.
Named the New Script.  We named it rattle and roll.  Double click on it to open it.
Paste. The Linden Script will automatically paste in.




Inventory --> Object Contents.
If the Object isn't opened yet,
Right click (opt-command) on the object you want to rattle and roll.
Select Edit.
The editing box will come up.
Click on the contents tab.
Drag the script rattle and roll from the inventory into the contents.
Drag the sound rattle 441 from the inventory into the contents.
Close the inventory. Close the editing box.
Test!


(video coming)

These scripts can involve sound, motion and any number of other actions.





Wednesday, February 15, 2012

2/15/12 Simple interaction using Scratch

Making Scripting Simple


It is important to make all of the features of the virtual world as accessible to users and to creators as possible.  Scripts provide this accessibility.  Teens can learn OSS (OpenSim Scripting) but the learning curve is fairly steep.  Most will want a simple way to generate scripts for movement, for sound and for special effects.


You have a few options in how to create a script.
  • You can create your own script.
  • You can copy existing scripts and edit them for your purposes.  An example of how to do that with sound scripts is in an earlier post.
  • You can create YOUR OWN UNIQUE interaction using a script generator - Scratch for Second Life.
--> Background:
Scratch is an animation scripting program and is a project of the Lifelong Kindergarten Group at the MIT Media Lab.   Eric Rosenbaum is in this Group.  He has taken Scratch and developed an interface to convert Scratch scripts to LSL (Linden Scripting Language) and OSS.


--> The link to download Scratch for Second Life (S4SL) is:
http://web.mit.edu/~eric_r/Public/S4SL/
It looks like this when you open it:



The left column is Commands.  Clicking on the categories on the upper left will bring up different commands that you can string together to create movement, sound and interaction.  You drag the Commands into the Script area to create the script.  Go to the next blog post to see an example of Creating and Using a Scratch Script.


Tuesday, February 14, 2012

2/13/12 The importance of detail and interaction

Create Interaction and Detail

One of my hypotheses is that including attention to detail and interaction will be more motivating and engaging for users in the environment.  So, I have a shipwrecked pirate ship that is fun.  You can crawl all over it and find boxes and items that you may be able to use in your own builds.

I have built 3 levels of detail and interaction.  This is the beginning of thinking of a taxonomy of interaction:

  • First level (visual) - There are a number of crates (thank you AJ Kelton) scattered on the sea floor, the beach and in the pirate ship.
  • Second level (audio) - when you touch these crates, a noise is made - a bomb, a creak, a zing, a rattle and so on.
  • Third level (animated) - when the crates make a noise, they move. They all move differently and there is a relationship between the noise and the movement.  For instance, one crate has a whistle and then a bomb sound when touched.  As the whistle starts , the crate moves 2 meters up, rotates and falls back down hitting the ground as the bomb goes off.
(video coming)

You get visual by BUILDING inworld.  There will be several posts in the future explaining how to build inworld.  You get audio and animation by WRITING SCRIPTS that tell the objects what to do.  The next blog posts explain how to write a script using Scratch for Second Life.

Sunday, February 12, 2012

2/9/12 Clean Inventory

Keep Your Inventory Organized

As I spend time on Peninsula and create objects, textures and scripts, my inventory becomes increasingly long without any structure.  What I have found are:
  • At least 25 - 30 'Primitives' - objects that I created but didn't name.
  • Several versions of objects with the same name, some of them duplicates, some of them different versions.
  • Many objects that I bought from Linda Kellie but haven't used yet.
  • Other objects that I copied from Joe Essed or AJ Kelton and haven't used yet.
In all, a few hundred objects, scripts, textures, gestures, clothing, etc.
I need to organize these so I know what I have.

Organizing inventory is the same as organizing the files on your computer.  You create folders and folders within folders, and file your objects, scripts, texture, gestures, etc. in the way that makes most sense to you.  I created folders in 'objects' for botanicals, buildings, food, furniture and doodads, land, outdoor items and vehicles, and filed all my objects in those folders.  By doing this I discovered a number of items that I had forgotten or didn't know I had in my inventory.

The diagram below shows where to open inventory and how to add a folder.


If you want to delete an item, highlight the item and then click on the trash can on the lower right hand side.  It will ask you if you want to delete it, click yes and it will be removed from your inventory.  This is not undoable.

Tuesday, February 7, 2012

2/7/12 Hypergridding

Hypergridding 
- the ability to move from grids and regions to other grids and regions in OpenSim through teleporting.

Think of the Hypergrid as a planet with hundreds of grids (like countries) and thousands of regions.  Regions are individual areas on a grid.  My region is Peninsula.  My grid is Kitely.


If I want to go from one grid to another I have to Hypergrid - teleport using Hypergrid coordinates.  The technical part is complicated.  The key to Hypergridding is knowing regions hypergrid coordinates.

4096 is the magic number.
You can only move 4096 regions in one Hypergrid jump.  If you want to to go further you have to make more than one jump.  You need to know the hypergrid coordinates to know if you need to make more than one jump.  Think about it like a tank full of gas - for trips over 250 miles or so, you have to stop and get more gas.

Todays trip was:  (thank you Pathfinder for this information)
1)  We started in Jokaydia (grid) Scooter (region)
Hypergrid Address: 71.6.165.144:8002:Scooter
Region: Scooter
Hypergrid Coordinates: (1000,1000)


Jokaydia:Scooter


2) Then we teleported to the 'gas station' at OpenSim:
Hypergrid Address: hg.osgrid.org:80:jump4000
Region: jump4000
Hypergrid Coordinates: (4090,4090)


OSGrid:jump4000

3) Then we teleported to Butterflysmack (grid) Butterfly (region):
Hypergrid Address: butterflysmack.com:9000:Butterfly
Region: Butterfly
Hypergrid Coordinates: (5659,4203)


Butterflysmack:Butterfly

Notice that the distance from Jokaydia (1000, 1000) to Butterfly (5659, 4203) is MORE than 4096.  That is why we had to stop in OSGrid.  Here in Butterfly, avatars surfing the hypergrid place their flags to let others know they have been here.



My grid in Kitely is NOT on the Hypergrid yet.  That is a feature Kitely is considering adding, but as of now has not.

Hypergridding is a more advanced feature:
Here are Pathfinder Lesters instructions on how to Hypergrid.  Unless your home grid is on the Hypergrid, it may be time consuming to figure it all out.

How to make a Manual Hypergrid Jump in 4 easy steps
1) Open your World Map in your viewer.
2) In the text box next to the Search button, enter the Hypergrid Address.
3) Click the Search button and wait for the map to move to the destination region.
4) Click the Teleport button.

For a list of Hypergrid Landmarks, see http://becunningandfulloftricks.com/hypergrid-landmarks/


Monday, February 6, 2012

2/6/12 Quick Sounds

Quick Sounds

I want sounds when avatars interact with my objects.
Here is a script that works for me to create a sound when an object is touched.

Quick Sound Script:
default
 { // this open curly bracket denotes the start of the state    state_entry() // an event   
{llSay(0, "Watch out!");     }   
touch_start(integer total_number)  // another event    
{llPlaySound("bomb",1.0);    }}// end of state entry
YOU put in what you want for the words in red
        the words that will come out in the chat - "Watch out!"
        the name of the sound in the inventory - "bomb441"

You need to make sure the sound is part of the objects inventory.  To do this, just drag the sound from your inventory to the contents tab on the object.  Follow it with the script.  Like this:

(video coming)

A little more technical.

Unless you create your own sounds, you have to download sounds from the web, then upload them into your viewer.

Three things to keep in mind:
1)  The sound has to be at 44.1kHz.
You can resave the sound at 44100 Hz using Audacity if it is at a different frequency.
Download Audacity from (it is free):
http://audacity.sourceforge.net/download/
2)  The sound has to be less than 10 seconds.
3) A couple of free sources for sounds:
http://www.findsounds.com/ISAPI/search.dll
http://www.wav-sounds.com/

Let me know if you have other free sources of sounds.

So, in this order:
Decide what sound you want.
Locate it on the internet.
Make sure it is 10s or less.
Download it to your desktop. (right-click for pc, opt-command for mac)
Use Audacity to save it at 44.1KHz if it isn't already.
Upload it into your Inventory.
Drag it from your inventory into the contents of the object that is to make the sound.
Drag the premade script or create a script (see above) into the contents of the object.
Save.  Test.