2toe Bigboots Posted June 22, 2011 Share Posted June 22, 2011 WHy do i get a syntax error on state clocked ?? float cloakSpeed = .1; default { touch_start(integer total_number) { if(llDetectedKey(llGetOwner())); { integer x; float xf; for (x=9; x>=0; x--) { xf = x * .1; llSleep(cloakSpeed); llSetAlpha(xf,ALL_SIDES); } state cloaked; } state cloaked { touch_start(integer total_number) { if(llDetectedKey(llGetOwner())); } integer x; float xf; for (x=1; x<11; x++) { xf = x * .1; llSleep(cloakSpeed); llSetAlpha(xf,ALL_SIDES); } state default; } } Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted June 22, 2011 Share Posted June 22, 2011 I thimk there a closun } missing in state default - but more importantly: the argument llDetzectedKey takes is an integer - not a key Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted June 22, 2011 Share Posted June 22, 2011 Looking at the script a little more I realized it was a complete bracket mess float cloakSpeed = .1; default{ touch_start(integer total_number) { if(llDetectedKey(0)) { integer x; float xf; for (x=9; x>=0; x--) { xf = x * .1; llSleep(cloakSpeed); llSetAlpha(xf,ALL_SIDES); } state cloaked; } }}state cloaked{ touch_start(integer total_number) { if(llDetectedKey(0)) { integer x; float xf; for (x=1; x<11; x++) { xf = x * .1; llSleep(cloakSpeed); llSetAlpha(xf,ALL_SIDES); } state default; }} 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 22, 2011 Share Posted June 22, 2011 Actually, it's not a missing } . The OP put a } right after the if statement instead of a { . This sort of error is very easy to detect if you always write in an external LSL editor that has decent error checking and gives meaningful error messages. ETA: Yup, and the missing } at the end of state default, which you got and I overlooked, Darkie. :smileytongue: Link to comment Share on other sites More sharing options...
2toe Bigboots Posted June 22, 2011 Author Share Posted June 22, 2011 TY i do that a lot im trying to wright from scratch instead of taking a written and change it lol from now on as i had been doing. Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted June 22, 2011 Share Posted June 22, 2011 No worries - you'll get there Link to comment Share on other sites More sharing options...
Void Singer Posted June 22, 2011 Share Posted June 22, 2011 indents.... should happen with every open brace, and every close brace should see an un-indent, in pretty much every style. the two most popular bracint styles are 1TBS and Allmans 1TBS: default{ //-- open brace on the same line as the control structure state_entry(){ //-- always another indent level after each brace } //-- closing brace drops back an indent level to the level of it's control structure} //-- you know you've done it right when you close at no indent, every open must have a close Benefit: less scrolling, lines always end with a brace or a semicolon (or a line continuation character for banner lines) Allmans: default{ //-- open brace on separate new line after the control structure state_entry() { //-- always another indent level after each brace } //-- closing brace at the same indent level of it's control structure} //-- you know you've done it right when you close at no indent, every open must have a close Benefit: more separation of block code makes it quicker to identify and braces are quick to match (unlesss the code scrolls too far) 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