[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 » Mon May 01, 2017 17:53

Problem is as follows:

Plugin Error

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

User avatar
Lobby
Developer
Reactions:
Posts: 3373
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Platform

#2

Post by Lobby » Mon May 01, 2017 18:21

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 » Mon May 01, 2017 19:55

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: 3373
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Platform

#4

Post by Lobby » Mon May 01, 2017 19:58

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 » Mon May 01, 2017 20:03

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 » Tue May 02, 2017 14:09

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: 2891
Joined: Tue Apr 18, 2017 9:03
Location: In a place you don't expect.
Plugins: Show
Version: Beta
Phone model: Have 3, all too long

Platform

#7

Post by BetterBear » Tue May 02, 2017 14:20

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: 2212
Joined: Sat Mar 11, 2017 19:20
Location: The Netherlands
Plugins: Show
Version: Beta
Phone model: Iphone 7

Platform

Plugin Creator

#8

Post by Josh » Tue May 02, 2017 14:45

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: 3373
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Platform

#9

Post by Lobby » Tue May 02, 2017 15:32

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 » Tue May 02, 2017 18:26

@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: 2212
Joined: Sat Mar 11, 2017 19:20
Location: The Netherlands
Plugins: Show
Version: Beta
Phone model: Iphone 7

Platform

Plugin Creator

#11

Post by Josh » Tue May 02, 2017 21:02

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🌲

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

Platform

Plugin Creator

#12

Post by CommanderABab » Tue May 02, 2017 21:04

I think that he is trying to make it like the regular wind turbine.
770!770Currently using alpha 770. 770 What's new? :)
Need plugins dialog!!
:)

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 » Tue May 02, 2017 22:14

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 » Wed May 03, 2017 19:06

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

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

Platform

Plugin Creator

#15

Post by CommanderABab » Wed May 03, 2017 19:28

The width and height of the regular wind turbine is 3x3.
770!770Currently using alpha 770. 770 What's new? :)
Need plugins dialog!!
:)

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 » Wed May 03, 2017 19:40

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: 3373
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Platform

#17

Post by Lobby » Wed May 03, 2017 21:32

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 » Wed May 17, 2017 19:39

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: 3373
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Platform

#19

Post by Lobby » Wed May 17, 2017 19:49

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 » Thu May 18, 2017 2:44

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

Post Reply Previous topicNext topic

Return to “Problems”

Who is online

Users browsing this forum: No registered users and 3 guests