LoginLogin

How do you detect if a DAT file or TXT file exists?

Root / Programming Questions / [.]

bluemonkey1111Created:
I want to make it go to a different part of a program if the file loaded. If it doesn't, then I want it to continue like normal.

IF !CHKFILE("TXT:TEST") THEN GOTO @NOTFOUND Will go to @NOTFOUND if the file doesn't exist. You can use DAT as well. GRPs are specified with the DAT prefix too, so GRP:TILES would be DAT:TILES.

If instead want to check if in the load dialog the user cancels or loads, check if the RESULT variable is different from 1: -1 will represent user cancel, and 0 will mean that the file didn't exist.

Thanks! That was exactly what I needed!