This is what I did at the beginning of my code.
Works like a charm.
And at the end of your code, before the End stmt put this.
Works like a charm.
Graphics 800,600,16,3 instance = ReadFile("instance.dat") Read1 = ReadInt(instance) If Read1 = 0 ;write 1 to file and continue with game instance = WriteFile("instance.dat") ;SeekFile(instance,0) WriteInt(instance,1) Read1 = ReadInt(instance) CloseFile(instance) Else ;if reaches here that means this game has already been ;started and this instance should exit and end game CloseFile(instance) End EndIf
And at the end of your code, before the End stmt put this.
instance = WriteFile("instance.dat") Read1 = ReadInt(instance2) WriteInt(instance1,0) CloseFile(instance1)