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.

AppGameKit Classic Chat / array accessed with too few subscripts ERROR

Author
Message
IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 21st Jan 2014 19:35 Edited at: 21st Jan 2014 19:36
I am trying to bring my code from an earlier AppGameKit up to 1.08 b19

I keep getting this error
"array accessed with too few subscripts"

but my arrays are dimmed correctly, just as they've always been.



Attachments

Login to view attachments
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 22nd Jan 2014 17:21
Please show where the 'm' array is defined.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 23rd Jan 2014 22:31 Edited at: 23rd Jan 2014 22:33
line 819:
Dim m[100] as MonsterMaster

line 342:
Type MonsterMaster
n as string
desc as string
Race
Flee
HPmax
SciKill
Speed
Range
Damage
Reload
Melee
Power
Stationary
Breeder
Lurker
MountainWalk
WaterWalk
AcidWalk
LavaWalk
NebulaWalk
StormWalk
Space
Planet
AggRad
DropCommod
DropItem
DropDevice
AttackWords as string
MeleeWords as string
Varieties As string
ExploType
PowerLevel
Endtype

like I said, this has been working for 6 months.
then I "upgraded" to 108b19

and when I REM that call out, it just gives the same error, on another UDT, that has also been properly defined, somewhere else in the program.

there's also tons of 'out of bounds' checking

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Jan 2014 01:41
Is there a limit on the number of UDT properties?

In an unrelated question, 11k lines?! Have you considered breaking this down into separate smaller, more manageable files?

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 24th Jan 2014 04:29
Even though the dim command is supposed to automagically make an array global, I always explicitly declare them as global.

Try changing 'Dim m[100] as MonsterMaster' to 'global dim m[100] as MonsterMaster'.

Also, check to make sure that the variables used as indices cannot possible be less than zero or more than one hundred. An out of bounds error sometimes reports incorrectly.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 24th Jan 2014 05:58
I will try the global thing, the next time I dare approach it.

I worked for one full day on getting it to run in 108b19.
I have since reverted to the earlier stable version,
where I experience none of these problems.

I will admit that 108b19 had some benefits over the existing version, but they don't outweigh random crashes.

About the "11k lines" , I get improper error line reporting when I split it up. I did split it up in b19, and that was nice,
but it didn't help anything.

As I stated above, I have done extensive "bounds" checking, to ensure that the variable is within the proper limits 1-100.

Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 24th Jan 2014 10:10
If you have out of bounds errors elsewhere that are not reported you can get random errors. AppGameKit doesn't report out of bounds errors on some arrays, multi dimensional ones IIRC, or was it typed.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 24th Jan 2014 11:43
i put it in a smaller code for testing, but here i get no compiler error.
maybe the error comes from elsewhere.



AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 24th Jan 2014 16:41
yes, Markus - but you don't have an 11,000 line file!

-- Jim - When is there going to be a release?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 24th Jan 2014 19:25
@JimHawkins
ok, its not impossible that the error comes from too much lines of code
but i don't think so.
i believe the compiler collect all code in one "file" or in memory
and then it will compiled.

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 7th Apr 2014 23:25 Edited at: 7th Apr 2014 23:26
Did you ever get this problem sorted IBOL? What caused it in the end?

I ask because I have exactly the same error, and I've been ripping what remaining hair I have out trying to determine why it's happening.

>Edit<
I should say I'm using build 108.21

IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 18th Apr 2014 08:13 Edited at: 18th Apr 2014 08:13
Hi, my friend
no I never had any luck.
I didn't have TIME to fight with it.
I still don't. I have a release schedule.
I reverted to an old version and plowed ahead.
what it *did* do was add the windows 8 bug, that I didn't used to get.

However, one day in the shower, months later,
I THINK I SOLVED IT!
I haven't tried it,
but here the idea:

Some of my arrays are small things like m[] and mi[].
I know for a fact that I sometimes declare just plain old M as a variable sometimes, because I call m[m].n and stuff.

I am thinking that THAT is the problem.
I need to do a 'replace' of all my array NAMES, to something like "Monster Master" (which is what m[] stands for).

But I haven't tried it yet. It is my secret hope that I can make it work.

I would love to know if you find this helpful.

=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 20th Apr 2014 02:52
I fixed it..

I had an array ( scrollerID[0]), which I was trying to access using a number greater than 0.

It was not however the array that the error messages were telling me about.

Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 21st Apr 2014 20:20
Not a big surprise. Hopefully the new compiler will be much better at catching these.

DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 22nd Apr 2014 11:06
Yes, I'm hoping V2 catches things better. I've had a few coding errors that give completely odd error messages and point to totally innocent lines only to find an obvious syntax style error later.

Login to post a reply

Server time is: 2024-11-25 05:00:46
Your offset time is: 2024-11-25 05:00:46