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 / Arrays not DIMed across #include

Author
Message
Uber Ker Noober
17
Years of Service
User Offline
Joined: 13th Jan 2007
Location: Sheffield, UK
Posted: 19th Aug 2011 19:08
Hi,
when I DIM an array with a custom type in an #include(d) file then try and access it from the main source I get the following error:

Quote: "Array 'jobs' subscripts must match corresponding DIM statement on line 32"


The #include is a gosub to


And the main.agc line that spits the error is


I don't know if this is a bug or my own failings.

Many thanks
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 19th Aug 2011 20:13
Where in your main code is the #include line? It has to be above the point in the program where you make use of what it creates. Preferably at the top before anything else.

Uber Ker Noober
17
Years of Service
User Offline
Joined: 13th Jan 2007
Location: Sheffield, UK
Posted: 19th Aug 2011 21:14
Yeah its right at the top just after resolution setting etc

Then I load media then I gosub to the #include
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 19th Aug 2011 21:23
So your included file would be like,



and in your main you have,



I would think that would work.

Uber Ker Noober
17
Years of Service
User Offline
Joined: 13th Jan 2007
Location: Sheffield, UK
Posted: 19th Aug 2011 21:47
yeah thats basically it. At first I thought it was because I was accessing it from within a function (as arrays are global) but even outside the function a in your example still same error.
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 20th Aug 2011 02:36
The immediate solution is to put the DIM in the main file.

Uber Ker Noober
17
Years of Service
User Offline
Joined: 13th Jan 2007
Location: Sheffield, UK
Posted: 20th Aug 2011 02:40
Yeah thats what I've done. I'm also getting weird "array subscript errors" popping up being reported on lines the code isnt and when the the array is perfectly fine - i.e. used with no difference earlier or later in the code.

Are arrays currently buggy?
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 20th Aug 2011 04:33
Inside includes perhaps. Otherwise, no, at least not that I've seen.

Login to post a reply

Server time is: 2024-04-20 06:31:58
Your offset time is: 2024-04-20 06:31:58