ID:788314
 
Keywords: login, problems
Code:
    base_autoload_character = 1
base_autosave_character = 1

(changed below(current))
base_autoload_character = 0
base_autosave_character = 0


Problem description:

i asked if there was an auto save/load code and this guy gave me this I looked in the help file to see if there was any use for it and I got nothing perhaps i missed it...
I was wondering there ws a way to use this when i put it in i got nothing different and it auto deletes i had changed the "1" to a "0" but still no luck >.<

my question: can it be used to auto save/load as is or would i have to change it? if changing it has to happen could you steer me to the right example ect.


thanks for the help.
This code by itself doesn't do anything except set some variables. Can you show us the other code you're using to save characters?
Assuming you're dealing with multiple saves per player, you could make a 'options' savefile that'd effect the client. Then you could check for the autoload variable out of the save to load the selected character.
    var/savefile/f=new("[src.key]/Options.sav")
var/AL
f["AL"]>>AL
if(fexists("[src.key]/Character[AL].sav"))
var/savefile/s=new("[src.key]/Character[AL].sav")
s["Mob"]>>src.mob
else
src.Select_Character()


Is an example of how to implament something like that.

[EDIT]
This of course would have to be IN a client proc and have to be used around loggin.
[END EDIT]
I don't have any others i just started my saving codes and asked around and was given that, he said its from a pokemon source he got so he went through it to get the code and sent me the character handling and implmentation the codes are:
character handling
client/base_num_characters_allowed = 1
client/base_autoload_character = 1
client/base_autosave_character = 1
client/base_autodelete_mob = 1

client/base_save_verbs = 1


client/base_ChooseCharacter()
mob/BaseCamp/ChoosingCharacter
ChooseCharacterMenu(list/menu)
return ..()

DeleteCharacterMenu(list/menu)
return ..()

client/base_SaveMob()
return ..()



mob/BaseCamp/FirstTimePlayer
FirstTimePlayer()

return 1
mob/base_save_allowed = 1

mob/base_save_location = 1


mob/base_InitFromSavefile()
return

then the implementation:
#define BASE_MENU_CREATE_CHARACTER  "Create New Character"
#define BASE_MENU_DELETE_CHARACTER "Delete Character"
#define BASE_MENU_CANCEL "Cancel"
#define BASE_MENU_QUIT "Quit"


// Implementation
client/var/tmp
base_num_characters_allowed = 1
base_autoload_character = 1
base_autosave_character = 1
base_autodelete_mob = 1
base_save_verbs = 1

mob
var/tmp
base_save_allowed = 1
base_save_location = 1
var/list/base_saved_verbs

proc/base_InitFromSavefile()
return

Write(savefile/F)
..()

if (base_save_location && world.maxx)
F["last_x"] << x
F["last_y"] << y
F["last_z"] << z
return

Read(savefile/F)
..()

if (base_save_location && world.maxx)
var/last_x
var/last_y
var/last_z
F["last_x"] >> last_x
F["last_y"] >> last_y
F["last_z"] >> last_z
var/destination = locate(last_x, last_y, last_z)

if (!Move(destination))
loc = destination
return

mob/BaseCamp
base_save_allowed = 0
Login()
RemoveVerbs()
return

Stat()
return

Logout()
return

proc/RemoveVerbs()
for (var/my_verb in verbs)
verbs -= my_verb

mob/BaseCamp/FirstTimePlayer
proc/FirstTimePlayer()
return 1


mob/BaseCamp/ChoosingCharacter
Login()
spawn()
ChooseCharacter()
return ..()

proc/ChooseCharacter()
var/list/available_char_names = client.base_CharacterNames()
var/list/menu = new()
menu += available_char_names

if (length(available_char_names) < client.base_num_characters_allowed)
if (client.base_num_characters_allowed == 1)
client.base_NewMob()
del(src)
return
else
menu += BASE_MENU_CREATE_CHARACTER

if (length(available_char_names))
menu += BASE_MENU_DELETE_CHARACTER

menu += BASE_MENU_QUIT

ChooseCharacterMenu(menu)

proc/ChooseCharacterMenu(list/menu)
var/default = null
var/result = input(src, "Who do you want to be this fine day?", "Welcome to [world.name]!", default) in menu
ChooseCharacterResult(result)

proc/ChooseCharacterResult(menu_choice)
switch(menu_choice)
if (0, BASE_MENU_QUIT)
del(src)
return

if (BASE_MENU_CREATE_CHARACTER)
client.base_NewMob()
del(src)
return

if (BASE_MENU_DELETE_CHARACTER)
DeleteCharacter()
return

var/mob/Mob = client.base_LoadMob(menu_choice)
if (Mob)
del(src)
else
ChooseCharacter()

proc/DeleteCharacter()
var/list/available_char_names = client.base_CharacterNames()
var/list/menu = new()
menu += available_char_names

menu += BASE_MENU_CANCEL
menu += BASE_MENU_QUIT

DeleteCharacterMenu(menu)

proc/DeleteCharacterMenu(list/menu)
var/default = null
var/result = input(src, "Which character do you want to delete?", "Deleting character", default) in menu
if (result)
DeleteCharacterResult(result)

