Difference between revisions of "Syntax"

From Second Life Wiki
Jump to navigation Jump to search
 
Line 26: Line 26:
  key x=
  key x=
  list x=
  list x=
  rotation x=<%,%,%,#.#>;
  rotation x=<%,%,%,r>;
  string x="text";
  string x="text";
  vector x=<%,%,%>;
  vector x=<%,%,%>;
Line 36: Line 36:


== Red Text Explanations ==
== Red Text Explanations ==
=== # ===
Replace this with a whole number. Do not use decimals. The number can be as large as
=== #.# ===
Replace this with a number. This number can use decimals. The number can range from
=== % ===
This is the same as #.# except that typically the range is between 0.0 and 1.0. For some scripts, you'll want to go outside this range but most of the time, this range is a percentage represented by 0.0 for 0% to 1.0 for 100%.
=== r ===
This is the same as #.# except that typically the range is between 0.0 and 360.0. For some scripts, you'll want to go outside this range but most of the time, this range is the distance around a circle measured in degrees.
=== text ===
Replace this with
=== x ===
Replace this with the name of a variable. Variables are usually single letters but can be words,

Latest revision as of 08:44, 9 September 2007

Overview and Key

This article is a work in progress

In all the following examples:

Black text indicates text that must be typed or the script won't work Red text indicates text that must be replaced by the text described green text indicates optional text that may be skipped or included depending on your need ____ text indicates optional text that may be skipped or replaced by the text described

These first sections, cover the overall syntax of each line of script. The final section gives a more detailed description of what may be used to replace the red or ____ text in each line of script.

Defining Variables

Other than explanations you might provide, the very first part of every script is where the variables are defined. The variables won't work if they are not defined at the beginning. Essentially, defining variables consists of giving each variable a unique name and defining which of the seven types of variable it is. These lines of script may look deceptively simple and trivial but they are essential to the success of your script. The following is the correct syntax for defining each type of variable.

float x;
integer x;
key x;
list x;
rotation x;
string x;
vector x;

Setting Variables

float x=#.#;
integer x=#;
key x=
list x=
rotation x=<%,%,%,r>;
string x="text";
vector x=<%,%,%>;

States, Events, and Triggers

Functions

Other Syntax

Red Text Explanations

#

Replace this with a whole number. Do not use decimals. The number can be as large as

#.#

Replace this with a number. This number can use decimals. The number can range from

%

This is the same as #.# except that typically the range is between 0.0 and 1.0. For some scripts, you'll want to go outside this range but most of the time, this range is a percentage represented by 0.0 for 0% to 1.0 for 100%.

r

This is the same as #.# except that typically the range is between 0.0 and 360.0. For some scripts, you'll want to go outside this range but most of the time, this range is the distance around a circle measured in degrees.

text

Replace this with

x

Replace this with the name of a variable. Variables are usually single letters but can be words,