SLUDGE

bodgeFilenames


Syntax:

bodgeFilenames (enable);

Purpose:

Turns on and off the fantastic SLUDGE filename bodging feature. The feature affects the following functions:

loadCustomData and saveCustomData

launch

loadGame

saveGame

showThumbnail

deleteFile

renameFile

getMatchingFiles

fileExists

The enable value turns filename bodging on and off. With filename bodging disabled - as it is desabled by default - the above functions work as expected, and the parameters they take (and return, in some cases) have to be nice, normal filenames. That means the characters / and \ mean a file is in another folder, the character : means a file is on another drive and certain symbols like ? and * are just plain disallowed.

With filename bodging enabled, however, these special characters are all allowed in filenames. This makes it possible for people playing your game to save their games with names like 'Where am I?' and '5: In the jungle' and 'Oh ****' and even names containing multiple odd characters like '8: "776010"? Is this good/bad?'.

The way the system works is to change each illegal or special character into a code before operating on the file (or in the case of getMatchingFiles change each code back into the character it represents, so that in a list of saved games each file is listed with its original name).

You may have to enable filename bodging in certain parts of your game (for example, letting your player load and save) and disable it in others (for example if you're going to launch a URL, or a help file in a different directory).

Return value:

The return value is the previous status of the filename bodging option - i.e. if filename bodging was previously enabled the return value is TRUE, otherwise it's FALSE. Hence, the following code will turn off filename bodging, launch a file and then put filename bodging back to whatever state it was in before:

var old_on_or_off = bodgeFilenames (FALSE);
launch ("manual\\welcome.html");
bodgeFilenames (old_on_or_off);

See also:

File Handling