ID:2808623
 
So, I've tried to do this for a while but it doesn't even read it properly, so I have a saving and loading of ranks via save file but it doesn't work right when I try to read the rank to see if someone is possessing it or not.

I've tried if(!Leader) to read it, but it hasn't been working. Is there another way to do it? I have standard saving and loading systems. The files are saved occasionally in-game, and loaded whenever the world boots up. (I only put the relevant pieces of code as a demonstration btw)

//code attempt to check it
if(!Leader)
Leader=M.key

//saving code
var/savefile/S=new("RANK")
S["Leader"]<<Leader

//loading code
if(fexists("RANK"))
var/savefile/S=new("RANK")
S["Leader"]>>Leader
//Saving
var/savefile/S = new/savefile("Saves/[ckey]")
S["Leader"] << Leader

//Loading
if(fexists("Saves/[ckey]")
src << "Save found!"
var/savefile/S = new/savefile("Saves/[ckey]")
S["Leader"] >> Leader
else
src << "No save found."

Running out the door so I didn't double check my syntax, but you can try this.
I should be more specific, the Leader checking is separate, those 2 saving and loading codes are just for the RANK save file. I'm trying to make a third separate code I can use wherever to check if the rank is taken. "Leader" is one of many rank variables saved to the RANK save file
Or another use for it could be like, checking if an object's been taken from an area so it doesn't reappear like a sword or something after a reboot. Basically a player or object related save file, how would I check that when the world runs?
Essentially I want to make it so I can read a savefile for the Leader ranking, and then affect the game with that.

Login to reply.