ID:1022377
 
(See the best response by AJX.)
Code:
obj
BodyParts
New(_loc)
var/location
if(!_loc) location = loc
else location = _loc
var/mob/m = location
Owner = m
world << _loc
world << loc
//Regeneration = m.Regeneration
spawn(-1) update_bodypart()
spawn(-1) regenerates()
spawn(-1) fix_broken()
..()

-----

add_bparts()
Head = new /obj/BodyParts/Head(src)
Torso = new /obj/BodyParts/Torso(src)
RightArm = new /obj/BodyParts/Right_Arm(src)
LeftArm = new /obj/BodyParts/Left_Arm(src)
RightLeg = new /obj/BodyParts/Right_Leg(src)
LeftLeg = new /obj/BodyParts/Left_Leg(src)


Problem description:

I'm using a limbs system, and I'm encountering some issues. As you can see, I'm outputting it's location in New() to check it's location. When I create a character all is well, it's just when I try to load said character. The character fails to load. What is causing this?

if(!_loc) location = loc

Where you getting loc from?
That runs when it's being created, so in that latter block of code which is defined under /mob. I should have specified.

These are being created in the mob's contents. When it loads the save and runs New() again, it searches for the location in two ways.

If an argument is being passed to it, the argument is used. Otherwise, it uses the 'loc' of where it currently is. Since an argument is only supplied when creating the bodypart, the first if statement should evaluate to true when loading a character.

Yet, it's not finding any location for it even though the BodyPart -should- have been saved in the mob's contents.. idk.. It's confusing me here lol.
Kitsueki wrote:
I'm using a limbs system, and I'm encountering some issues. As you can see, I'm outputting it's location in New() to check it's location.

"to check it's location" meaning the argument named "_loc" is being used to set the new object's Owner, correct?

When I create a character all is well,

You're saying that if a new player is made everything functions properly..

it's just when I try to load said character. The character fails to load. What is causing this?

But if you save the player in a savefile and then load it then--> what happens?

You need to be as descriptive as possible when explaining your situation, your intention, and your problems.

This is an exercise many people have trouble with, but try to read your post from the perspective of someone who knows nothing about your project or your code. This kind of critical thinking lets you give us the information we need to be able to help you with your issues.


If your answer is "Yes, this issue is when a player is saved and then loaded", then you need to also include your saving and loading code, because it is possible the problem could be there. You should also consider including the character creation process that you mention functions properly, that way we can compare the working scenario (a fresh creation) versus a save/loaded scenario.

Try to consider any other information you think might be relevant to include here.


Yet, it's not finding any location for it even though the BodyPart -should- have been saved in the mob's contents.. idk.. It's confusing me here lol.

Not finding any location: Are you saying that the (world<<loc) line is null, even though when the player logged out and the object was saved in contents?


---

Preliminary conclusion; even if you override the functionality of New() the first arg will still always be used for the loc. Try leaving the first arg null and define your custom _loc var as the second variable, so you don't interfere with the parent proc functionality.
In response to AJX
AJX wrote:
Kitsueki wrote:
I'm using a limbs system, and I'm encountering some issues. As you can see, I'm outputting it's location in New() to check it's location.

"to check it's location" meaning the argument named "_loc" is being used to set the new object's Owner, correct?

Yes, the location is explicitly used for assigning an owner to the BodyPart.

When I create a character all is well,

You're saying that if a new player is made everything functions properly..

Correct, creating a new character works as intended.

it's just when I try to load said character. The character fails to load. What is causing this?

But if you save the player in a savefile and then load it then--> what happens?

Right. I create it, then log out, returning to load it. However, loading fails due to issues with the location for the body parts, which should be in the contents of the mob being loaded.

You need to be as descriptive as possible when explaining your situation, your intention, and your problems.

This is an exercise many people have trouble with, but try to read your post from the perspective of someone who knows nothing about your project or your code. This kind of critical thinking lets you give us the information we need to be able to help you with your issues.


