Linden Scripting Language

January 22, 2008: 'Second Lifers': Stop Buying, Start Making Cool Stuff With INTRO TO LINDEN SCRIPTING LANGUAGE

Third S.L. Book Makes Heaton The Leader in Third-party S.L. Books

ST. LOUIS, Jan. 22 /PRNewswire/ -- INTRODUCTION TO LINDEN SCRIPTING LANGUAGE FOR SECOND LIFE (ISBN: 1604390042) is now on sale at Amazon.com and other leading online booksellers. The 236-page book can also be purchased at http://www.heatonresearch.com/. MSRP is $24.99 (U.S.).

Understanding Dialogs

    The Linden Scripting Language allows much more direct interaction with avatars than simple touch events. It is also possible to create a dialog. A Second Life dialog can be seen in Figure 6.2.

Figure 6.2: Second Life Dialogs

Speaking and Listening

    Spoken communication in Second Life occurs over channels. When avatars converse with each other, they are communicating on channel 0. Anything that is said on channel 0 near an avatar will be displayed to the screen. Figure 6.1 shows an avatar hearing communication around him.

Figure 6.1: Conversation on Channel 0

Introduction

  • Speaking, Whispering and Shouting
  • Region-wide Communicate
  • Using Dialogs
  • Instant Messages
  • Linked Messages

    There are many ways to communicate in Second Life. Objects can communicate with avatars in many of the same ways that avatars communicate with each other. Objects can also use special communications channels to communicate with each other. Additionally, dialogs can be presented to users to allow them to pick from several options.

Summary

    A string is a set of characters. Strings are usually received from other avatars or notecards. Strings are how the Linden Scripting Language represents text. The Linden Scripting Language provides many built in functions to handle strings.

    Strings can be read from notecards. A notecard is essentially a file that is attached to an object. Notecards are commonly used to hold configuration information for scripts. Strings read in from notecards are usually parsed to obtain the configuration information.

String Comparison

    The Linden Scripting Language makes it very easy to compare two strings. To compare two strings, named stra and strb, the following code would normally be used:

String Functions

    The Linden Scripting Language offers several functions to perform core string operations. While the list of string functions for the Linden Scripting Language is not extensive, they do provide functions to perform all of the fundamental string operations. Table 5.1 summarizes the string functions offered by the Linden Scripting Language.

Table 5.1: Linden String Functions

Summary

    State machines are an inherent part of the Linden Scripting Language. A Second Life script moves through a series of states as it executes. All scripts begin execution in the default state. As the script executes, it can move to other states by using the state command.

    Strings allow the script to manipulate textual information. Strings have been used by many of the programs demonstrated so far. The next chapter will take an in depth look at strings. The functions used to parse and manipulate strings will be covered.

Life With and Without State Machines

    Many scripts are constructed entirely within their default state. This is often bad design in Second Life. Consider the following script, which implements a simple switch that can be turned on or off.

Listing 4.1: Programming without State Machines

Introduction

  • What is a state machine?
  • State machines in Second Life
  • Using state machines
  • Programming with and without state machines

    The concept of a state machine Mark Biss2007-12-12T00:00:00This seems the best so have made it lower caseis not unique to Second Life. State machines are a common programming paradigm. However, no language makes the concept of a state machine as integral as does the Linden Scripting Language. Most of the scripts in this book will be implemented as state machines.

Syndicate content

Copyright 2005 - 2010 by Heaton Research, Inc.. Heaton Research™ and Encog™ are trademarks of Heaton Research. Click here for copyright and trademark information.