ID:144876
 
Code:
obj
Start
icon = 'title.png'
layer = 200
density = 1
TITLE
name = ""
layer = 999
density = 1
//ok what you do is you place these objects over each other on the map, then
//select the areas that aren't going to be used and right click with any object selected
//and press Delete topmost object.
//for example, you put down /obj/TITLE first, then you put /obj/TITLE/NEW over it.
//after that is placed select everything around the words new (on your map)
//then right click and delete the topmost object.
//it's not that hard to understand.
//the title screen i made is not a good example seeing as how it was 5 am
//and it was made in MS paint and i have no coordination whatsoever.
NEW
layer = 999
Click()
if(usr.HasItUp == 0)//this is to prevent users from having multiple windows open
usr.HasItUp = 1
var/mob/character
crap:
var/charactername1 = input("What is your character's name?","Character Name?")as null|text
if(charactername1 == null || charactername1 == "" || charactername1 == " "|| charactername1 == " " || charactername1 == " ")
usr.HasItUp = 0
return
var/m = copytext(charactername1,1,2)//inefficient way of putting a name together
var/v = uppertext("[m]")
var/c = copytext(charactername1,2,11)
var/b = lowertext(c)
var/charactername = "[v][b]"
switch(input("Pick a class.","Character Class") in list("Person","Back"))
if ("Person")
character = new /mob()
character.name = charactername
usr.client.mob = character
character.loc=locate (1,1,1)
del(src)
if("Back")
goto crap
else
return
LOAD
layer = 999
Click()
if(usr.HasItUp == 0)
usr.HasItUp = 1
var/savefile/F = usr.client.base_PlayerSavefile()
F.cd = "/players/[usr.ckey]/mobs/"
var/list/characters = F.dir
var/b = 0
var/entry
var/autoname = ""
for (entry in characters)
b ++
for(entry in characters)
if(b == 1)
autoname = entry
if(b == 0)
usr << "You don't have any saved characters on this server."
if(b == 1)
usr.client.base_LoadMob(autoname)
else
var/name = input("What is the name of the character you want to load?","Character Load") in usr.client.base_CharacterNames() + list("Cancel")
if(name == "Cancel")
usr.HasItUp = 0
return
else
usr.client.base_LoadMob(name)
else
return
DELETE
layer = 999
Click()
var/savefile/F = usr.client.base_PlayerSavefile()
F.cd = "/players/[usr.ckey]/mobs/"
var/list/characters = F.dir
var/b = 0
for (var/entry in characters)
b ++
if(b == 0)
usr << "You don't have any saved characters on this server."
if(usr.HasItUp == 0)
usr.HasItUp = 1
var/name = input("What is the name of the character you want to delete?","Character Delete") in usr.client.base_CharacterNames() + list("Cancel")
if(name == "Cancel")
usr.HasItUp = 0
return
else
switch(alert("Are you absolutely sure you want to delete [name]?","Character Delete","No","Yes"))
if("Yes")
usr.HasItUp = 0
usr.client.base_DeleteMob(name)
if("No")
usr.HasItUp = 0
return
else
return


Problem description:
For some reason when I am at the title screen nothing happens when I click on new load or delete. I have those objs on top and cant figure out whats wrong. Please Help!

obj
Start
icon = 'title.png'
layer = MOB_LAYER + 1
density = 1
TITLE
name = ""
layer = MOB_LAYER + 2
density = 1
NEW
Click()
world << "debug: Clicked NEW"
if(usr)
if(istype(usr,/mob))
usr.new_game()
LOAD
Click()
world << "debug: Clicked LOAD"
if(usr)
if(istype(usr,/mob))
usr.load_game()


DELETE
Click()
world << "debug: Clicked DELETE"
if(usr)
if(istype(usr,/mob))
usr.delete_save()

