[Solved]ArrayOutOfBoundsException

Plugin specific problems will be solved here.

Moderator: Plugin Moderators

User avatar
Mayor Jeffrey IX
TheoTown Cartographer
Reactions:
Posts: 989
Joined: Wed Apr 05, 2017 16:48
Location: Right here
Plugins: Show

Platform

[Solved]ArrayOutOfBoundsException

#1

Post by Mayor Jeffrey IX »

Problem is as follows:

Plugin Error

java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
Or is it?
Using 295.

User avatar
Lobby
Developer
Reactions:
Posts: 3497
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta

Platform

#2

Post by Lobby »

Without code it's difficult to help. You probably didn't provide frames.

User avatar
Mayor Jeffrey IX
TheoTown Cartographer
Reactions:
Posts: 989
Joined: Wed Apr 05, 2017 16:48
Location: Right here
Plugins: Show

Platform

#3

Post by Mayor Jeffrey IX »

Image
Image
I have all seven frames (wr1, wr2, wr3, wr4, wr5, wr6, basewindmill).
Last edited by Mayor Jeffrey IX on Mon May 01, 2017 20:00, edited 1 time in total.
Or is it?
Using 295.

User avatar
Lobby
Developer
Reactions:
Posts: 3497
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta

Platform

#4

Post by Lobby »

It would be a lot more easy if you could paste the code directly into the forum using the

Code: Select all

-tags. Also the error message tells you where it occurred, that might be helpful.

It's most likely that there's a mistake in your image names.

User avatar
Mayor Jeffrey IX
TheoTown Cartographer
Reactions:
Posts: 989
Joined: Wed Apr 05, 2017 16:48
Location: Right here
Plugins: Show

Platform

#5

Post by Mayor Jeffrey IX »

Code: Select all

[
{
"id": "wind_rotor01",
"type": "animation",
"frames": [
{"bmp": "wr1.png"},
{"bmp": "wr2.png"},
{"bmp": "wr3.png"},
{"bmp": "wr4.png"},
{"bmp": "wr5.png"},
{"bmp": "wr6.png"}
]
},
{
"id":"floatingwindturbine",
"width": 4,
"height": 4,
"frames": [{"bmp":"basewindturbine.png"}],
"type": "energy",
"needs water": true,
"needs land": false,
"power": 1000,
"draw ground":true,
"price": 8000,
"monthly price": 60,
"needs road": false,
"water": 0,
"influence noise": 35,
"animation":[{"id":"wind_rotor01","x":0,"y":-85}],
"requirement": {
"requirements":
[
{
"type": "HABITANT_COUNT",
"data": {
"count": 300
}
}
]
}
}
]
Man I am such a noob
Image
Or is it?
Using 295.

User avatar
Mayor Jeffrey IX
TheoTown Cartographer
Reactions:
Posts: 989
Joined: Wed Apr 05, 2017 16:48
Location: Right here
Plugins: Show

Platform

#6

Post by Mayor Jeffrey IX »

So do you have an idea of what could be wrong?
Or is it?
Using 295.

User avatar
BetterBear
Inhabitant of a Galaxy Cluster
Reactions:
Posts: 2896
Joined: Tue Apr 18, 2017 9:03
Location: In a place you don't expect.
Plugins: Show
Version: Beta

Platform

#7

Post by BetterBear »

Mayor Jeffrey IX wrote:So do you have an idea of what could be wrong?
I think because he wrote

Code: Select all

"type": HABITANT_COUNT,
And since its a wind turbine, I should be:

Code: Select all

"type":"energy",
Still not sure
BEaRz ArE AmAZiNG. I Am FeElIng SlEepY..

User avatar
Josh
Graphic designer
Reactions:
Posts: 2217
Joined: Sat Mar 11, 2017 19:20
Location: The Netherlands
Plugins: Show
Version: Beta

Platform

Plugin Creator

#8

Post by Josh »

Or do you mean how many habitants, than instead of

Code: Select all

