I am sure that I am missing something simple here but I just can't see it.
This is part of my save routine. I have created a folder (SaveAs$). In this folder there are two subfolders ("Tiles" and "Resources"). This part of the save routine looks through an array and flags in TempArray() which files to copy.
The second section (the one that deals with resources) works fine, it copies the correct files to the correct place no probs. However, the first part that does essentially the same thing only that it copies files to a different place (the "Tiles" folder instead of the "Resources" folder) refuses to copy anything at all!. I thought the UDT might be the weak spot but I have found that even if I REM out every line except the COPY FILE line and specifically name the file that I want to copy it refuses to do so!!!! I just don't understand what is happenig especially since the resources routine below which is the same code essentially works fine!!
Please can somebody take a look at this code and see where I am going wrong. I have been trying to sort this out for 2 days and it is stopping me releasing my program!
`**********************************************************************************************************
`Now we need to work out what tiles have been used on the map
DIM TempArray(NoOfTileImages)
`Set TempArray() values to 0
FOR a = 1 TO (NoOfTileImages)
TempArray(a) = 0
NEXT a
`This scans through the map. Every used tile will be flagged in TempArray as a 1
FOR a = 1 TO NoOfTileImages
FOR b = 1 TO MapSizeX
FOR c = 1 TO MapSizeY
IF map(b, c, 0) = a THEN TempArray(a) = 1
NEXT c
NEXT b
NEXT a
`TempArray() now contains a list of 1's and 0's. A 1 indicates that tile has been used - copy it
`to the 'Tiles' folder
SET DIR ".."
FOR a = 1 TO NoOfTileImages
IF TempArray(a) = 1
`This tile has been used in the map and must be saved
COPY FILE ".\Tiles\" + TileInfo(a).Name + ".bmp", ".\Maps\" + SaveAs$ + "\Tiles\" + TileInfo(a).Name + ".bmp"
ENDIF
NEXT a
UNDIM TempArray(NoOfTileImages)
`**********************************************************************************************************
`Now we need to work out what resources have been used on the map
DIM TempArray(NoOfResources)
`Set TempArray() values to 0
FOR a = 1 TO (NoOfResources)
TempArray(a) = 0
NEXT a
`This scans through the map. Every used resource will be flagged in TempArray as a 1
FOR a = 1 TO NoOfResources
FOR b = 1 TO MapSizeX
FOR c = 1 TO MapSizeY
IF map(b, c, 1) = a THEN TempArray(a) = 1
NEXT c
NEXT b
NEXT a
`TempArray() now contains a list of 1's and 0's. A 1 indicates that a resource has been used,
`copy it to the 'Resources' folder
SET DIR ".."
FOR a = 1 TO NoOfResources
IF TempArray(a) = 1
`This tile has been used in the map and must be saved
COPY FILE ".\Resources\" + ResourceName$(a) + ".bmp", ".\Maps\" + SaveAs$ + "\Resources\" + ResourceName$(a) + ".bmp"
ENDIF
NEXT a
UNDIM TempArray(NoOfResources)
Thanks a lot guys,