Page 1 of 1

Syntax Error When Scripting

PostPosted: January 15th, 2014, 7:35 pm
by TTD03
Hi all, am working on scripting.
I get this error,

..\..\Users\Kyle\Documents\com.nolimitscoaster.nolimits2\Soarin\BlockScript.nlvm(1185) : error C10: Syntax error
...1 error(s), 0 warning(s)

I compared the original script, to my new script and I see nothing wrong with it. Any advice?

Credit to Mrcobra92 for the script.
I will not be uploading this, so I didn't ask for permission to use script. Hope you don't mind!

PostPosted: January 15th, 2014, 7:36 pm
by tiepilot35
If it's a syntax error, the tiniest thing could be wrong. Missing a ; or something. Compare again and look for every detail.

PostPosted: January 15th, 2014, 7:39 pm
by TTD03
Do spaces like this count?

Edit: Can't get more space bar hits between "this" and "count"
but you know what I mean.

PostPosted: January 15th, 2014, 7:51 pm
by Canadmos
Welcome to the world of writing code.

Post the contents of the script.

PostPosted: January 15th, 2014, 7:58 pm
by TTD03
Lol as I am sure you can tell, I am a noob at this.

Now I have done something and gotten this error
error C8: Class not found: BlockScript
...1 error(s), 0 warning(s)

I am going to post the original script that came with the download, and then my version of it.

Original: https://www.dropbox.com/s/qpb1uhaqf6vyc ... cript.nlvm
My Version: https://www.dropbox.com/s/3sw0h2txor4yw ... dited.nlvm

PostPosted: January 15th, 2014, 8:03 pm
by Canadmos
http://pastebin.com/ is your friend for this stuff.

Did you change anything?

PostPosted: January 15th, 2014, 8:12 pm
by TTD03
So what settings should I choose for Syntax Highlighting?
Sorry, what do you mean by change anything?
From file to Pastebin? No
From inside Pastebin? No

Original Script
http://pastebin.com/Pra89JvR

Custom Script
http://pastebin.com/eNsZwXF4

PostPosted: January 15th, 2014, 8:34 pm
by BoboMunkee
Look at the error message you received. See that '(1185)'? That's the line that triggered the the error. That doesn't mean that's the line with the error, but it's close.

In this case, you are missing a closing bracket before line 1185. Add a '}' on the line before 'private void processStorage3Block()'.

It appears you are also missing closing brackets before lines 1232 and 1279.

PostPosted: January 15th, 2014, 8:41 pm
by TTD03
Oh wow I totally missed that!
Now I get this error
..\..\Users\Kyle\Documents\com.nolimitscoaster.nolimits2\Soarin\BlockScript.nlvm(1233) : error C10: Syntax error
...1 error(s), 0 warning(s)

I think I know what I need to do now.
I'll post again if I get really stumped.

Thanks all!

PostPosted: January 15th, 2014, 8:46 pm
by BoboMunkee
Originally posted by TTD03

Oh wow I totally missed that!
Now I get this error
..\..\Users\Kyle\Documents\com.nolimitscoaster.nolimits2\Soarin\BlockScript.nlvm(1233) : error C10: Syntax error
...1 error(s), 0 warning(s)

I think I know what I need to do now.
I'll post again if I get really stumped.

Thanks all!


Sorry, I was editing my post to include those lines and took time to test it.

Also, line 8 needs to be changed to be your class name, the name of the file so change "BlockScript" to "BlockScriptedited"

PostPosted: January 15th, 2014, 9:23 pm
by TTD03
I just changed it to BlockScriptedited for uploading purposes.
I left it at BlockScript for the original.
Thanks for the help!
Will fix it in a bit.

PostPosted: January 15th, 2014, 11:46 pm
by TTD03
Thought I almost had it all fixed.
Then I get this.

BlockScript: Block 'Storage 3' not found

Exception: NullPointerException
at private void BlockScript.updateControlPanel() in line 506
at public void BlockScript.onAutoMode(com.nolimitscoaster.Coaster)
at void com.nolimitscoaster.Coaster.handleScriptedBlockSystemEvents()

Have no idea how to fix this one.

Link to this code: http://pastebin.com/dP5Z07BQ

PostPosted: January 16th, 2014, 11:27 am
by BoboMunkee
Do you have 'Storage 3' defined somewhere? It sounds like you are trying to use it without telling the script what it is. Given the structure of the error, it may be something missing or misnamed in your coaster setup rather than the code.

I'm at work right now, but I'll take a look at the script when I get home to see what I can see.

PostPosted: January 16th, 2014, 12:22 pm
by TTD03
I haven't changed anything, I am pretty sure everything that needs to be defined is defined. I don't think I messed anything up in the coaster set up either. I'll wait to see what you find out.
Thanks.

PostPosted: January 16th, 2014, 11:17 pm
by BoboMunkee
I don't see what the problem could be, but I haven't sat down and read through all the code at the execution level to see what it's supposed to be doing. My suggestion would be to contact the original author if you can.

A Null Pointer Exception means you are trying to perform a pointer operation on something that doesn't exist.

I know you said your coaster is correct, and I'm not saying it's wrong, but the easiest thing to check is your coaster. Make sure there is a 'Storage 3'. I'm sure there is, but you always start with the simplest solution because it's usually the thing you are absolutely sure isn't wrong, that's wrong.

PostPosted: January 16th, 2014, 11:20 pm
by TTD03
Ok so you think I should check in the NL2 editor that Storage 3 exists.
Will try. Thanks

PostPosted: January 19th, 2014, 8:01 pm
by TTD03
Update: I haven't changed anything since the previous error
Now I get a
error C8: Class not found: BlockScript
...1 error(s), 0 warning(s)

EDIT: nevermind about the C8 error, I had the file as a .txt instead of a .nlvm.

Now just getting this error still

BlockScript: Block 'Storage 3' not found

Exception: NullPointerException
at private void BlockScript.updateControlPanel() in line 506
at public void BlockScript.onAutoMode(com.nolimitscoaster.Coaster)
at void com.nolimitscoaster.Coaster.handleScriptedBlockSystemEvents()

Most recent version: http://pastebin.com/FR3ASJV2
Also posting the park file itself: https://www.dropbox.com/sh/xta8ktl1ny9l6tl/ua6Kas2BVe

It should be placed in the com.nolimitscoaster.nolimits2 folder
All credit goes to Mrcobra92 for everything except the little parts I tweaked.