Nuclear Slingshot Posted July 15, 2012 Share Posted July 15, 2012 When declaring a variable in LSL, can you not use an expression in the declaration? I though you could, but I've been away from SL for awhile and perhaps I'm misremembering. The specific statement in question is:float angle=PI/3.0; which results in a sytax error.It's not a big deal if you can't, I was just curious. Link to comment Share on other sites More sharing options...
Rezz Mode Posted July 15, 2012 Share Posted July 15, 2012 You can declar the variable at the start of your script: float angle; But you cannot set it's value until the script is executing.. angle = PI/3.0; As far as I remember anyway, haven't been scripting for years now! Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted July 15, 2012 Share Posted July 15, 2012 You can use an expression with the declartion if you declare the varable inside the scope of a state (i.e. in an event). You can't use an expression when declaring a global variable - only 'straight' values like: float gfFloat = 0.333; Link to comment Share on other sites More sharing options...
Nuclear Slingshot Posted July 15, 2012 Author Share Posted July 15, 2012 OK, thanks Darkie. That clears that up. Part of the problem is that, other than LSL, I usually program in C#, so I tend to cross-pollinate syntactical rules between the two. Link to comment Share on other sites More sharing options...
Recommended Posts
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