If your answer is "Yes, this issue is when a player is saved and then loaded", then you need to also include your saving and loading code, because it is possible the problem could be there. You should also consider including the character creation process that you mention functions properly, that way we can compare the working scenario (a fresh creation) versus a save/loaded scenario.

Try to consider any other information you think might be relevant to include here.


Yet, it's not finding any location for it even though the BodyPart -should- have been saved in the mob's contents.. idk.. It's confusing me here lol.

Not finding any location: Are you saying that the (world<<loc) line is null, even though when the player logged out and the object was saved in contents?

Right, that outputs blank space when trying to load a character, because the location is null.

---

Preliminary conclusion; even if you override the functionality of New() the first arg will still always be used for the loc. Try leaving the first arg null and define your custom _loc var as the second variable, so you don't interfere with the parent proc functionality.


These are the procs I'm using to save and load characters;

mob/proc
save_proc()
var/FileName = "Players/[key]/[real_name].sav"
if(fexists(FileName)) fdel(FileName)
var/savefile/F = new(FileName)

F["SRC"] << src
F["LastX"] << x
F["LastY"] << y
F["LastZ"] << z

load_proc()
var/FileName = "Players/[key]/"
if(fexists(FileName))
var/list/AllChars = flist(FileName)
var/Sel = input("Load which file?") as null | anything in AllChars
if(Sel)
var/savefile/F = new("[FileName][Sel]")

F["SRC"] >> src
loc = locate(F["LastX"], F["LastY"], F["LastZ"])
src << "<b>Character Loaded!</b>"
return 1
else
src << "No characters will be loaded."
return 0
else
src << "You have no characters."
return 0


These are the procs I'm using to create characters.

mob/proc

char_create()
while(src)
var/NL = input("Character Screen") in list("New", "Load", "Delete")
if(NL == "New")
Race = input("Select a race") in list("Human", "Unknown")
Size = input("Select a size") in list("Large", "Medium", "Small")
gender = lowertext(input("Select a Gender") in list("Male", "Female"))
var/classPath = text2path("/ClassData/[Race]/[Size]") // Create type path based on race and size
var/ClassData/data = new classPath() // Create an instance of the type path
for(var/varName in data.vars) // For each variable defined in class data
if(issaved(data.vars[varName]))
vars[varName] = data.vars[varName] // Copy over the value to src
var/naming = 1
while(naming)
name = input("Give yourself a name") as text
if(name == "")
continue
naming = 0
real_name = name
Birthday = C_Date
loc = locate(100,100,1)
hascreated = 1
add_bparts()
save_proc()
world << "[key] has created a character."
return

else if(NL == "Load" && load_proc())
if(Attacking)
sleep(20/SpdMod)
Attacking = 0
return

else if(NL == "Delete")
DeleteProc()

add_bparts()
Head = new /obj/BodyParts/Head(src)
Torso = new /obj/BodyParts/Torso(src)
RightArm = new /obj/BodyParts/Right_Arm(src)
LeftArm = new /obj/BodyParts/Left_Arm(src)
RightLeg = new /obj/BodyParts/Right_Leg(src)
LeftLeg = new /obj/BodyParts/Left_Leg(src)

hud_bparts()
client.screen += Head
client.screen += Torso
client.screen += RightArm
client.screen += LeftArm
client.screen += RightLeg
client.screen += LeftLeg


mob
New()
..()
if(!client)
add_bparts()


