ID:147839
 
For some reason, I'm getting a few proc errors when running this proc. It happens randomly, it mostly works after a while.

mob
proc
meleehit()
spawn()
if(src)
var/obj/flicker/flicker1 = new(locate(src.x-1,src.y-1,src.z))
flicker1.dir = SOUTHWEST
var/obj/flicker/flicker2 = new(locate(src.x+1,src.y-1,src.z))
flicker2.dir = SOUTHEAST
var/obj/flicker/flicker3 = new(locate(src.x-1,src.y+1,src.z))
flicker3.dir = NORTHWEST
var/obj/flicker/flicker4 = new(locate(src.x+1,src.y+1,src.z))
flicker4.dir = NORTHEAST
sleep(5)
step(flicker1, flicker1.dir)
step(flicker2, flicker2.dir)
step(flicker3, flicker3.dir)
step(flicker4, flicker4.dir)
spawn(5)
del(flicker1)
del(flicker2)
del(flicker3)
del(flicker4)
del(flicker1)
del(flicker2)
del(flicker3)
del(flicker4)
del(flicker1)
del(flicker2)
del(flicker3)
del(flicker4)
else
for(var/obj/flicker/Z in world)
if(Z)
del(Z)
..()
By the way, the proc is mostly graphical.
In response to Vakir
By the way, the proc is mostly graphical.

It would help others isolate the problem if you were specific as to what errors that segment of source code generated.
What Theodis said. One thing a lot of people who post overlook is, it -really- helps if you explain exactly what you think your code is supposed to be doing, and what it actually ends up doing (or fails to do).

I can tell that at least a big chunk of this code doesn't do what you think it does... that tells me there is a problem, but since I don't know what you're going for, I can't really give you a solution.

Anyway, look at this:

del(flicker1)
del(flicker2)
del(flicker3)
del(flicker4)
del(flicker1)
del(flicker2)
del(flicker4)
del(flicker1)
del(flicker2)
del(flicker3)
del(flicker4)

Only the first four lines of this code can actually do anything. By the time you get to the second del(flicker1), there is no flicker1,2,3, or 4... you're deleting all four flickers, and then you're deleting nothing eight times. Seriously, remove the second and third sets of dels and see if it makes any difference.

And then:

for(var/obj/flicker/Z in world)
if(Z)
del(Z)

The line
if (Z)
does nothing... if there isn't any obj/flicker/Z, then the for() line is just skipped.
In response to Hedgemistress
Yeah, I know that. Sometimes the flicker doesn't get deleted sometimes so I put three entries. I'll get the exact proc error.
In response to Vakir
Figured it was something like that. This kind of solution is often called a "hack"... it would be better to figure out why the flickers don't get deleted instead of resorting to such overkill, because the one error is probably causing the other.

Have you in any way redefined the Del() proc, either for objs as a whole or for the flicker objs?
In response to Hedgemistress
Yes, I have only for clients though.