ID:1691748
 
runtime error: bad client
proc name: loadslot1 (/mob/verb/loadslot1)
source file: Login.dm,231
usr: Kboy33 (/mob)
src: Hyuuga, Rein (/mob)
call stack:
Hyuuga, Rein (/mob): loadslot1()


I keep on receiving this error whenever I load my character. I've been through my code multiple times to see what I messed up, however I can't solve this issue. I also read the two guides to run time errors provided on a previous thread, however I had no luck tackling this issue. The codes which I believe to be relevant are as follows:

Loadslot:
        loadslot1()
set hidden = 1
if(fexists("Clients/[src.key]/1.sav"))
switch(alert("Load slot number 1?","Loading","Yes","No"))
if("No") return
var/savefile/f = new("Clients/[src.key]/1.sav")//568
winset(src,"chatwindow","is-visible=true")
winset(src,"chatwindow","X=0")
winset(src,"chatwindow","Y=568")
winset(src,"loadchar","is-visible=false")
winset(src,"delchar","is-visible=false")
f["mob"] >> src
f["Name"] >> src.Name
f["name"] >> src.name
f["Clan"] >> src.Clan
f["village"] >> src.village
GetScreenResolution(src)
f["x"] >> x
f["y"] >> y
f["z"] >> z
f["Jutsus"] >> src.Jutsus
f["JutsuIcons"] >> src.JutsuIcons
winset(src,"login","is-visible=false")
src<<"Loaded you, [name]."
src<<"<font size=2><font color=red><b>Don't forget to visit/fan our <a href=http://www.byond.com/games/Kboy33/JutsuInfinity>HUB</a></b>!"
world<<"<font color=yellow>[src.name] logged in."
src.Name(src.Name)
src.UpdateBars()
src.loc=locate(x,y,z)
ingame=1
if(src.rank=="Kage")
src.verbs+=typesof(/mob/Kage/verb)


Save and Load:
mob
proc
Save()
var/savefile/F = new ("Clients/[src.key]/[src.saveslot].sav")
src.Write(F) // writes your variables/lists onto it
F["mob"] << src
F["Name"] << src.Name
F["name"] << src.name
F["Jutsus"] << src.Jutsus
F["JutsuIcons"] << src.JutsuIcons
F["Clan"] << src.Clan
F["village"] << src.village
F["x"] << x
F["y"] << y
F["z"] << z
src<<"Saved!"
Load()
if(fexists("Clients/[src.key]/3.sav"))//if an existing save file exists in the folder located in the game folder
var/savefile/F=new("Clients/[src.key]/[src.saveslot].sav") // it creates a new save file
src.Read(F) //it reads it
var/newX
var/newY
var/newZ
var/Jutsus
var/Jutsuicons
var/name
var/Clan
var/village
F["lastx"] >> newX//it takes the lastx variable in the save and puts it into the newx variable
F["lasty"] >> newY//same as above with a new variable
F["lastz"] >> newZ//same as above with a new variable
F["Jutsus"] >> Jutsus
F["JutsuIcons"] >> Jutsuicons
F["Name"] >> name
F["Clan"] >> Clan
F["village"] >> village
src.loc=locate(newX,newY,newZ)//makes the player located in those locations
ingame=1
src<<"Loaded!"


Line 231 is: winset(src,"login","is-visible=false")
The line
f["mob"] >> src

creates a new mob and assigns it to src before reading it. Try removing this line and see if that works; If you do, however, I'd remove
f["mob"] << src

as well.
In response to Pokemonred200
:/ still not working.
Maybe you call loadslot1() for simple mob, like npc?
@Edit: Ach sorry it's verb.;/
I believe Pokemon has the correct line, but the wrong understanding of the issue. Kboy, did the problem change by removing the line? I would assume so (mob not moving?).

Loading a mob to src using >> calls mob.Logout() and mob.Login() on the new mob.
The call winset(src,"login","is-visible=false") uses src.client from src. If we've called mob.Logout() on src, then src.client is now NULL and provides you with the error you're seeing.

To resolve the issue, I would suggest rebuilding the logic on client rather than mob.
In response to Pirion
Wow...That's confusing.

The problem didn't change when I removed the lines. However, it should be noted that I was able to load the character once with an invisible icon. After logging out and logging back in once more, I discovered I couldn't load the character; the same RTE appeared.

With the rebuilding on the client, would you mind giving me a head start? If I may, I will follow on from there.