proc/DeleteCharacterResult(menu_choice)
switch(menu_choice)
if (0, BASE_MENU_QUIT)
del(src)
return

if (BASE_MENU_CANCEL)
ChooseCharacter()
return

client.base_DeleteMob(menu_choice)
ChooseCharacter()
return


client
var/tmp/savefile/_base_player_savefile

New()
if (base_autoload_character)
base_ChooseCharacter()
return
return ..()


Del()
if (base_autosave_character)
base_SaveMob()

if (base_autodelete_mob)
del(mob)
return ..()


proc/base_PlayerSavefile()
if (!_base_player_savefile)
var/start = 1
var/end = 2
var/first_initial = copytext(ckey, start, end)
var/filename = "players/[first_initial]/[ckey].sav"
_base_player_savefile = new(filename)
return _base_player_savefile


proc/base_FirstTimePlayer()
var/mob/BaseCamp/FirstTimePlayer/first_mob = new()
first_mob.name = key
first_mob.gender = gender
mob = first_mob
return first_mob.FirstTimePlayer()


proc/base_ChooseCharacter()
base_SaveMob()

var/mob/BaseCamp/ChoosingCharacter/chooser

var/list/names = base_CharacterNames()
if (!length(names))
var/result = base_FirstTimePlayer()
if (!result)
del(src)
return

chooser = new()
mob = chooser
return

if (base_num_characters_allowed == 1)
base_LoadMob(names[1])
return

chooser = new()
mob = chooser
return


proc/base_CharacterNames()
var/list/names = new()
var/savefile/F = base_PlayerSavefile()

F.cd = "/players/[ckey]/mobs/"
var/list/characters = F.dir
var/char_name
for (var/entry in characters)
F["[entry]/name"] >> char_name
names += char_name
return names


proc/base_NewMob()
base_SaveMob()
var/mob/new_mob
new_mob = new world.mob()
new_mob.name = key
new_mob.gender = gender
mob = new_mob

_base_player_savefile = null
return new_mob


proc/base_SaveMob()
if (!mob || !mob.base_save_allowed)
return

if (base_save_verbs)
mob.base_saved_verbs = mob.verbs

var/savefile/F = base_PlayerSavefile()

var/mob_ckey = ckey(mob.name)

var/directory = "/players/[ckey]/mobs/[mob_ckey]"
F.cd = directory
F["name"] << mob.name
F["mob"] << mob
_base_player_savefile = null


proc/base_LoadMob(char_name)

var/mob/new_mob
var/char_ckey = ckey(char_name)
var/savefile/F = base_PlayerSavefile()
_base_player_savefile = null

F.cd = "/players/[ckey]/mobs/"
var/list/characters = F.dir
if (!characters.Find(char_ckey))
world.log << "[key]'s client.LoadCharacter() could not locate character [char_name]."
mob << "Unable to load [char_name]."
return null

F["[char_ckey]/mob"] >> new_mob
if (new_mob)
mob = new_mob
new_mob.base_InitFromSavefile()

if (base_save_verbs && new_mob.base_saved_verbs)
for (var/item in new_mob.base_saved_verbs)
new_mob.verbs += item
return new_mob
return null


proc/base_DeleteMob(char_name)

var/char_ckey = ckey(char_name)
var/savefile/F = base_PlayerSavefile()

F.cd = "/players/[ckey]/mobs/"
F.dir.Remove(char_ckey)

It's quite obvious I'm not that much of a good coder >.< but my goal is to have them create a character with out
that create a character pop-up thing like pokemon btr or ominous temple gates,and that login/pick your recent character screen because it wastes time. that's where the auto load/save would be useful to me. I've been trying to modify it above, extracting parts of it to see what ticks, i first started it last night with my previous issue went to bed and tried to figure it out but I've drawn a blank on how to go about this i may just have to take the time and make one the old fashion way trial and error.

saveing (in game)
    verb



Save()
src.client.base_SaveMob()
src << "\red You have been saved."

i anything can be done that would be great if not thanks for letting me know.
i feel like a noob now xD
















Going by what you said, I assume that this code is taken from another pokémon game and plugged straight into yours, and you don't actually understand the code you're using?

This is going to make it very difficult for you to fix any problems that come up.

When base_autoload is set to '1' ( in code, '1' can basically mean things like TRUE, ON or 'YES' and 0 means FALSE, OFF or NO. ) then it calls base_ChooseCharacter() which appears to be a mechanism for picking an existing character.
What confuses me is that happens under Client/New().
In response to Deathguard
Deathguard wrote:
Going by what you said, I assume that this code is taken from another pokémon game and plugged straight into yours, and you don't actually understand the code you're using?

That actually looks like Basecamp saving.
In response to Albro1
Albro1 wrote:
Deathguard wrote:
Going by what you said, I assume that this code is taken from another pokémon game and plugged straight into yours, and you don't actually understand the code you're using?

That actually looks like Basecamp saving.

yea
In that case, you're going to have problems no matter how much help we give, because you don't understand the logic behind what we suggest.

There's no point us giving you working code unless you understand why it works.