ID:143686
 
It was fixed!!
usr is not valid in anything beyond the simplest Login(), and it is definitely not valid in Logout(). You should be using src in both.

Lummox JR
In response to Lummox JR
changing 'usr' to 'src' didn't affect anything at all!
usr.icon_state = "male"

did the same thing as
src.icon_state = "male"


and same with female!
Your biggest problem is probably the fact that your New, Load and Delete options aren't part of a switch statement like they should be. However, I couldn't help myself so I recoded the whole thing for you anyway. Now I can sleep in peace.

mob/Login()
world << "[src] has logged in!"

// Check to see if they're a GM and add appropriate verbs.
if(src.ckey in GM)
src.verbs += typesof(/mob/GM/verb)

// If "Load" loads the saved game and "New" overrides the old
// saved game, what do you need "Delete" for?
switch(alert("Choose an option:", world.name, "New", "Load"))
if("New")

switch(alert("What is your gender to be?", world.name, "Male", "Female"))
if("Male")
src.icon_state = "male"
src.gender = MALE
if("Female")
src.icon_state = "female"
src.gender = FEMALE

// To locate the player at "start", use DM's map editor and modify one of
// the turfs to have the 'tag' variable = "start", and they'll start on
// that turf. Or better yet, modify an /area to have the "start" tag, then
// they'll spawn wherever there's room in that area.
src.icon = 'Player Icon.dmi'
src.loc = locate("start")


if("Load")
var/savefile/S = new("players/[src.ckey].sav")
src.Read(S)

// As Deadron once put it, saving the
// mob's 'loc' var is "just a bad a idea."
// You'll figure out why eventually.
var/loadx
var/loady
var/loadz
S["x"] >> loadx
S["y"] >> loady
S["z"] >> loadz
src.loc = locate(loadx, loady, loadz)


mob/Logout()
// delete the old save to avoid weird interactions
fdel("players/[src.ckey].sav")

var/savefile/S = new("players/[src.ckey].sav")
Write(S)
S["x"] << src.x
S["y"] << src.y
S["z"] << src.z
del(src)
In response to Foomer
Thank you SO much Foomer!

It worked exactly how I needed it after I changed one or 2 things! As soon as I make the HUB page, I will give you credit for this!
In response to JaxxMarron
Make someone else log in and see what happens.

usr != user

src == source

If you are wondering what exactly usr is, check out the DM Reference and you'll read exactly why usr should be avoided if possible
In response to GhostAnime
I disagree that usr should be avoided if possible, as there are examples where you have to use usr, like Click().

It's more that usr shouldn't be misused.


-TKL
In response to Kangchao
Kangchao wrote:
I disagree that usr should be avoided if possible, as there are examples where you have to use usr, like Click().

Thus, it should be avoided if possible. Its not possible in Click(), or on obj/verb/Bleh(). Actually though its possible to replace Click() with your own clicking procs that do use src, but its kind of a hassle. :) Still impossible for non-mob verbs, though.


It's more that usr shouldn't be misused.

Exactly, but most new users don't know how to not misuse it. Its best left unused until they know how to use it properly given how easy it is to screw things up with it.
In response to Foomer
Exactly, but most new users don't know how to not misuse it. Its best left unused until they know how to use it properly given how easy it is to screw things up with it.

Maybe we ought to get Lummox's usr unfriendly article into a more noticable section of the BYOND website :)

That said, I personally thought the documentation made perfect sense, and a lot of this might come down to, sadly, people not reading the documentation ;(.


-TKL
In response to Kangchao
Kangchao wrote:
Maybe we ought to get Lummox's usr unfriendly article into a more noticable section of the BYOND website :)

That said, I personally thought the documentation made perfect sense, and a lot of this might come down to, sadly, people not reading the documentation ;(.


I think you just countered your own suggestion there. :P
In response to Foomer
Programming in Java tends to make your head spin. :)


-TKL
you shouldnt edit your topic post because other people might have the same problem