Scripting Basics for the Designer
There should be no such thing as boring mathematics.
Edsger Dijkstra
Just as movie actors need scripts to exchange dialogue with other actors and guide their actions on set, a
virtual environment needs scripts written in a programming language to bring animation and interactivity to
its vehicles, buildings, furniture, vegetation, and animals. Inside the contents of a chaise lounge, entry door,
or a vehicle are scripts that communicate with the avatar, the server, and the client viewer. These scripts are
programs written in languages such as Linden Scripting Language (LSL) for Second Life or OSSL, which is
an API (Application Programming Interface) extention of LSL made for worlds based on OpenSim. In Unity,
languages such as UnityScript, C#, or Boo are used, and you can code in C# for OpenSim as well.
Although scripts are an essential component to most virtual environments, they often present a seemingly
inaccessible workspace for designers with little or no background in computer programming. In this chapter,
the basic elements of a script are discussed, and samples of a few starting scripts are analyzed to help you, the
designer, embark on your own path of discovery about scripting. If you are designing a more advanced virtual
environment that involves complex interactive elements, you should consider hiring a scripter (or coder) to
write the scripts you need. Guidelines about collaborating with scripters are provided in Section 14.6. Also
included in this chapter are various sources online for pre-written scripts which you can adapt for your designs
in Second Life and OpenSim.
The idea of referencing and running a script program on the server from a 3D object in a virtual world may
seem unusual to your designer’s frame of mind, but in fact scripts are used by lots of virtual world content,
and can easily become part of your design thinking.
14.2.1 seTTing design goals for a sCripTed enVironmenT
Good design of script-lled environments starts with a clear set of goals. Let’s suppose you wanted to build
an Art Park in a virtual world. Start thinking about how scripting is incorporated into your design by asking
the following questions:
1. What are the primary needs for scripting in this environment?
2. What are the secondary needs for scripting in this environment?
You might dene the primary needs as: (1) avatar interaction with seating and viewing, (2) avatar
inter action with signage and media on the sim, and (3) avatar movement to all parts of the environment.

Get Virtual World Design now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.