Thank you for the replies. I never did find out why sometimes it would create the file and sometimes not. I compiled with and without the data.txt in the final exe. My solution was to get the current directory and force it to write in a specific place by adding get Dir$() at the top of the code. This post got me on the right direction - http://forum.thegamecreators.com/?m=forum_view&t=59148&b=10
ProgramDir$ = Get Dir$()
Then used it in the code below.
~Paul
SaveInfo:
MySavedInfo$ = ""
If SaveData=0
rem Delete file
if file exist(ProgramDir$ + "\datalast.txt") then delete file ProgramDir$ + "\datalast.txt"
wait 10
if file exist(ProgramDir$ + "\data.txt") then move file ProgramDir$ + "\data.txt", ProgramDir$ + "\datalast.txt"
rem delete file "C:\data.txt"
SaveData=1
wait 10
open to write 1,ProgramDir$ + "\data.txt"
rem wait 10
Bannertext$ = "Save Mode changed to 1"
wait 10
endif
if SaveData=1 or SaveData=2
rem Bannertext$ = "Saving Private Ryan"
rem wait 10
MySavedInfo$ = ("Count, " + str$(Count) + ", WinVal, " + RWinValue$ + " , RValTotal, " + str$(RValTotal) + ", " + Bannertext$ + ", Fwin, " + str$(Fwin))
write string 1,MySavedInfo$
SaveData=2
endif[href]null[/href]
http://forum.thegamecreators.com/?m=forum_view&t=59148&b=10