mob
proc
new_game()
if(!HasItUp)
HasItUp = 1
var/mob/character
var/nameok = 0
var/charactername = ""
while(!nameok)
var/charactername1 = input("What is your character's name?","Character Name?") as null|text
nameok = check_name_input(charactername1)
if(length(charactername1) > 2)
charactername = "[copytext(charactername1,1,2)][copytext(charactername1,2,0)]
else
alert(src,"the name you entered was to short!","Character Name?","ok")
nameok = 0
var/selectclass = input("Pick a class.","Character Class") in list("Person","Restart")
HasItUp = 0
switch(selectclass)
if("Person")
character = new /mob()
character.name = charactername
var/mob/oldmob = src
spawn(10) del(oldmob)
client.mob = character
character.loc=locate (1,1,1)
else spawn(1) new_game()
load_game()
if(!HasItUp)
HasItUp = 1
var/savefile/F = usr.client.base_PlayerSavefile()
F.cd = "/players/[ckey]/mobs/"
var/list/characters = F.dir
var/b = 0
var/entry
var/autoname = ""
for (entry in characters)
b ++
for(entry in characters)
if(b == 1)
autoname = entry
if(b == 0)
alert(src,"You don't have any saved characters on this server.","No save files!","close")
HasItUp = 0
else if(b == 1)
if(b == 1) usr.client.base_LoadMob(autoname)

else
HasItUp = 0
var/name = input("What is the name of the character you want to load?","Character Load") in usr.client.base_CharacterNames() + list("Cancel")
if(name != "Cancel")
usr.client.base_LoadMob(name)
delete_save()
var/savefile/F = usr.client.base_PlayerSavefile()
F.cd = "/players/[usr.ckey]/mobs/"
var/list/characters = F.dir
var/b = 0
for (var/entry in characters)
b ++
if(b == 0)
usr << "You don't have any saved characters on this server."
if(!HasItUp)
HasItUp = 1
var/name = input("What is the name of the character you want to delete?","Character Delete") in usr.client.base_CharacterNames() + list("Cancel")
if(name == "Cancel")
HasItUp = 0
else
switch(alert("Are you absolutely sure you want to delete [name]?","Character Delete","No","Yes"))
if("Yes")
HasItUp = 0
client.base_DeleteMob(name)
if("No")
HasItUp = 0

check_name_input(var/Cname="")
switch(Cname)
if(null) return 0
if("") return 0
if(" ") return 0
if(" ") return 0
if(" ") return 0
else
var/okname = alert(src,"are you sure you want to be called [Cname]?","Character Name?","Yes","No")
if(okname == "Yes") return 1
else return 0