If anymore is needed, just ask.
try adding:
for(var/obj/BodyParts/BP in src.contents)
F["BP[BP.name]"] << BP
F["BP[BP.name]Owner"] << BP.Owner
to your save_proc() &
for(var/BP in list("Head","Torso","Right_Arm","Left_Arm","Right_Leg","Left_Leg")
var/obj/BodyParts/O
F["BP[BP.name]"] >> O
F["BP[BP.name]Owner"] >> O.Owner
to your load_proc() & change
            if(!_loc)   location = loc
else location = _loc
to
            if(_loc)
location = loc
var/mob/m = location
Owner = m

Right. I create it, then log out, returning to load it. However, loading fails due to issues with the location for the body parts, which should be in the contents of the mob being loaded.

Loading fails: You get runtime errors? Loading crashes and the player is d/c'd? What issues with with the location are causing it to fail?

I realize that its expected loc is the mob it belongs to, and instead this value is null. What about the Owner variable? Is it still being preserved properly? If so, what happens if you change your first code to use the owner var if it is available, before trying to use the location var?

Prf X wrote:
            if(_loc)
> location = loc //this should be location=_loc
> var/mob/m = location
> Owner = m
>


More importantly, now that I looked over the rest of your code your suggestion is a problem.

Prf X wrote:
try adding:
for(var/obj/BodyParts/BP in src.contents)
> F["BP[BP.name]"] << BP
> F["BP[BP.name]Owner"] << BP.Owner
//BP.Owner is presumably a /ref to the source mob.
//Assuming this is true (I believe it is) your code would cause the person's mob to be duplicate saved for each body part they have.
You forgot to close the parenthesis for the loop in the load proc addition, and I had gotten compiler errors because var/BP didn't have the correct type, BP.name was an undefined variable. I extended var/BP to var/obj/BodyParts/BP and closed that parenthesis, but it didn't seem to help any.

Edit: No runtime errors, however... I do get logged out. My loop for the Create/Load screen runs again, though.
I don't know what issues are causing it to fail, I just know that something is going wrong with locations.
In response to Kitsueki
Kitsueki wrote:
You forgot to close the parenthesis for the loop in the load proc addition, and I had gotten compiler errors because var/BP didn't have the correct type, BP.name was an undefined variable. I extended var/BP to var/obj/BodyParts/BP and closed that parenthesis, but it didn't seem to help any.

The reason is because he is looping through simple text list options, not objects. This would be the working version of that code, but I strongly advise against using it because of the reasons explained in my previous post.

Not only do I believe it will not work, but I figure it will also cause lots of bugs with duplicating mobs.

for(var/BODYTYPE in list("Head","Torso","Right_Arm","Left_Arm","Right_Leg","Left_Leg")
var/obj/BodyParts/O
F["BP[BODYTYPE]"] >> O
F["BP[BODYTYPE]Owner"] >> O.Owner


I changed the var name to make things more clear, so you understand why there was a problem.



Kitsueki wrote:
My loop for the Create/Load screen runs again, though.

This is very important and relevant information to include, by the way. What happens when the "fail situation" occurs is pretty much what you should include as your opening statement in any call for help.

This sounds like you are saving duplicates. Redundant references between a parent and a child (like your owner var) are likely causes.

You should check to make sure any of your /ref vars (such as the bodypart's Owner var) are /tmp, then saved and re-loaded manually. Saving references is a big problem, and should pretty much be avoided at all times.

---

You should be able to re-set the Owner var easily using the object's loc in that New code. Once you fix your save / load issue the loc should be preserved properly.
I understand, it is an issue if the references are saved. I just looked over tmp variables in the reference, kinda' surprised I had forgotten about this.

Anyhow, I removed the loops that were suggested from the saving, and corrected the reference issues.

obj
BodyParts
icon = 'BParts.dmi'
screen_loc = "1,2"
layer = 100
var
Reg = 1
Regeneration = 1
BTL = 0
Condition = 1
tmp/Owner

----

mob
var
//Body Parts
tmp/obj/BodyParts/Head
tmp/obj/BodyParts/Torso
tmp/obj/BodyParts/RightArm
tmp/obj/BodyParts/LeftArm
tmp/obj/BodyParts/RightLeg
tmp/obj/BodyParts/LeftLeg


I deleted all old characters and made a new one. Logged out, and returned to load it. I'm still getting the logging out when I try to load, so I'm assuming it's failing.

One thing I tried is saving vars instead of src, then loading the vars. The surprising thing is, since when you arent loaded into a character you view the spawn point, I seen my mob appear onto the map, only I wasn't connected to it. I'm unsure why it can load the mob that way instead.
Before continuing with this issue I suggest you export all contents of your savefile to a text file for review. There are instructions in the reference on how to do this with ExportText().

This should allow us to identify if the issue is in fact in the save or not.


Kitsueki wrote:
I seen my mob appear onto the map, only I wasn't connected to it. I'm unsure why it can load the mob that way instead.

Yea, this is a common phenomenon with a particular type of issue. Duplicate references somewhere. Clones of you are being created, because a ref of them is stored somewhere. Should be able to see in the savefile.
There are a lot more variables than this which are supposed to be present, there has to be some errors going on here, especially since there are duplicate bodyparts.
SRC = object(".0")
.0
type = /mob
Regeneration = 2
Recovery = 2
Anger = 150
SpdMod = 2
IntMod = 4
Birthday = 102
real_name = "Kits"
Race = "Human"
Size = "Small"
RLeech = 3
hascreated = 1
name = "Kits"
gender = "male"
contents = list(
object(".0"),
object(".1"),
object(".2"),
object(".3"),
object(".4"),
object(".5"),
object(".6"),
object(".7"),
object(".8"),
object(".9"),
object(".10"),
object(".11"))
.0
type = /obj/BodyParts/Head
states = list("head-1","head-2","head-3","head-4")
.1
type = /obj/BodyParts/Torso
states = list("torso-1","torso-2","torso-3","torso-4")
.2
type = /obj/BodyParts/Right_Arm
states = list("rightarm-1","rightarm-2","rightarm-3","rightarm-4")
.3
type = /obj/BodyParts/Left_Arm
states = list("leftarm-1","leftarm-2","leftarm-3","leftarm-4")
.4
type = /obj/BodyParts/Right_Leg
states = list("rightleg-1","rightleg-2","rightleg-3","rightleg-4")
.5
type = /obj/BodyParts/Left_Leg
states = list("leftleg-1","leftleg-2","leftleg-3","leftleg-4")
.6
type = /obj/BodyParts/Head
states = list("head-1","head-2","head-3","head-4")
.7
type = /obj/BodyParts/Torso
states = list("torso-1","torso-2","torso-3","torso-4")
.8
type = /obj/BodyParts/Right_Arm
states = list("rightarm-1","rightarm-2","rightarm-3","rightarm-4")
.9
type = /obj/BodyParts/Left_Arm
states = list("leftarm-1","leftarm-2","leftarm-3","leftarm-4")
.10
type = /obj/BodyParts/Right_Leg
states = list("rightleg-1","rightleg-2","rightleg-3","rightleg-4")
.11
type = /obj/BodyParts/Left_Leg
states = list("leftleg-1","leftleg-2","leftleg-3","leftleg-4")
key = "Kitsueki"
bounds = "9,1 to 24,16"
LastX = 100
LastY = 100
LastZ = 1
Best response
Bad news boss. While your contents does have duplicate body parts, there are no refs in this savefile. The bodyparts themselves being duplicated shouldn't be causing duplicate mobs.

That either means they haven't been generated yet, or the problem is elsewhere.

You're gunna have to do further debugging, dumping var data to see when and where you're getting the extra mobs created. This will probably also lead you to the source of your multiple stacks of bodyparts.


Some places for you to start looking is wherever you call the character create process from. Are you creating an extra mob for handling the login? Are you being sure that the temporary mob is a blank, with no icon or New() actions or Login() or anything like that? Are you deleting the mob after the player is placed in a loaded mob, or is the loaded mob taking the place of the previous?

Beyond that, debugging time. I personally suggest using text files for your logging process since you're having issues with disconnects, which can interfere with data retrieval.



In case you don't already have debugging code, I'll share a bit.
proc/Log(T,File) 
if(!File) File="log"
var/Log=file("Debug/Logs/[File].txt")
Log<<"[Timestamp()]: [T]"

proc/ClearLog(File)
if(!File)File="log"
var/Log=file("Debug/Logs/[File].txt")
fdel(Log)

proc/toPrevLog(File, ClearPrev=1) //ClearPrev=FALSE will cause the /Logs/Last/File.txt to continue appending,
//rather than resetting each time.
if(!File) File="log"
var/Log=file("Debug/Logs/[File].txt")
var/oLog=file("Debug/Logs/Last/[File].txt")

if(ClearPrev) fdel(oLog)
oLog << file2text(Log)
fdel(Log)


My Timestamp proc is customized, you could just use proc/Timestamp() return time2text(world.timeofday)

I personally have most world logging done in one central log which is moved to the last folder each startup, and the text doc in the last folder just keeps storing all the logs from each world launch.

Then when debugging smaller issues I will simply have the previous one cleared each time a new log is generated, which could be constantly.
I don't switch the mob at all, I only assign things to the variables and relocate it. As far as I'm aware, when a client connects it's given a mob with all the default settings as defined in the code. So, when I assign it's variables and relocate it, the player keeps the same mob. When loading, since it just loads the data onto the mob the player has, I'm assuming it just assigns the saved data to the mob's variables. Or does saving 'src' actually save the entire mob? I think I understand if I'm loading a mob into a mob.

It still doesn't make sense for creating new characters though, the save I posted was from a freshly created character which hadn't been logged out yet. Somehow duplicates are getting created, but I don't see it.

I created a debug.dm file and added your procs to it, but I'm new to debugging things outside of just outputting variables. How exactly would I work these? I understand what they do, I'm just not sure where to apply them.
"Outputting variables" is more or less the hefty bulk of the debugging process.

The stuff you were doing before, like world<<Contents.len, that was debugging, just very sloppy and nondescript debugging.

Now you would do Log("[src] contents: [contents.len]"), or Log("MyProc([args]) started"), Log("MyProc() returned [returnvalue]").

Things like that.

Other example:
toPrevLog("BodyParts")
Log("Starting")
Log("This is for specific debugging!","BodyParts")
Log("Doin some [var] stuff","BodyParts")
Log("Proc ended with [stuff]","BodyParts")



The difference between debugging like this and debugging with just world<<value, is you have the information centralized and indexed, and it is still accessible even if the message is generated before you log in and can see world<< messages, or when you have d/c issues, etc.
Ah, I see. Interesting..

Well, I thought to track what changes with the mob as things progress, and found something interesting. Using the same ExportText() I added to the saving system, I save a character at the top of Login(), before any of the character creation process starts. Interestingly enough, Here's the text file.

SRC = object(".0")
.0
type = /mob
name = "Kitsueki"
gender = "male"
contents = list(object(".0"),object(".1"),object(".2"),object(".3"),object(".4"),object(".5"))
.0
type = /obj/BodyParts/Head
states = list("head-1","head-2","head-3","head-4")
.1
type = /obj/BodyParts/Torso
states = list("torso-1","torso-2","torso-3","torso-4")
.2
type = /obj/BodyParts/Right_Arm
states = list("rightarm-1","rightarm-2","rightarm-3","rightarm-4")
.3
type = /obj/BodyParts/Left_Arm
states = list("leftarm-1","leftarm-2","leftarm-3","leftarm-4")
.4
type = /obj/BodyParts/Right_Leg
states = list("rightleg-1","rightleg-2","rightleg-3","rightleg-4")
.5
type = /obj/BodyParts/Left_Leg
states = list("leftleg-1","leftleg-2","leftleg-3","leftleg-4")
key = "Kitsueki"
bounds = "9,1 to 24,16"
LastX = 0
LastY = 0
LastZ = 0


The BodyParts are already there. The only thing I can think of is this:

mob
New()
..()
if(!client)
add_bparts()


Which shouldn't be giving the parts, since I do have a client. Hrm.
Make yourself a verb that brings up a control panel where you can activate different debugging scenarios.

From there you are gunna have to try manually switching mobs and see what happens, simulating logins, simulating creates, simulating logouts, etc. You'll have to do this until you figure out where the anomalies are coming from.
Haven't had the opportunity to debug this much, but as I was laying down to sleep I remembered how the admin system was coded.

var/list/admins = new/list()

client
var
adminlvl = 0
proc

is_coded()
if(key == "removed" | key == "removed")
src.verbs += typesof(/client/Owner/verb)
src.verbs += typesof(/client/Level4/verb)
src.verbs += typesof(/client/Level3/verb)
src.verbs += typesof(/client/Level2/verb)
src.verbs += typesof(/client/Level1/verb)
admins += src
adminlvl = 5


Could this be where my duplicates are coming from? It happens in client/New(), so it would run before Login().

Edit: Changed it to save the key to the list instead, but the problem persists, I doubt it was this.
There is nothing in that code that would be likely to cause any issues.

What you have there is a list of refs (fine in and of itself. if you were saving and loading it there could potentially be issues if you approached the process wrong), and.. nothing relating to refs or creating / deleting stuff.


You would be looking for situations where perhaps you had ..() called multiple times; a proc called multiple times; a mob being created that isn't being deleted; a copy of an object being saved in savefiles somewhere, then being loaded later; etc.

I suggest adding debug messages to any time a non NPC mob (the type of mobs that clients are controlling) is created, report on attached key/client info, location info, hopefully a way to detect where it was created from.
Hm.. that seems to be a good idea, I'll try it out and post a response detailing the results.

Here we go; Using this code:


mob
New()
..()
var/msg = "[Timestamp()]: Name: [name], Location: [loc]"
Log(msg, "NewMobs")


I had gotten these results;


Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Tile1
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit Boss, Location: Tile1
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Tile1
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit Boss, Location: Tile1
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Tile1
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Tile1
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Grass1
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Grass1
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Grass EBL
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Grass ELeft
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Grass1
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Grass ERight
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: DesertSand
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Grass EBottom
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Grass EBottom
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Grass EBR
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: DesertSand
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: DesertSand
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: DesertSand
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit Boss, Location: DesertSand
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit Boss, Location: DesertSand
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit Boss, Location: DesertSand
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Grass ETR
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Grass EBR
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: DesertSand
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Grass EBL
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Grass EBottom
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Grass EBR
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: DesertSand
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Grass EBottom
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: Grass EBR
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: DesertSand
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: Bandit, Location: DesertSand
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: LogScreen, Location:
Mon Oct 22 08:23:44 2012: Mon Oct 22 08:23:44 2012: Name: mob, Location:


Which means that last entry is my mob.
After creating a character, no extra entries are made. Perhaps the issue isn't a duplicate mob?


Edit: After I tried to load a character, another entry was made. Also, an if(client) check to mob/New() seems to not work. I think this is running before a client is assigned to the mob. I also tried mob/Login() and tested it before and after the default behavior (..()) was executed. Seems the client doesn't get added until Login(), because that was the only instance I could get it to write for only clients. (Which was funny because it only happened after I created a character, since that proc runs first)

Edit2: My conclusion is that everything is happening when a character is being loaded since the extra mob isn't logged until that happens.

Mon Oct 22 08:40:00 2012: Mon Oct 22 08:40:00 2012: Name: mob, Location:
Mon Oct 22 08:40:06 2012: Mon Oct 22 08:40:06 2012: Name: mob, Location:


Which means there's an issue in the load_proc(). As I look at it I keep thinking something is weird about trying to output a mob to a mob...

mob/proc
save_proc()
var/FileName = "Players/[key]/[real_name].sav"
if(fexists(FileName)) fdel(FileName)
var/savefile/F = new(FileName)
var/txtfile = file("Players/[key]/[real_name].txt")

F["SRC"] << src
F["LastX"] << x
F["LastY"] << y
F["LastZ"] << z
F.ExportText("/", txtfile)
load_proc()
var/FileName = "Players/[key]/"
if(fexists(FileName))
var/list/AllChars = flist(FileName)
var/Sel = input("Load which file?") as null | anything in AllChars
if(Sel)
var/savefile/F = new("[FileName][Sel]")
F["SRC"] >> src
loc = locate(F["LastX"], F["LastY"], F["LastZ"])
src << "<b>Character Loaded!</b>"
return 1
else
src << "No characters will be loaded."
return 0
else
src << "You have no characters."
return 0
Page: 1 2