ID:781515
 
(See the best response by Albro1.)
Code:
    
under
grass
new/item/new_grass(src.loc)
var/item/m = new
m.Disappear()
item
proc
Disappear()
var/A = src.loc
spawn(20)
if(src.loc == A)
del src


Problem description:
i am trying to delete the instance of new_grass within 2 seconds. the problem is that the disappear proc is outside of the "under" root.

i am not getting any errors but the object is not disappearing.
Best response
Kalster wrote:
Code:
> under
> grass
> new/item/new_grass(src.loc)
> var/item/m = new
> m.Disappear()
> item
> proc
> Disappear()
> var/A = src.loc
> spawn(20)
> if(src.loc == A)
> del src
>
>

Problem description:
i am trying to delete the instance of new_grass within 2 seconds. the problem is that the disappear proc is outside of the "under" root.

i am not getting any errors but the object is not disappearing.

I hope you are putting that chunk of code under under/grass in it's New() proc. Plus, your m.Disappear() is tabbed over for whatever reason. Also, code under spawn() should be tabbed. This is because it lets the rest of the code execute, and saves the code tabbed under it for when the allotted time is up. sleep() just stops the whole process until the allotted time is up, which is why you don't put things tabbed after it.

Also, your referencing is wrong. Try this:
under/grass/New()
..()
var/item/new_grass/n = new(src.loc)
n.Disappear()
In response to Albro1
Albro1 wrote:
I hope you are putting that chunk of code under under/grass in it's New() proc. Plus, your m.Disappear() is tabbed over for whatever reason. Also, code under spawn() should be tabbed. This is because it lets the rest of the code execute, and saves the code tabbed under it for when the allotted time is up. sleep() just stops the whole process until the allotted time is up, which is why you don't put things tabbed after it.

i made a mistake by tabbing over the m.Disappear.
yes, the code is working correctly now. thank you