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.

DarkBASIC Discussion / Problems storing and accessing arrays around includes and functions

Author
Message
BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 29th May 2004 10:26
Hey guys, this code seems right. The problem is I've got one .dba file that has all the main map editor program. Inside there are some include files that have a declaration of all my arrays, and one with a function for saving the map.
Simple map:
MAIN PROGRAM

>>>INCLUDE DIM of all arrays
>>>>>>Declare UI image handle globals (in form of array(0) )
>>>>>>Declare map description arrays

>>>INCLUDE SaveMap function
>>>>>>Read arrays from INCLUDE DIM of all arrays
>>>>>>Store them in new arrays not being temporarily used by the main program
>>>>>>Save the arrays to a new directory specified by the user

The code's in the source button with good formatting and in a code box here.


I'm thinking it might not like me using arrays from an include, or possibly not liking it when I try to access maps$(0,1). It puts out a weird error message.

Crazy Donut Productions, Current Project: KillZone
Web Site Button Does Not Work, Visit Here: http://www.geocities.com/crazydonutproductions/index.html
BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 29th May 2004 10:30 Edited at: 29th May 2004 12:02
I found another small glitch.

Quote: "IF Maps$(i,0)=1 then max=max+1"


But when I switch it to:

Quote: "IF int(Maps$(i,0))=1 then max=max+1"


It still doesn't like it.
BTW, sorry for double posting, I thought I had solved the problem, so I posted again, then stuff happened and it got confusing--sorry.

Crazy Donut Productions, Current Project: KillZone
Web Site Button Does Not Work, Visit Here: http://www.geocities.com/crazydonutproductions/index.html
hyrichter
21
Years of Service
User Offline
Joined: 15th Feb 2004
Location: Arizona
Posted: 29th May 2004 22:55
You cannot dimension your arrays in an included file. I think you can only have functions. Someone correct me if I'm wrong, but that's what I've been lead to believe.

Cheers.

BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 30th May 2004 07:14 Edited at: 30th May 2004 07:38
Just swapped around the code. Put all the functions in one file, the main program calling functions and declaring arrays. I still get the funky error though.
.....
.......
Man I feel dumb. Confused the int() and val() commands. That's a lesson learned.

Crazy Donut Productions, Current Project: KillZone
Web Site Button Does Not Work, Visit Here: http://www.geocities.com/crazydonutproductions/index.html
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 30th May 2004 09:31
make the arrays at the top of the main file.

place the functions in the include or at the bottom of the main file.


arrays return results globally now without the need of using any function return parameters




fall down seven times, stand up eight

Login to post a reply

Server time is: 2025-05-24 06:21:26
Your offset time is: 2025-05-24 06:21:26