ID:150629
 
proc/NewItemCounter()
        sleep(25)
        var/obj/wetness/O = new(null)
        O.Move(usr.loc)
        spawn(1) NewItemCounter()
Okay, this code looks to me like it should work fine, but when I run it it sleeps, creates the object, moves it to the usr's location, and stops. It doesn't even reach the spawn(1) because if you put a usr << "Bleh!" in between those two lines it doesn't show, it just stops at the O.Move(). What am I doing wrong?

Oh and if I take the O.Move() proc out it works fine.
var/obj/wetness/O = new(null)

Besides an object called "wetness" sounding rather disgusting, I think the null part here might be causing the problem. I can't think of a reason why it wouldn't work, but there's no reason for it anyway. Just do

var/obj/wetness/O = new()

[Edit:] Also, using usr could be a problem of sorts.. I doubt its causing this, but it could conceivably do so in the future. Especially with multiple players.

-AbyssDragon
In response to AbyssDragon (#1)

Besides an object called "wetness" sounding rather disgusting...

If you think that's bad, you should see the game theme :oP
Foomer wrote:
<FONT COLOR=white><pre> > <font color=blue>proc</font>/NewItemCounter() > sleep(25) > <font color=blue>var</font>/obj/wetness/O = <font color=blue>new</font>(null) > O.Move(usr.loc) > spawn(1) NewItemCounter()</FONT></PRE>Okay, this code looks to me like it should work fine, but when I run it it sleeps, creates the object, moves it to the usr's location, and stops. It doesn't even reach the spawn(1) because if you put a usr << "Bleh!" in between those two lines it doesn't show, it just stops at the O.Move(). What am I doing wrong?

Oh and if I take the O.Move() proc out it works fine.

in that code up above, its a global proc, who's to say that a usr is gonna call it.

If i were you, i would put src.loc, and make sure that a mob or an obj is calling it.
In response to FIREking (#3)
FIREking wrote:
Foomer wrote:
<FONT COLOR=white><pre> > > <font color=blue>proc</font>/NewItemCounter() > > sleep(25) > > <font color=blue>var</font>/obj/wetness/O = <font color=blue>new</font>(null) > > O.Move(usr.loc) > > spawn(1) NewItemCounter()</FONT></PRE>Okay, this code looks to me like it should work fine, but when I run it it sleeps, creates the object, moves it to the usr's location, and stops. It doesn't even reach the spawn(1) because if you put a usr << "Bleh!" in between those two lines it doesn't show, it just stops at the O.Move(). What am I doing wrong?

Oh and if I take the O.Move() proc out it works fine.

in that code up above, its a global proc, who's to say that a usr is gonna call it.

If i were you, i would put src.loc, and make sure that a mob or an obj is calling it.

src is null for global procs, so that won't really help either. It might be best if you feed the location in as an argument.

Also, since you know where you want the wetness, you can specify that in the new() line and take the Move() line out (unless you want to do some checking with Enter() and Entered()).

var/obj/wetness/O = new(usr.loc)

will create a new wetness at the usr's loc.

It may be stopping if usr is null, but it should send a message to world.log telling you that. I can't think of any other reason why the Move() would terminate the proc, unless you have done something very odd in the wetness/Move() proc.