Difference between revisions of "Hello Avatar"
Jump to navigation
Jump to search
(reverting this back to the March 7th, 2007 revision. It was only intended to be the example of the default LSL script. All other edits should have had a new page.created) |
m (<lsl> tag to <source>) |
||
(8 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{LSL Header}} | {{LSL Header|ml=*}} | ||
< | The following script contains the default code that is placed in every new script. It says "''Hello, Avatar''" when it is saved or reset and says "''Touched.''" when it is touched. That makes it the LSL representation of the famous [http://en.wikipedia.org/wiki/Hello_world_program Hello world program]. | ||
<source lang="lsl2"> | |||
default | default | ||
{ | { | ||
Line 14: | Line 16: | ||
} | } | ||
} | } | ||
</ | </source> | ||
Notes: | |||
* Scripters should learn to call the simpler [[llOwnerSay]] rather than llSay, in order to avoid making objects that spam the neighborhood via [[PUBLIC_CHANNEL]] zero. | |||
* Scripters should learn to call [[llInstantMessage]] rather than llSay, in order to stop losing chat while far away or logged off. | |||
{{#vardefine:sort|Hello Avatar}}{{LSLC|Library}}{{LSLC|Examples}} | {{#vardefine:sort|Hello Avatar}}{{LSLC|Library}}{{LSLC|Examples}} | ||
{{LSLC|Tutorials}} | {{LSLC|Tutorials}} |
Latest revision as of 12:26, 24 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
The following script contains the default code that is placed in every new script. It says "Hello, Avatar" when it is saved or reset and says "Touched." when it is touched. That makes it the LSL representation of the famous Hello world program.
default
{
state_entry()
{
llSay(0, "Hello, Avatar!");
}
touch_start(integer total_number)
{
llSay(0, "Touched.");
}
}
Notes:
- Scripters should learn to call the simpler llOwnerSay rather than llSay, in order to avoid making objects that spam the neighborhood via PUBLIC_CHANNEL zero.
- Scripters should learn to call llInstantMessage rather than llSay, in order to stop losing chat while far away or logged off.