ID:178665
 
I'm trying to write a code where a player can choose the name of his or her character every time he or she joins my game. If the character has been saved in my game, then the charater will load; otherwise, the code will proceed as if the character is new.

This is the code I'm using to save characters:

proc/save()
var/savefile/F
F = new("players/[src.ckey]/[src.name].sav")
F["mob"] << src

Here's the part that's not working:

var/charname = "X" //actually an input statement, this is an example
if(charname in "players/[src.key]") //valid directory
var/savefile/F
F = new("players/[src.ckey]/[charname].sav")
F["mob"] >> src
return
[the code for new characters]

The if() statement is always false, even when the character, "X", is saved (I've looked in the appropriate directories to confirm this). How can I fix the if() statement to check if "X" is saved in the folder "players/[src.ckey]"?</<>
Is there a way to make a list of the files located in a certain directory?