"type": "HABITANT_COUNT", 
"data": { 
"count": 300 
You need to do

Code: Select all

"habitans":300
Proud TheoTown player sinds update 1.1.50

Creator of Aldorria, Covinton Empire, West Country, Sunnydale

Save nature, before it kills you🌲

User avatar
Lobby
Developer
Reactions:
Posts: 3497
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta

Platform

#9

Post by Lobby »

It looks as if it doesn't see the contents of your JSON File :roll:

User avatar
Mayor Jeffrey IX
TheoTown Cartographer
Reactions:
Posts: 989
Joined: Wed Apr 05, 2017 16:48
Location: Right here
Plugins: Show

Platform

#10

Post by Mayor Jeffrey IX »

@BetterBear
This

Code: Select all

"requirement": {
"requirements":
[
{
"type":"HABITANT_COUNT",
"data": {
"count": 300
}
}
]
}
is a seperate line of code, and if you look at the top, you'll see

Code: Select all

"type": "energy",
I know this works 'cause I've used this in other plugins.

@Lobby
Hmmm that's odd... not sure what could cause that.
Or is it?
Using 295.

User avatar
Josh
Graphic designer
Reactions:
Posts: 2217
Joined: Sat Mar 11, 2017 19:20
Location: The Netherlands
Plugins: Show
Version: Beta

Platform

Plugin Creator

#11

Post by Josh »

Do you want a certain amount of habitans to achieve this building?
Proud TheoTown player sinds update 1.1.50

Creator of Aldorria, Covinton Empire, West Country, Sunnydale

Save nature, before it kills you🌲

User avatar
CommanderABab
AB
Reactions:
Posts: 8557
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Platform

Plugin Creator

#12

Post by CommanderABab »

I think that he is trying to make it like the regular wind turbine.
888!888Currently using zeta 888. 888 What's that? :)
quantum road tool!!
:)

Telegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
Mayor Jeffrey IX
TheoTown Cartographer
Reactions:
Posts: 989
Joined: Wed Apr 05, 2017 16:48
Location: Right here
Plugins: Show

Platform

#13

Post by Mayor Jeffrey IX »

I'd like to get it to get unlocked by rank, but that's not the problem. The problem is the error message (see top).
Or is it?
Using 295.

User avatar
Mayor Jeffrey IX
TheoTown Cartographer
Reactions:
Posts: 989
Joined: Wed Apr 05, 2017 16:48
Location: Right here
Plugins: Show

Platform

#14

Post by Mayor Jeffrey IX »

All I want to know is what the error message means.
Or is it?
Using 295.

User avatar
CommanderABab
AB
Reactions:
Posts: 8557
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Platform

Plugin Creator

#15

Post by CommanderABab »

The width and height of the regular wind turbine is 3x3.
888!888Currently using zeta 888. 888 What's that? :)
quantum road tool!!
:)

Telegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
Mayor Jeffrey IX
TheoTown Cartographer
Reactions:
Posts: 989
Joined: Wed Apr 05, 2017 16:48
Location: Right here
Plugins: Show

Platform

#16

Post by Mayor Jeffrey IX »

Ok, I planned it to be 4x4. It's going to be kind of an upgrade to the current one. Not literally.
Or is it?
Using 295.

User avatar
Lobby
Developer
Reactions:
Posts: 3497
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta

Platform

#17

Post by Lobby »

You might consider to send us your current progress to info@theotown.de so we can have a look at it. The error message alone doesn't tell enough about the issue.

User avatar
Mayor Jeffrey IX
TheoTown Cartographer
Reactions:
Posts: 989
Joined: Wed Apr 05, 2017 16:48
Location: Right here
Plugins: Show

Platform

#18

Post by Mayor Jeffrey IX »

I figured out the problem!

It turns out I need to put an actual number of frames.
For example:
I need to change this

Code: Select all

[ 
{ 
"id": "wind_rotor01", 
"type": "animation", 
"frames": [ 
{"bmp": "wr1.png"}, 
{"bmp": "wr2.png"}, 
{"bmp": "wr3.png"}, 
{"bmp": "wr4.png"}, 
{"bmp": "wr5.png"}, 
{"bmp": "wr6.png"} 
] 
}, 
to this

Code: Select all

[ 
{ 
"id": "wind_rotor01", 
"type": "animation", 
"count": 6,
"frames": [ 
{"bmp": "wr1.png"}, 
{"bmp": "wr2.png"}, 
{"bmp": "wr3.png"}, 
{"bmp": "wr4.png"}, 
{"bmp": "wr5.png"}, 
{"bmp": "wr6.png"} 
] 
}, 
That count specifies how many frames there are.
Or is it?
Using 295.

User avatar
Lobby
Developer
Reactions:
Posts: 3497
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta

Platform

#19

Post by Lobby »

That's strange, we don't read a count attribute for animation plugins :roll:

User avatar
Mayor Jeffrey IX
TheoTown Cartographer
Reactions:
Posts: 989
Joined: Wed Apr 05, 2017 16:48
Location: Right here
Plugins: Show

Platform

#20

Post by Mayor Jeffrey IX »

Well, it works now so I'm not gonna complain
Or is it?
Using 295.

Post Reply Previous topicNext topic

Return to “Problems”