ID:2472510
 
(See the best response by Kaiochao.)
I'm relatively new to Byond.

I want to change the names of existing character preferences (in this case, skin color) and write a conversion, such that when old savefiles are loaded that contain the old skin color, they are automatically written over with the corresponding new skin color.
Best response
Under the type of object you're saving and loading, you can override Write() and Read() to get and set a "version" associated to the savefile. That lets you check whether a savefile is old or not. Of course, increase the version whenever you make any "breaking changes".
var
const
SaveVersionDir = "save_version"
SaveVersion = 1

Write(savefile/save)
..()
save[SaveVersionDir] << SaveVersion

Read(savefile/save)
var version
save[SaveVersionDir] >> version
if(version < SaveVersion)
// Savefile is older than the current save version
..()

Then, when the savefile is determined to be old, you can read the old variable and convert it:
var variable
save["variable"] >> variable
src.variable = Convert(variable)