its basicly the same code just updated a bit,
basicly make a backup of your current code then replace
the code with the one I posted and tell me if
1: you get the clicked on debug messages.
2: it works (woot) or if it still does not work
3: any other errors.
if this does not work you will have to wait around for one
of the older members to pop in and see if they can work out
why its not working for you.
In response to Zmadpeter
I finaly tested this and it still doesnt work :( Can someone help?
In response to Bobomaster
Can you tell us what exactly doesnt work?
In response to Zmadpeter
Zmadpeter wrote:
> obj
> Start
> icon = 'title.png'
> layer = MOB_LAYER + 1
> density = 1
> TITLE
> name = ""
> layer = MOB_LAYER + 2
> density = 1
> NEW
> Click()
> world << "debug: Clicked NEW"
> if(usr)
> if(istype(usr,/mob))
> usr.new_game()
> LOAD
> Click()
> world << "debug: Clicked LOAD"
> if(usr)
> if(istype(usr,/mob))
> usr.load_game()
>
>
> DELETE
> Click()
> world << "debug: Clicked DELETE"
> if(usr)
> if(istype(usr,/mob))
> usr.delete_save()
>

I was just curious what the purpose of these two lines is:
                   if(usr)
if(istype(usr,/mob))

Who other than the usr would click the buttons?
In response to Bobomaster
turf/stsn//keep them seperate from other turfs 
op//the title screen
icon='os.bmp'//the icon
density=1

newbutton//new char button
icon='nb.bmp'//the icon
density=1
Click()
usr.newchar()//new char proc

loadbutton//load button
icon='lb.bmp'//the icon
density=1
Click()
usr.loadchar()//load proc

delbutton//delete button
icon='db.bmp'//the icon
density=1
Click()
usr.delchar()//delete proc

I would hope that if your making a title screen you can use everything I just typed. Placing them on top of everything on the map puts them on top when playing. Setting thier layer might of been what made it not work.
In response to XzDoG
Ok here is the entire saveing code,
#include <deadron/basecamp>

#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"
client
var/tmp/savefile/_base_player_savefile
proc/base_CharacterNames()
// Get the full names of all this player's characters.
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_PlayerSavefile()
if (!_base_player_savefile)
// Put in players/[first_initial]/[ckey].sav
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_LoadMob(char_name)
// Look for a character with the ckey version of this name.
// If found, load it, set the client mob to it, and return it.
// Otherwise return null.
var/mob/new_mob
var/char_ckey = ckey(char_name)
var/savefile/F = base_PlayerSavefile()
_base_player_savefile = null
proc/base_DeleteMob(char_name)
// Look for a character with the ckey version of this name.
// If found, delete it.
var/char_ckey = ckey(char_name)
var/savefile/F = base_PlayerSavefile()
F.cd = "/players/[ckey]/mobs/"
F.dir.Remove(char_ckey)
obj
Start1
icon = 'title.png'
density = 1
TITLE1
NEW1
name = ""
density = 1
Click()
world << "debug: Clicked NEW"
if(usr)
if(istype(usr,/mob))
usr.new_game()
LOAD1
name = ""
density = 1
Click()
world << "debug: Clicked LOAD"
if(usr)
if(istype(usr,/mob))
usr.load_game()
DELETE1
name = ""
density = 1
Click()
world << "debug: Clicked DELETE"
if(usr)
if(istype(usr,/mob))
usr.delete_save()
mob
proc
new_game()
if(!HasItUp)
HasItUp = 1
var/mob/character
var/nameok = 0
var/charactername = ""
while(!nameok)
var/charactername1 = input("What is your character's name?","Character Name?") as null|text
nameok = check_name_input(charactername1)
if(length(charactername1) > 2)
charactername = "[copytext(charactername1,1,2)][copytext(charactername1,2,0)]"
else
alert(src,"The name you entered was to short!","Character Name?","ok")
nameok = 0
var/selectclass = input("Pick a class.","Character Class") in list("Person","Restart")
HasItUp = 0
switch(selectclass)
if("Person")
character = new /mob()
character.name = charactername
var/mob/oldmob = src
spawn(10) del(oldmob)
client.mob = character
character.loc=locate (1,1,1)
else spawn(1) new_game()
load_game()
if(!HasItUp)
HasItUp = 1
var/savefile/F = usr.client.base_PlayerSavefile()
F.cd = "/players/[ckey]/mobs/"
var/list/characters = F.dir
var/b = 0
var/entry
var/autoname = ""
for (entry in characters)
b ++
for(entry in characters)
if(b == 1)
autoname = entry
if(b == 0)
alert(src,"You don't have any saved characters on this server.","No save files!","close")
HasItUp = 0
else if(b == 1)
if(b == 1) usr.client.base_LoadMob(autoname)
else
HasItUp = 0
var/name = input("What is the name of the character you want to load?","Character Load") in usr.client.base_CharacterNames() + list("Cancel")
if(name != "Cancel")
usr.client.base_LoadMob(name)
delete_save()
var/savefile/F = usr.client.base_PlayerSavefile()
F.cd = "/players/[usr.ckey]/mobs/"
var/list/characters = F.dir
var/b = 0
for (var/entry in characters)
b ++
if(b == 0)
usr << "You don't have any saved characters on this server."
if(!HasItUp)
HasItUp = 1
var/name = input("What is the name of the character you want to delete?","Character Delete") in usr.client.base_CharacterNames() + list("Cancel")
if(name == "Cancel")
HasItUp = 0
else
switch(alert("Are you absolutely sure you want to delete [name]?","Character Delete","No","Yes"))
if("Yes")
HasItUp = 0
client.base_DeleteMob(name)
if("No")
HasItUp = 0
check_name_input(var/Cname="")
switch(Cname)
if(null) return 0
if("") return 0
if(" ") return 0
if(" ") return 0
if(" ") return 0
else
var/okname = alert(src,"are you sure you want to be called [Cname]?","Character Name?","Yes","No")
if(okname == "Yes") return 1
else return 0

I am still not shure why this doesent work! I put the NEW LOAD DELETE layers on top of the other yet nothing happens when i click on them.
In response to XzDoG
What doesnt work is that when i click on the words i have placed new, load, or delete on nothing happens! Someone please help!
In response to Bobomaster
did you happen to put the NEW1,LOAD1, and DELETE1 on the map?
In response to Axerob
Yea.... (not that stupid!)
still no clue why it doesnt work.
In response to Bobomaster
Maybe there is somthing wrong with your procs(you did define the procs right?)If your using the code I gave you.