Ok I've made Loading/saving system for my game, but when I try to press New/Load/Delete nothing happes, I've coded he overlays and mapped them, what do I do?
turf/newchar density = 1 layer = 999 Click() usr.newchar()
turf/load density = 1 layer = 999 Click() usr.load() turf/delete density = 1 layer=999 Click() usr.delete()
mob proc newchar() if(fexists("players/[src.key]")) switch(alert(usr, "Are you sure that you want to overwrite your old Character?", "Character Creation", "Yes","No")) if("Yes") sleep(0) fdel("players/[usr.key].sav") if("No") return mob proc load() if(!src) return if(src.joe) return if(fexists("players/[usr.key]")) var/savefile/load load = new ("players/[usr.key]") load["mob"] >> usr load["x"] >> usr.x load["y"] >> usr.y load["z"] >> usr.z
mob proc delete() if(fexists("players/[src.key].sav")) var/sure=alert(src,"Are you sure you want to delete your character? It will be gone forever.","Confirmation","Yes","No") if(sure=="Yes") sleep(0) fdel("players/[src.key].sav") src << "<b>Your character has been deleted." else return
Try adding mouse_opacity = 2 to each of your turfs that initiate something, also do not use usr in your procs. By the way, your newchar() proc won't do anything other than check if you have character created, you haven't told it to do anything else.
turf // i'd advise having them under a parent // it makes it easier to locate/change them load_options layer = 5 mouse_opacity = 2
create Click() usr.createcharacter()
load Click() usr.loadcharacter()
delete Click() usr.deletecharacter()
mob/proc newcharacter() // do not use usr in your procs, just don't if(fexists("players/[key].sav")) switch(alert(src, "Are you..", "..", "Yes", "No")) if("No") return
// the above switch() only checks if you said no, otherwise call deletecharacter() deletecharacter() else // if a savefile wasn't found you would initiate the character // creation system, i don't know anything about it so i'll leave it
loadcharacter() if(!fexists("players/[key].sav")) src << "You don't have.." else // load their character, i'd advise taking a look at the link i have // provided in the post to setup your saving/loading system
deletecharacter() if(!fexists("players/[key].sav")) src << "You don't have.." else // you should be using an alert/input here, not creating a redundant variable switch(alert(src, "Do you want to..", "..", "Yes", "No")) if("No") return
// the above switch() only checks if you said no, otherwise delete fdel("players/[key].sav") src << "You have.."
The above code is just an insight on what you should be doing, or aiming for. Take a look here: 139318