ID:141177
 


obj/item

apple
icon='food.dmi'
icon_state="apple"
price=100
verb
Plant()
usr<<"You plant a tree!"
new/turf/tree(usr.loc)
del(src)


So frustrating..I'm a beginner coder and am in need of help. So, I thought that the ^code^ should plant a tree where the player is standing, and it does. The problem is that the apple in the player's inventory that is used as a seed won't go away when planted. Does anyone know what I am doing wrong?

I hazardly guess the Tree has a while() loop running in its New() proc to make it grow, amirite?

spawn() new/turf/tree(usr.loc)
Zzz. Bad code, never mind (mine)
In response to Scizzes
Hello Scizzes. Please do not post snippets in which you do not know how things work, the very last line of the snippet shown will not work the way you think it will (especially since the item itself is the src).

In addition, you should read the original post, he wasn't talking about the title is named after.