Statcounter

05 May 2011

Virtual reality scripting

Second Life has its own scripting language, without which nothing could move. Since SL is user created, anyone can write their own scripts using the built in editor and see them go wrong! Here is a library with some free samples.
Below is one what I wrote myself, the controller for a magic bridge. Say the password and the bridge appears!

// say password to activate prims in object
// this script must be in root prim
// activated scripts can be in any prim
// Oriella Charik 2010

// Bridge melts after (freezetime) seconds
float freezetime = 30;

default
{
state_entry()
{
llSetText("Bridge Power", <1.0, 1.0, 1.0>, 1.0);
// set channel to listen on
llListen(0, "","","");
}

listen(integer channel, string name, key id, string word)
{
if(word=="freeze")
{
llMessageLinked(LINK_ALL_CHILDREN, 0, "start", NULL_KEY);
llSetTimerEvent(freezetime);
}
if (word=="melt")
{
llMessageLinked(LINK_ALL_CHILDREN, 0, "stop", NULL_KEY);
}
}

timer ()
{
llMessageLinked(LINK_ALL_CHILDREN, 0, "stop", NULL_KEY);
}
}

For learning inworld I reccomend the College of Scripting.