mob
Login()
usr << "null"
var/sound/S = sound('Game.wav')
usr << S
Beginning
switch(alert("Login","","New Character","Load Character","Delete Character"))
if("New Character")
switch(alert("Which Slot do you wish to Select?","","Slot 1","Slot 2","Slot 3"))
if("Slot 1")
if(fexists("Slot1/[usr.key].sav"))
switch(alert("Warning a save file has been found would you like to overwrite this slot?","","Yes","No"))
if("Yes")
fdel("Slot1/[usr.key].sav")
usr.logged = 1
usr.cansave = 1
usr.usingslot = "1"
name = input("Please enter your name:", "Your name") as text
src.Name=src.name
src.ID = rand(10000,99999)
switch(input("Please Select Your Gender:","Gender?") in list("Male","Female"))
if("Male")
icon='Malebase.dmi'
if("Female")
icon='Femalebase.dmi'
// switch(input("Please Select Your Skin Tone:","Skin Tone?") in list("Lightest","Light","Medium","Dark","Darkest"))
// if("Light")
if(key=="Komuroto")
src.verbs += typesof (/mob/DM/verb)
src.loc=locate(203,203,1)
else
usr<<"Slot 1 Creation Complete"
world << "[name] has appeared in the world for their first time!"
src.loc=locate(203,203,1)
client.eye=usr
return
if("No")
goto Beginning
else
usr.logged = 1
usr.cansave = 1
usr.usingslot = "1"
name = input("Please enter your name:", "Your name") as text
src.Name=src.name
src.ID = rand(10000,99999)
switch(input("Please Select Your Gender:","Gender?") in list("Male","Female"))
if("Male")
icon='Malebase.dmi'
if("Female")
icon='Femalebase.dmi'
if(key=="Komuroto")
src.verbs += typesof (/mob/DM/verb)
src.loc=locate(205,205,1)
view() << "[src] has appeared!"
usr<<"Slot 1 Creation Complete"
else
src.loc=locate(203,203,1)
world << "[src] has logged in!"
usr<<"Slot 1 Creation Complete"
return
if("Slot 2")
if(fexists("Slot2/[usr.key].sav"))
switch(alert("Warning a save file has been found would you like to overwrite this slot?","","Yes","No"))
if("Yes")
fdel("Slot2/[usr.key].sav")
usr.logged = 1
usr.cansave = 1
usr.usingslot = "2"
name = input("Please enter your name:", "Your name") as text
src.Name=src.name
src.ID = rand(10000,99999)
usr<<"Slot 2 Creation Complete"
return
if("No")
goto Beginning
else
usr.logged = 1
usr.cansave = 1
usr.usingslot = "2"
usr<<"Slot 2 Creation Complete"
Some reason my game saves my information into slot2, instead of slot 1, when i start out in slot 1.
Now i looked at my save procs and such, and its all correct, so the problem is somewhere in here, but i dont know where and why.
1) 'usr' in Login() is unsafe, because there are situations in which 'usr' isn't the one initializing the proc Login() (forcing another mob upon the player is one example)
2) When during programming you find yourself repeating code, you're doing it wrong.
Proper usage of the above example will both shorten your code immensely, as well as probably fix the issue you are having.
(No point for us to dig through that whole bunch of code without documentation to find the specific problem you are experiencing)