mob/player/proc
CreateNewCharacter()
var/char_name = prompt("New character", null, "What is the character's name?") as text
SaveCharacter(char_name)
return char_name
SaveCharacter(char_name)
var/savefile/F = new("players.sav")
// Get the ckey() version of the name to avoid illegal characters for a directory name.
var/safe_name = ckey(char_name)
// Move to the directory for this character, which is:
// /player_ckey/character_ckey
F.cd = "/[ckey]/[safe_name]"
// Storing the actual name as a value (not a directory), so we don't have to worry about what characters it has.
F["full_name"] << char_name
mob/player/Login()
var/savefile/F = new("players.sav")
// What characters does this player have?
F.cd = "/[ckey]"
var/list/characters = F.dir
// Put together the menu options.
var/newCharacterChoice = "<Create new character>"
var/list/menu = new()
menu += characters
menu += newCharacterChoice
// Find out which character they want to play.
var/result = prompt("Who do you want to be today?", null, "Choose a character or create a new one") in menu
if (result == newCharacterChoice)
name = CreateNewCharacter()
else
// We need to get the full name for this character,
// which is stored in the safefile at '/player_ckey/character_ckey/full_name'.
F.cd = "/[ckey]/[result]"
F["full_name"] >> name
return ..()
mob/player/DeleteCharacter()
// You might want to add a cancel option in here somewhere, and a deletion confirmation...
var/savefile/F = new("players.sav")
// What characters does this player have?
F.cd = "/[ckey]"
var/list/characters = F.dir
// Put together the menu options.
var/list/menu = new()
menu += characters
// Find out which character they want to delete.
var/result = prompt("DELETING a character", null, "Which character do you want to delete?") in menu
if (result)
F.cd = "/[ckey]"
F.dir.Remove(result)
client/proc/SaveMob()
var/savefile/F = new("players.sav")
var/char_ckey = ckey(mob.name)
F["[ckey]/[char_ckey]"] << mob
client/proc/LoadMob(char_ckey)
var/savefile/F = new("players.sav")
F["[ckey]/[char_ckey]"] >> mob
mob
var/tmp/player/MyPlayer // This is not auto-saved, because it is declared as tmp.
Write(savefile/F)
// Let auto-save do its thing first.
..()
// Now save the player object where it belongs.
F["/players/[ckey]"] << MyPlayer
return
Read(savefile/F)
// Let auto-save stuff read in the rest of the mob first.
..()
// Now get the player object.
F["/players/[ckey]"] >> MyPlayer
return
Problem description:
Okay...
There are 27 errors... I don't know what to do...
and yes... I did get this from the basic save file in tutorials....
some one... Please help me...
If not, what are they and what lines are they on?