ID:162471
 
How do I fix this so people cant load when they have no character, and/ or how can i make it so you can save more then 1 file.And is this a good save system if not someone please tell me.



client
proc
Save_Game() // the save proc
if(usr.client) // if your character is slot 1
usr<<"Character Saved!"// tells you that you saved
var/savefile/F = new() // creates the save file
var/itemlist[]=new
var/equipped[]=new
var/skillz[]=new
var/skillpz[]=new
for(var/obj/items/o in usr.contents)//this saves the contents as a list of types, if you want to save items
//that are dynamic then you need to instead of this for statement use F["contents"]<<x.contents and in LoadMob
//replace the While code that loads this list with F["contents"]>>x.contents This is really inefficient however
if(o.deletable==0) //in essence, if these items Save
itemlist+=o.type
equipped+=o.equipped
for(var/obj/gui/skillcards/o in usr.contents)
if(!skillz.Find(o.type))
skillz+=o.type
for(var/obj/gui/skillcards/o in usr.client.screen)
if(!skillpz.Find(o.type))
skillpz+=o.type
F["skillz"]<<skillz
F["skillpz"]<<skillpz
F["itemlist"]<<itemlist
F["equipped"]<<equipped
F["contents"]<<usr.contents
usr.V = usr.verbs
usr.Write(F)
usr.client.Export(F)
client
proc
Load_Game()
var/savefile/client_file = new(Import())
if(client_file&&usr.clicked)
switch(alert("Do you wish to load your character?","Character","Yes","No")) // asks what you want to do
if("Yes")
if(usr.clicked)
usr.clicked=0
usr.clicked=0
usr.clicked=0
var/list/itemlist
var/list/equipped
var/list/skillz
var/list/skillpz
var/list/verbs1
client_file["itemlist"]>>itemlist
client_file["equipped"]>>equipped
client_file["skillz"]>>skillz
client_file["skillpz"]>>skillpz
client_file["verbs1"]>>verbs1
client_file["contents"]>>usr.contents
for(var/stuff in usr.V)
usr.verbs += stuff
usr.OOC = 1
usr.Frozen = 0
usr.Frozen = 0
usr.Frozen = 0
usr.clicked=0
usr.logincrap()
world << "<font size=1><font face=verdana><b><font color=white>[src] has logged into AvatarMOB" // tells world you logged in
usr.Read(client_file)
usr.cansave=1
sleep(300)
usr.Auto_Client_Save() // starts the auto save loop

return ..()
else
usr<<"You are already loading a save file!"
sleep(300)
usr.Auto_Client_Save()
return
if("No")
return
else
usr<<"You are already loading a save file!"
return


client
proc
Delete_Game() // the save proc
if(usr.client)
switch(alert("Are you sure you wish to delete your character?","Character","Yes","No")) // asks what you want to do
if("Yes")
usr<<"Entering Byond Key!"
sleep(1)
usr<<"Searching for AvatarMob byond file"
sleep(1)
usr<<"Found!"
sleep(1)
usr<<"Deleteing File..."
sleep(1)
usr<<"File has been erased from the database" // if your character is slot 1
usr.client.Export()
switch(alert("Do you wish to create a new character?","Character","Yes","No")) // asks what you want to do
if("Yes")
world << "<font size=1><font face=verdana><b><font color=white>[src] has logged into AvatarMOB for the first time!!"
usr.loc=locate(6,145,10) // tells world you logged in
usr.Auto_Client_Save() // starts the auto save loop
if("No")
return
I kno its a bad save system but it but i need help stoping people from loading files that arent there but what i really need is a new save system so if someone can tell me which one is the best(clientsave,hostsave,websitesave...ect)
var/client_file = Import() //variable to load savefile
if(client_file) //if its there
//Do stuff here



In response to Shinjiro Aragaki
Shinjiro Aragaki wrote:
> var/client_file = Import() //variable to load savefile
> if(client_file) //if its there
> //Do stuff here
>



What is that sopost to change?
In response to EmmanuelV
client
proc
Load_Game()
switch(alert("Do you wish to load your character?","Character","Yes","No")) // asks what you want to do
if("Yes")
var/client_file = Import() //import savefile in a variable
if(client_file) // if it exists
var/savefile/F = new(client_file) //Open it
//LOAD STUFF HERE
if("No")
return
In response to Shinjiro Aragaki
Shinjiro Aragaki wrote:
> client
> proc
> Load_Game()
> switch(alert("Do you wish to load your character?","Character","Yes","No")) // asks what you want to do
> if("Yes")
> var/client_file = Import() //import savefile in a variable
> if(client_file) // if it exists
> var/savefile/F = new(client_file) //Open it
> //LOAD STUFF HERE
> if("No")
> return
>




Hmmmm when I tried it it didnt load the file and when i use it will i need to change my save?
In response to EmmanuelV
try a src.Read(F)?
In response to EmmanuelV
Hmmm it does the same this it teleports them to loc 0,0,0
In response to Shinjiro Aragaki
Shinjiro Aragaki wrote:
try a src.Read(F)?

this comes out as an undifined proc