ID:845641
 
(See the best response by Boubi.)
Code:


Problem description:

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?
show us the code
The loading system or the Turf code?
Both, if they're both relevant to your problem.
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
Best response
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.
That didn't help
In response to XXXxJokerxXXX (#6)
XXXxJokerxXXX wrote:
That didn't help

You haven't read my edited post above yours, reread it.
It still doesn't work, it has no effect
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
You are a life saver boubi. I redid it in some places, but the base worked :) Thank you!
when i used this code it showed undifined var... can someone hellp me?
It's not even a complete code. @MonkeyMomo
i know but i dont know how to make it complete lol