Page 1 of 1

[Solved]The error code seems to be incorrect

Posted: 21 Apr 2017, 09:22
by BetterBear
Ok guys, for my 2nd plug in, It tooked me 9 hours and 15 minutes to code the JSON, still not working. I'm getting really angry now. I tried almost everything and it still won't work. So I think the JSON error message is wrong.

Re: The error code seems to be incorrect

Posted: 21 Apr 2017, 10:30
by Bearbear76
BetterBear wrote:Ok guys, for my 2nd plug in, It tooked me 9 hours and 15 minutes to code the JSON, still not working. I'm getting really angry now. I tried almost everything and it still won't work. So I think the JSON error message is wrong.
pm me the json file :wink:

Posted: 21 Apr 2017, 10:34
by CommanderABab
He had extra blanks in some of his tags.

Like

Code: Select all

" type": "commercial"
...

Posted: 21 Apr 2017, 10:35
by Lobby
I fear that no one of us has a crystal ball 🔮 so we don't know what you tried to do, what happend instead, and why it happened. What's the error code and why do you think it's wrong?

Please consider to share some answers to this questions with us so we may help you.

Posted: 21 Apr 2017, 10:37
by Bearbear76
CommanderABab wrote:He had extra blanks in some of his tags.

Like

Code: Select all

" type": "commercial"
...
oh :lol:

Posted: 21 Apr 2017, 11:15
by BetterBear
Ehh.... i have one

:lol:

Commander told it. I had too much blanks.

So do i need the json code to be perfectly blankless?
For example, is this right anymore:

Code: Select all

[
     {
"id":"idkwhatisthiscommercial",
"author":"betterbearwholovespizza",
"level": 1,
"width": 1,
"height": 1,
"power": -4,
"water": -2,
"frames":[{"bmp":"betterbearfirstcommercial_bmp.pmg"}],
"workers": 6,
"building time": 15
"type":"commercial"
     }
]

Posted: 21 Apr 2017, 11:17
by Bearbear76
BetterBear wrote:

Code: Select all

[
     {
"id":"idkwhatisthiscommercial",
"type":"commercial",
"author":"betterbearwholovespizza",
"level": 1,
"width": 1,
"height": 1,
"power": -4,
"water": -2,
"frames":[{"bmp":"betterbearfirstcommercial_bmp.pmg"}],
"workers":"6",
"building time":"15"
     }
]
maybe this should work?

Posted: 21 Apr 2017, 11:18
by BetterBear
Lobby wrote:I fear that no one of us has a crystal ball 🔮 so we don't know what you tried to do, what happend instead, and why it happened. What's the error code and why do you think it's wrong?

Please consider to share some answers to this questions with us so we may help you.
The error code was for example, "There was an object unterminated (character 139)", then as i delete some of the code the error character just move on, just making all my stuff nonsense.

And i restarted it more that 62 times. Still no success.

Posted: 21 Apr 2017, 11:23
by Lobby
Something like "Hello World" is called a string with content Hello World. Your strings have to match the expectations of the plugin loader. For example
"id " won't work as "id" is expected. Also "iD" won't work as strings are interpreted in a case sensitive way. Spaces outside of strings will be ignored and can therefore be used to improve readability (for human).

Problems like "There was an object unterminated (character 139)" are called syntax errors. They have nothing to do with the data but with the structure of your json file. Such errors can also be detected by this website.

Your latest code seems to have valid syntax, however I suspect that your image has not the file ending .pmg but .png instead.

Posted: 21 Apr 2017, 16:53
by Lookatmemeow
Aldo in the code you posted there should be a coma ( , ) behind build time : 15

Posted: 22 Apr 2017, 01:18
by Bearbear76
Lookatmemeow wrote:Aldo in the code you posted there should be a coma ( , ) behind build time : 15
really I never putted a , on the last line of code
And it worked fine :shock:

Posted: 22 Apr 2017, 02:24
by Lookatmemeow
Oh no I was talking about the code where there was

Code: Select all

"build time":15
"type": commercial

Posted: 22 Apr 2017, 04:04
by BetterBear
Now it said "ErrorIndexOutOfBoundsException" length=0 index=0

Posted: 22 Apr 2017, 07:07
by CommanderABab
That could be from a missing image file. Or an image that does not fit the width and height indicated in the json file.

I got this when it couldn't find the image:

Code: Select all

In /storage/emulated/0/TheoTown/plugins/Extras/avocado.json:

java.lang.ArrayIndexOutOfBoundsException: length=0; index=0

Posted: 22 Apr 2017, 08:41
by BetterBear
former member wrote:What's the size of your image?
Solved. But maybe im gonna have this issue again when my power plant is finished.