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
Problem description:
it says change prompt to input and i cant do that because then it wont prompt me.
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 ..()
<dm>
same here
Next to make sure your not abusing usr, add src after input( and before "","")
Next remove the null, thats unneeded.