ID:149190
 
<dm>I've got a problem here that I can't seem to track.

mob/Login calls getname(src) (tried usr too)

a ways down the proc, I have:

var/loginname = input(M, "What will you name this character?", "Login", null)

and
        var/savefile/F = new ("Players/[ckey(loginname)]")

Further down I have:
        M << "debug: You're loginname is [loginname]"
F["Name"] << loginname
F["Password"] << newpassword
M.lastroom = 300
F["LastRoom"] << M.lastroom
M << "debug: You're loginname is [loginname]"
M.name = loginname
LoadMob(M, loginname)
return

And then in loadmob I have.
mob/proc/LoadMob(mob/M as mob, loginname as text)
if(!fexists("Players/[ckey(loginname)]"))
M << "Error: Savefile doesn't exsist."
del(M)
return
var/savefile/F = new ("Players/[ckey(loginname)]")
F["Name"] >> M.name


I've been examining this for over a week now and can't seem to figure out how come it's not working properly. it shows the correct name in the debug messages of the saving part. It's completely halted progress on my game, and put me in a fairly grumpy mood. Does anyone see why M.name is null after all this?
Okay, I added some informational messages to every single step (just about anyway) of my procs, and caught the exact moment that M.name is becoming null... But I don't understand why.

Later on I put a check for some other random variable to see if that would work, and it worked fine.
    M << "Debug: (Loadmob 2) M is [M], loginname is [loginname]. M.name is [M.name]"

F["Name"] >> M.name
M << "Debug: (Loadmob 3) M is [M], loginname is [loginname]. M.name is [M.name]"
F["Surname"] >> M.surname
F["Race"] >> M.race
F["Gender"] >> M.chargender
F["Class"] >> M.class
M << "Debug: (Loadmob 4) M.class is [M.class]."


Class is saved like this:

F["Class"] << "Testing Person"

And the fourth debug message on my loadmob proc shows. "M.class is Testing Person." But the third message remaisn "M is , loginname is blah, M.name is "
The second message (directly above it) shows "M is Zagreus, loginname is Zagreus, M.name is Zagreus"

Now, names were saved like this:
F["Name"] << loginname
I have debug messages showing directly before that line, that loginname does indeed exsist, and is text. But I figured that maybe if I made it look even more like a text string it'd work, like the Class thing did, so I did:
F["Name"] << "[loginname]"
Unfortunately, neither worked.
On the loading proc I even tried creating a var/tmpname and then putting F["Name"] >> tmpname, that didn't help either.

Does anyone know what's going on here?
In response to Zagreus
hey, i'm an idiot, so i can't help you. But i was wondering if you are the guy who made silver cresent (or, almost made it)
In response to Nebathemonk
Uhm i think i know the problem, dont use the >> it doesn't always work the way u want it too, instaead use:
M.name=(savefile["dir"]).
In response to Nebathemonk
Nebathemonk wrote:
hey, i'm an idiot, so i can't help you. But i was wondering if you are the guy who made silver cresent (or, almost made it)

Yup, but I stink at icons too much to make a graphical game of the size that I wanted, so I'm doing text now. :)
In response to Ziratha
Ziratha wrote:
Uhm i think i know the problem, dont use the >> it doesn't always work the way u want it too, instaead use:
M.name=(savefile["dir"]).

I tried both M.name = (F["Name"]) and M.name = F["Name"], both had the same result as F["Name"] >> M.name. Thanks though, that was a pretty good idea.

Also tried saving it using =, no luck.
In response to Zagreus
ok, try this first put usr<<F["Name"] in front of it being isigned see what that does. I bet that its not gonna show anything. Now try this usr<<"[F["Name"]]" if this works u just have to put M.name="[F["Name"]]" if that dosn't work i dont know...
In response to Ziratha
Thank you so much... It worked. M << F["Name"] did the trick... I have no clue why that worked and nothing else did though, do you? Byond bug or something?