ok=DOESFILEEXIST(FileName$)
PRINT ok,10,10
SHOWSCREEN
MOUSEWAIT
if my FileName$ is Particle.png then it will return 1
if the FileName$ is Particle2.png then it will return 0
Both files are properly named, and exist in the correct directory.
It seems the problem is: when a number is in the filename, it wont find the file.
Sorry, but it does work (in V6.248 anyway) - my Balloonacy game uses numbers in the data files for loading.
My exact (and working code)
FUNCTION load_data:
LOCAL file$="media/data/b"+lvl+".dat"
LOCAL ok=DOESFILEEXIST(file$)
LOCAL n%
IF ok
OPENFILE (1,file$,TRUE)
FOR y=0 TO 23
FOR x=0 TO 39
READBYTE 1, n
map[x][y]=n
NEXT
NEXT
CLOSEFILE 1
ENDIF
ENDFUNCTION
It certainly works with data, not checked with images.
Dont forget all images need to be in the .app directory (or at least in a directory from that)
It does works fine with images - with and without numbers in them :)
Sorry, in Version 7.057
The SpriteZ API error checking mode made me aware of it.
I researched all possible ways to cause this error....everything is named, placed, and declared perfectly.
So, I made a test program(top of this topic), and tested it a dozen times.
I found that, if a number is in the filename(in middle, or at the end, or anywhere in the name)...
...it returns zero. :x
You might want to upgrade to the latest version before testing bugs: 7.061
I tested your code and it works perfectly on my computer.
Are you running this on a Windows machine (case-insensitive filenames) or Mac/Linux (case-sensitive) ?
Quote from: MrTAToad on 2009-Aug-02
Dont forget all images need to be in the .app directory (or at least in a directory from that)
It does works fine with images - with and without numbers in them :)
sigh....yup this is it....i am not used to this extra directory.
I have 2 data directories lol.
Thank you all, for the help fellas, i was overlooking this, over and over again. :S
We've all done that :good: