turf/Creation/Delete
weatherProof=1
density =1
mouse_opacity=2
layer=99
Click()
usr.Delete()
mob/verb/Delete()
set hidden=1
if(usr.login)return
if(fexists("players/[usr.key].sav"))
switch(alert(usr, "Delete character? *YOUR CHARACTER WILL BE GONE!*", "Character Deletion", "Yes","No"))
if("Yes")
var/savefile/F = new("players/[usr.key].sav")
Read(F)
names.Remove(usr.name)
fdel("players/[usr.key].sav")
usr<<"<font color=red>Savefile deleted, Please reconnect.</font>"
usr.login=0
del(usr)
Problem description:
runtime error: Cannot execute null.Remove().
verb name: Delete (/mob/verb/Delete)
source file: Creation.dm,516
usr: Hazama (/mob)
src: Hazama (/mob)
call stack:
Hazama (/mob): Delete()
Naruto Ninja Chronicles (27,41,2) (/turf/Creation/Delete): Click(Naruto Ninja Chronicles (27,41,2) (/turf/Creation/Delete), "default.map1", "icon-x=13;icon-y=5;left=1;scre...")
basically it loads my player save instead of deleting it.
If you need to grab a specific bit of data from a savefile you'll need to either load it into a dummy mob (which will cause the player to load if you're saving mob.key), or navigate the savefile manually using savefile.dir, and savefile.cd then pulling the data out that way. You can also do something like
F["path/to/my/data/my_variable_here"] >> variable
If you already know the location of the data in the file -- you can view the contents of a savefile using savefile.ExportText() if you're unsure of the data structure.
ALSO, you shouldn't be saving using the 'key' variable for the file name, you should always use 'ckey', as special characters and spaces will break the process.
The runtime error you're getting, however, probably has nothing to do with the issues above, I'm assuming the 'names' list is a global list of names that have been used so people can't share the same name. The runtime error indicates you're never initializing that variable.
A note about the above, though, initializing a variable outside of a proc will cause DM to generate a no-named init() proc for that variable and can cause issues later on while trying to profile you code. Initializing your global variables inside of world/New() or some similar proc that gets called when your world starts is the ideal method of doing it.