This is how I coded it, but it doesn't work:
world
proc
DelObj()
var/area/outside/O
var/obj/A/D
for(D in O)
del(D)
-----------------
This doesn't do anything. Help please?
ID:156787
Jul 26 2010, 4:54 pm
|
|
Jul 26 2010, 5:05 pm
|
|
How are you going about running that proc?
|
In response to Darkjohn66
|
|
Darkjohn66 wrote:
How are you going about running that proc? It's attatched to my world repopulation code, which works fine: world/New() ..() spawn for() //empty for loop - keeps going forever, unless you call\ "return" or "break" sleep(60) world.Repop() world.Weather() world.DelObj() world proc DelObj() var/area/outside/O var/obj/A/D for(D in O) del(D) |
You are not specifying what O is. You are telling DM to look for /obj/A in null. If you want to delete all /obj/A, search in the world. Specific region? in Range() or Block() are some other possibilities.
|
In response to GhostAnime
|
|
Isn't my code defining O as /area/outside ?
|
In response to GhostAnime
|
|
GhostAnime wrote:
You are not specifying what O is. You are telling DM to look for /obj/A in null. If you want to delete all /obj/A, search in the world. Specific region? in Range() or Block() are some other possibilities. I need it to only delete items in /area/outside because otherwise it's deleting items inside houses and what not, which is not what I want. |
In response to Wolfrum15
|
|
No, you are defining the variable to access the variables/procedure of that path, you are not specifying any objects it. Read my revised post.
Edit: You can set the variable to the area object by locate()ing it, as one method. |
In response to Wolfrum15
|
|
It's just typecasting O to that type, you're never actually setting the variable to anything.
Give var/area/outside/O = locate() in world And you should always do if(O) to make sure the thing actually exists. |
In response to Nadrew
|
|
Thanks guys for all the possible fixes - I've found a sort of combination of all of them and it seems to be working well. Thanks again.
|
In response to Wolfrum15
|
|
New problem: it is only deleting 1 object in the outside area at a time.
|
In response to Wolfrum15
|
|
If you want all of it to disappear (relatively) all at once, let the garbage collector do the deleting - all you have to do is move the object to THE VOID (0,0,0... or simply modify the z value to 0).
|
In response to GhostAnime
|
|
Or just make it's location null.
(Directed to OP) You can read more about things like that to save space here: http://www.byond.com/members/ DreamMakers?command=view_post&post=39699 |