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.
function SaveMap()
rem Prepare MapObj$ array
max=0
max2=2
max3=10
for i=1 to max3
if Maps$(i,0)=1 then max=max+1
next i
dim MapObj$(max,max2)
for i=1 to max
for x=1 to max2
MapObj$(i,x)=Maps$(i,x)
next x
next i
rem Prepare StaticObj$ array
max=0
max2=11
max3=100
for i=1 to max3
if Statics$(i,0)=1 then max=max+1
next i
dim StaticObj$(max,max2)
for i=1 to max
for x=1 to max2
StaticObj$(i,x)=Statics$(i,x)
next x
next i
rem Prepare DoorObj$ array
max=0
max2=12
max3=50
for i=1 to max3
if Doors$(i,0)=1 then max=max+1
next i
dim DoorObj$(max,max2)
for i=1 to max
for x=1 to max2
DoorObj$(i,x)=Doors$(i,x)
next x
next i
rem Prepare ExplodableObj$ array
max=0
max2=12
max3=25
for i=1 to max3
if Explodables$(i,0)=1 then max=max+1
next i
dim ExplodableObj$(max,max2)
for i=1 to max
for x=1 to max2
DoorObj$(i,x)=Doors$(i,x)
next x
next i
rem Prepare LightObj$ array
max=0
max2=12
max3=100
for i=1 to max3
if Lights$(i,0)=1 then max=max+1
next i
dim LightObj$(max,max2)
for i=1 to max
for x=1 to max2
LightObj$(i,x)=Lights$(i,x)
next x
next i
rem Prepare AIObj$ array
max=0
max2=12
max3=75
for i=1 to max3
if AIs$(i,0)=1 then max=max+1
next i
dim AIObj$(max,max2)
for i=1 to max
for x=1 to max2
AIObj$(i,x)=AIs$(i,x)
next x
next i
rem WeaponObj$ array
max=0
max2=12
max3=125
for i=1 to max3
if Weapons$(i,0)=1 then max=max+1
next i
dim WeaponObj$(max,max2)
for i=1 to max
for x=1 to max2
WeaponObj$(i,x)=s$(i,x)
next x
next i
rem TriggerObj$ array
max=0
max2=12
max3=20
for i=1 to max3
if Triggers$(i,0)=1 then max=max+1
next i
dim TriggerObj$(max,max2)
for i=1 to max
for x=1 to max2
TriggerObj$(i,x)=s$(i,x)
next x
next i
rem Prepare SpawnObj$ array
max=0
max2=12
max3=20
for i=1 to max3
if Spawns$(i,0)=1 then max=max+1
next i
dim SpawnObj$(max,max2)
for i=1 to max
for x=1 to max2
SpawnObj$(i,x)=s$(i,x)
next x
next i
rem Prepare CPorFObj$ array
max=0
max2=12
max3=20
for i=1 to max3
if CPorFs$(i,0)=1 then max=max+1
next i
dim CPorFObj$(max,max2)
for i=1 to max
for x=1 to max2
CPorFObj$(i,x)=CPorFs$(i,x)
next x
next i
input "Please enter the name for the map:", mapname$
oldDIR$=get dir$()
set dir oldDIR$+"\levels"
make directory mapname$
set dir oldDIR$
filename$="Levels\"+mapname$
save array filename$+"map", Maps$(0)
save array filename$+"static", Statics$(0)
save array filename$+"door", Doors$(0)
save array filename$+"explodable", Explodables$(0)
save array filename$+"light", Lights$(0)
save array filename$+"ai", AIs$(0)
save array filename$+"weapon", Weapons$(0)
save array filename$+"trigger", Triggers$(0)
save array filename$+"spawn", Spawns$(0)
save array filename$+"CPorFs", CPorFs$(0)
print "''"+mapname$+"'' SAVED"
endfunction
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