Jump to content
  • 0

why is there a (syntax error) when trying to save a script?


ral61
 Share

You are about to reply to a thread that has been inactive for 3397 days.

Please take a moment to consider if this thread is worth bumping.

Question

Why is there a (Syntax error) when trying to save a prim script.  I just learned about the (default state), going to the 

(other state) to add a function.  I also had to create extra lines on the example script with (curly brackets), to accommodate

the extra function with lines past (12), to try saving the script.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

A syntax error means you left out, or added an unnecessary puncuation mark, bracket, parentheses etc.  Unfortunately you are not told what it is.  To really learn scripting, go to the wiki and examine examples of all the code you used and see if you can figure out what you did.

If you are really stuck, you can post your script in the LSL Scripting Forum and ask for help there.

  • Like 1
Link to comment
Share on other sites

  • 0

The only way to tell is to look at the script. As Amethyst says,

  • Check to be sure that each scope in the script is bounded by a pair of {} brackets.
  • Check to be sure that each code line (not conditionals) ends with a semicolon ;
  • Check to be sure that conditionals use == and not = where they are appropriate
  • Check to be sure that functions are all spelled properly
  • Check to be sure that all variables are appropriately typed as integer, float, vector ...

It helps if you

  • Use an external editor that offers useful error messages (unlike the editor built into your viewer)
  • Obey standard practice of indenting each scope religiously
  • Use brackets consistently. even in one-line scopes where they are not technically necessary.
  • Post the script in the LSL Scripting forum with a specific question about what you are trying to do and what is not working.
  • Like 1
Link to comment
Share on other sites

  • 0

Learning scripting from (YouTube) tutorials is a challenge to be exact with an example, this a "slight" variation with the (tutor example) & (SL viewer example) script

formulation. I'll need to recreate the whole script again, line for line with brackets & semi colons.

Link to comment
Share on other sites

  • 0

I wouldn't have thought of trying to learn LSL from a YouTube video, but I suppose there's no reason not to. There are much better tutorials in the LSL wiki ( http://wiki.secondlife.com/wiki/LSL_Tutorial ) and elsewhere, and you can visit the College of Music, Scripting and Whatever It Is in world to learn from examples too. Also, as we have pointed out, you could post your script along with a specific question in the LSL Scripting forum to get advice from other scripters.

If you start by modifying an existing script, as you have, the advantage is that you know exactly what you have changed. When the script doesn't work, therefore, you also know exactly where the error must be, so you can go back to that spot and fiddle with it again until it works. The trick is to change only one thing at a time until you are confident enough to make big changes.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3397 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...