Don't click here unless you want to be banned.

LSL Wiki : CrashCourse1

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are
Chapter Listing
< 1 2 3 4 5 6 7 8 9 >

1) Comments
Comments are lines prefixed with double-slash. (//)

Here is an example:
// this is a comment

The double-slash may appear almost anywhere, and anything following it on the same line will be ignored by the compiler. They're called "comments" for a reason -- they let you comment your code, explaining and labeling parts of your script. This is very useful, as it lets you explain what your scripts do, not only to others, but to yourself. It's surprising how much of your thought process can be forgotten in a few months.

The other use of comments is to "comment out" a line of code. By using comments when working on a script, you can prevent parts of your script from running, without actually having to delete them. Removing the comment restores the code. This can be useful when troubleshooting a script.

For example:
llOwnerSay("Hello"); // The code on this line will run.
//llSay(0,"Hi there.); This line is commented out. It will not run.

Try it out yourself. Create a new script, and see what happens when you comment out various lines. Most will return errors when you click "Save", but you can comment out either of the llSay lines or even the entire state_entry or touch_start code blocks to prevent them from running at all. (Remember to get every line, including the ones with braces!)

        llSay(0, "Hello, Avatar!");

    touch_start(integer total_number)
        llSay(0, "Touched.");

Previous | Next

Homepage | Tutorial | CrashCourse | Glossary
There is no comment on this page. [Display comments/form]