ID:269010
 
Before I code some stuff, when loading objs from a savefile to a list, is the obj's New() proc called?
wouldnt the New() be creating a completely new object insted of loading the old one?
In response to Psychotic
Yeah, but I'm wondering because if it's loading from something, it has to create it again.
In response to Hell Ramen
are you loading up a save file as if a person was logging in? or loading something..say an items list in a pop up window? what would the New() be used for if it were supposed to be used?
In response to Psychotic
As a person as logging in...
In response to Hell Ramen
mine doesnt use the New(), but rather newmob

mob
proc
LoadCharacter() // The load character proc
var/savefile/F = new("players/[src.ckey].sav") // define the location of the save file
var/X // Defines a temporary X variable
var/Y // Defines a temporary Y variable
var/Z // Defines a temporary Z variable
var/mob/newmob = new() // Initialize a new mob
F["name"] >> name // Load the name from the list into the character's name
F["X"] >> X // Load the X variable from the savefile to the temporary X variable
F["Y"] >> Y // Load the Y variable from the savefile to the temporary Y variable
F["Z"] >> Z // Load the Z variable from the savefile to the temporary Z variable
F["Mob"] >> newmob // Load all the mob data into the initialized mob
newmob.loc = locate(X,Y,Z) // Move the initialized mob to the last saved location
newmob.client = src.client // Set the mob's client to players client
In response to Psychotic
Nnuuu, I want to know if the New() proc is called when loading objects from a savefile that were on a list to a list. =/
In response to Hell Ramen
ahaa..

well...i really couldnt say. normally it is YOU who is helping ME with codes.

all i could really do if i were you would be make the code and test it out. then ask if it looks right.

but you already know that.
In response to Hell Ramen
I don't think it would.

Lets say you add 3 swords onto a list. Then you delete every obj on that list from the world. Would you now be able to change the information that the obj has on the list and apply it to the world? Nope probably not since those objs don't exist anymore.

I think the same is true here. You don't have a hard copy of the objs, just a list of them. You'd have to recreate every obj on the list.

This is all just my theory and isn't neccessarily true.

*Edit*

By the way, I posted in your hr_gametime demo's forum Hell Ramen.
In response to DeathAwaitsU
Why don't you just test it?
obj/New()
..()
world << "Called"
In response to SSJ2GohanDBGT
Bah, thats taking the easy way out >_>

Oh and I'm pretty sure ..() isn't valid there.
In response to DeathAwaitsU
Of course it's valid! It may or may not do anything in that example (it will if atom/New(), atom/movable/New(), or obj/New() have been overridden elsewhere), but either way it's perfectly valid.

The only place that ..() shouldn't go is in a proc that's defined explicitly (with "proc" in its path), rather than overridden:

mob/proc/blahblah()
.=..() // BAD! Don't do this. There is no parent proc.
// (It *probably* wouldn't hurt, but don't do it anyway.)
// Note the "proc" in "mob/proc/blahblah()".
// That's what tells us that there is NO parent proc.
// If the "proc" isn't there; say, if this was "mob/blahblah()";
// then this is an overridden proc, which DOES have a parent proc.

mob/blahblah()
.=..() // Good!

mob/New()
.=..() // Good!
In response to Crispy
Well I said that based on what Lummox JR said to someone else:

[link]

I may have just interpreted him wrong.
In response to DeathAwaitsU
Yes, you did misinterpret him I'm afraid. Rather badly. =)

Lummox JR wrote: (in [link])
It [..()] means "do what this proc would have done if I hadn't overridden it". You don't use it in new verbs/procs.
In response to Crispy
But isn't obj/New() a proc itself?
In response to DeathAwaitsU
I think you're mis-interpretting "you don't use it in new verbs/procs" as "you don't use it in New verbs/procs." By "new verbs/procs" he means ones you just declared, as Crispy pointed out. =)
In response to YMIHere
YMIHere is correct. If Lummox had meant "you don't use it in New() procs", he would have explicitly said "New() procs".

In any case, your interpretation made little sense in the context of his post. =) Always think critically about what you read, no matter who wrote it.