Syntax Error NIGHTMARE
|
|
Borat Kungler
Registered User
Join date: 13 Apr 2007
Posts: 33
|
10-12-2007 12:48
Hello! Ok this is driving me nuts. I know I'm tired but ... ugh. Below is a function I have in my script which I wrote using LSLEditor. When imported in world I am getting syntax error on the line "else if (command == "omega"  { updateProperty (21, value); }" but it looks fine to me. The function updateProperty takes an integer and then string. I don't know how well this will work because of the formatting here so here goes.... parseCommand (string command, string value) { if (command== "channel") { gChannel = (integer)value; llWhisper (0, "The listening channel has been changed to " + (string)gChannel); if (gEnableVoiceCommands) { llListenRemove(gListener); llListen (gChannel, "", llGetOwner(), ""); } } else if (command == "colorint") { gEffect_ColorInterpolation = (integer)value; updateEffects(); } else if (command == "glow") { gEffect_Glow = (integer)value; updateEffects(); } else if (command == "sizeint") { gEffect_SizeInterpolation = (integer)value; updateEffects(); } else if (command == "followveloc") { gEffect_FollowVelocity = (integer)value; updateEffects(); } else if (command == "wind") { gEffect_Wind = (integer)value; updateEffects(); } else if (command == "bounce") { gEffect_Bounce = (integer)value; updateEffects();} else if (command == "followsrc") { gEffect_FollowSource = (integer)value; updateEffects(); } else if (command == "followtarget") { gEffect_FollowTarget = (integer)value; updateEffects(); } else if (command == "colorstart") { updateProperty (1, value); } else if (command == "colorend") { updateProperty (3, value); } else if (command == "alphastart") { updateProperty (2, value); } else if (command == "alphaend") { updateProperty (4, value); } else if (command == "sizestart") { updateProperty (5, value); } else if (command == "sizeend") { updateProperty (6, value); } else if (command == "texture") { updateProperty (12, value); } else if (command == "partlife") { updateProperty (7, value); } else if (command == "syslife") { updateProperty (19, value); } else if (command == "rate") { updateProperty (13, value); } else if (command == "parts") { updateProperty (15, value); } else if (command == "radius") { updateProperty (16, value); } else if (command == "anglebegin") { updateProperty (22, value); } else if (command == "angleend") { updateProperty (23, value); } else if (command == "omega") { updateProperty (21, value); } else if (command == "speedmin") { updateProperty (17, value); } else if (command == "speedmax") { updateProperty (18, value); } else if (command == "acceleration") { updateProperty (8, value); } else if (command == "target") { updateProperty (20, value); } else if (command == "pattern") { updateProperty (9, value); } }
If anyone can tell me why i'm getting these errors it would be greatly appreciated!
|
|
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
|
10-12-2007 13:00
LSL only allows a limited number of IF ELSE statements, more than around 10-13 and that's what happens. Try breaking it into fewer IF ELSE.
|
|
Nika Talaj
now you see her ...
Join date: 2 Jan 2007
Posts: 5,449
|
10-12-2007 13:03
SL is generally happier if you don't cascade if..else's. Do the same thing with more fully nested clauses and it will be ok.
_____________________
.  To contact forum folks, join the inworld group "The Forum Cartel". New residents with questions about SL more than welcome! We has parties!  To contact forum scripters, join the inworld group "Scriptoratti" (thanks Void!). New scripter questions welcome!
|
|
Adz Childs
Artificial Boy
Join date: 6 Apr 2006
Posts: 865
|
10-12-2007 13:08
I don't see any syntax errors. Please run some tests to see if there is a restriction on the number of if/else blocks you can have in a single control structure. This wiki page doesn't say anything about it, so, if you discover that there is one, then please post about it in the wiki. http://wiki.secondlife.com/wiki/If
_____________________
http://slnamewatch.com — Second Life Last Name Tracking — Email Alerts — Famous People Lookup — http://adz.secondlifekid.com/ — Artificial Boy — Personal Blog From: Tofu Linden Hmm, there's nothing really helpful there, but thanks for pasting.
|
|
Malachi Petunia
Gentle Miscreant
Join date: 21 Sep 2003
Posts: 3,414
|
10-12-2007 13:10
Better still, save yourself some work and learn some LSL in the process by not re-inventing the wheel. See: /15/36/124969/1.htmlfor the cannonical particle script.
|
|
Malachi Petunia
Gentle Miscreant
Join date: 21 Sep 2003
Posts: 3,414
|
10-12-2007 13:18
From: someone Please run some tests to see if there is a restriction on the number of if/else blocks you can have in a single control structure. This wiki page doesn't say anything about it, so, if you discover that there is one, then please post about it in the wiki. The old, good wiki does describe the limit*: From: someone Note: Only up to 23 else statements may be in a conditional chain. (a total of 24 conditionals: 1 if and 23 elses) Any more, and a syntax error will occur when the script is saved/compiled. whereas the new, improved, dreadfully incomplete LSL Wiki Portal doesn't. Don't even ask me why they bothered to make a new, improved, dreadfully incomplete LSL Wiki Portal, as you probably wouldn't believe it. * http://www.lslwiki.net/lslwiki/wakka.php?wakka=ifelse
|
|
Borat Kungler
Registered User
Join date: 13 Apr 2007
Posts: 33
|
10-12-2007 14:26
That would make sence because I couldn't see anything physically wrong with the script. Thank you, I am going to give that a try and see what happens.
|
|
Borat Kungler
Registered User
Join date: 13 Apr 2007
Posts: 33
|
10-12-2007 14:28
From: Malachi Petunia Better still, save yourself some work and learn some LSL in the process by not re-inventing the wheel. See: /15/36/124969/1.html for the cannonical particle script. Yes but that's just a particle template - that's not what I'm trying to achieve here.
|
|
Masakazu Kojima
ケロ
Join date: 23 Apr 2004
Posts: 232
|
10-12-2007 19:04
For more information than you ever wanted to know on why this happens, see http://w-hat.com/stackdepth
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
10-12-2007 19:32
You could put all of the variables in a list such as ["colorint", "glow", "sizeint"] then you could find the position. In this example "colorint" would return an integer of "0".
Change your subroutine to use the integers and make it a binary else if test, which is much faster and many more tests are allowed. Don't know the limit but way more then I have ever needed.
Or you could just send an integer instead and skip the list test and go right to the else if's. Just depends on what would be more readable for you.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
10-12-2007 19:39
Hey Darien! Go on vacation for a week so I can catch up and race you to a 1,000!!!!! Of course the winner would still be in 2nd place behind Nika.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Rage Winger
Registered User
Join date: 9 May 2006
Posts: 1
|
11-24-2007 14:55
here's a thought... try deleting the space between "updateProperty" and "  1, value);"
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-24-2007 21:28
wow necromancy on a first post =)
just so you know, LSL ignores whitespace so the space does nothing... you could drop it 4 lines if you wanted
welcome to the forums Rage, it might help to keep to the first page or two when replying to threads, unless you're trying to get more info on a previous thread topic... helps with clutter
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|