File operations question

Previous topic - Next topic

PeeJay

Is there are a way to delete a file previously created with PutFile? Or rename it?

The project I am working on produces a save game state part way through, but what I hope to do is to do a simple check to test the authenticity of this file (already coded), bring up a warning message if it fails the check (coded), but then either deletes the file, or renames it, so it doesn't go through the file checking procedure again. Does that make sense?

Thanks in advance.
www.peejays-remakes.co.uk
For games, remakes, and GL Basic Tutorials
Artificial Intelligence is no match for Natural Stupidity

Ian Price

I know why you want this ;)

That's a lot of kerfuffle over nothing really PeeJay. At the start of your game you just produce a file (if it doesn't exist) that holds lots of random values (only one of which is the real deal). Only alter this file once the required section is completed and update all of the values including the real deal within the file.

A quick check of that file (only when it's really needed) for the real deal value will either allow further progress or not. Checking would be (near) instantaneous and no further file manipulation would be required. I gave an example of file reading and writing on these forums, just use something similar. It's incredibly quick and would be invisible to the user.

Trying to do something more complex is probably a waste of time.

Of course, you could always encrypt the file using  something like base64 (I have an example if you require it).
I came. I saw. I played.

Kitty Hello

KILLFILE uhm... kills a file.
DOESFILEEXIST also exists.

PeeJay

Thanks to both.

Ian - while this is okay in principle, I prefer the idea of doing a "cheat check", then flashing up an anti cheat warning, and removing the offending file is my preferred option (but then I always was a bit odd!)

Gernot - thanks for that - I couldn't find KILLFILE in the help - it is there, but it is not linked to by any other file command "Refs" section - should be a quick and easy update to the help file for you ;)
www.peejays-remakes.co.uk
For games, remakes, and GL Basic Tutorials
Artificial Intelligence is no match for Natural Stupidity

Kitty Hello

Uhm.. It's there. By Cathegory/Inpu-Output/KILLFILE. No?

PeeJay

Yep, it's in the help file, but is it not linked to from GetFile, PutFile, DoesFileExist etc - which is why it didn't jump out at me
www.peejays-remakes.co.uk
For games, remakes, and GL Basic Tutorials
Artificial Intelligence is no match for Natural Stupidity