Hi. Can't find a working example on this one, and can't figure it out from the docs. I want to check whether a certain object exists in a defined area, without using coordinates. For example, the areas:
area/black
square1
desc = "Square One"
square2
desc = "Square Two"
square3
desc = "Square Three"
area/red
square1
desc = "Square One"
square2
desc = "Square Two"
square3
desc = "Square Three"
I want to test to see if my object "redstone" exists in, say, /area/black/square1. That area is many tiles in size, and the stone could be anywhere, so I don't want to specify coords. I've been trying variations on the theme:
for(var/obj/redstone/S in /area/black/square1)
if(S)
usr << "There is a red stone in Black's Square One."
else
usr << "No red stones there."
with no luck. It always comes back false...any ideas?
Thanks,
H
ID:178310
May 29 2002, 7:54 am
|
|
In response to Sariat
|
|
Hi,
I found BYOND by looking for game-design resources on the web...an old hobby of mine, but I'm not a real programmer (yet). As a newbie, I am also mystified by BYONDbwicki...what is that? Thanks, H |
Humbabba wrote:
I want to test to see if my object "redstone" exists in, say, /area/black/square1. That area is many tiles in size, and the stone could be anywhere, so I don't want to specify coords. I've been trying variations on the theme: You're close on this, but there's one key problem. The reason this isn't working is that you're /area/black/square1 is a type path, not the area itself. A type path has no contents list. What you need to do is to find the area--either by knowing a turf in that area and getting its loc, or by searching all areas of its type in the world. for(var/area/black/square1/A in world) Lummox JR |
In response to Lummox JR
|
|
Ah. That makes perfect sense...type path. Now I understand what that means.
Many thanks! H |
BTW, how did you Find BYOND? Your key is pretty recent :)