Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Nuthael
14
Years of Service
User Offline
Joined: 5th Aug 2010
Location:
Posted: 5th Aug 2010 13:52
I have an array

dim enemy(100) as CharType

which is in a function called before anything else

I then have a declaration

enemy(nextEnemy - 202).ID = enemyType(enemyType).ID

(nextEnemy ranges from 201 to 300)

which comes up with the error message

"Runtime Error 118 - Array does not exist or array subscript out of bounds ..."

I tried putting global before the dim declaration but there was no change...

any help?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Aug 2010 15:32
Ok, now read what you typed again...

nextEnemy ranges from 201 to 300, but you subtract 202 when accessing the array ... 201-202 = -1, and -1 is out of bounds.

Nuthael
14
Years of Service
User Offline
Joined: 5th Aug 2010
Location:
Posted: 5th Aug 2010 15:35
Touche, changed it to 200 but still get the same error message
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 6th Aug 2010 01:32
What is enemyType set to? It's on the same line, so it could be the problem, too.

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Aug 2010 23:41
Code?

I have no problem commenting on code that I can see, but I'm not going to do so for code I can't.

Levanthus
21
Years of Service
User Offline
Joined: 17th Apr 2003
Location: Cumbria, UK
Posted: 9th Aug 2010 01:19
Quote: "What is enemyType set to? It's on the same line, so it could be the problem, too."


I was wondering that too, as the array is
Quote: "dim enemy(100) as CharType"
and your calling Enemytype?

I don't know too much about arrays but to me that seemed a bit unusual, i could be wrong

I can see from your smile, you're not here for the sunset

Windows 7 64 bit, AMD Phenom II x4 Black edition, 4 GB Ram, Radeon HD 4650, 540 GB HDD
Indicium
16
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 9th Aug 2010 05:43
I think the chartype is for individual characters, and the enemy type for a ground of characters of the same type.

Login to post a reply

Server time is: 2024-11-16 16:03:59
Your offset time is: 2024-11-16 16:03:59