I need help on the code needed to check a tile for any objects or turfs. If there is a is anything in that tile besides the default tile of name = "stars" then it should return. Otherwise it will place a turf or object there.
LJR
ID:154246
![]() Mar 11 2002, 11:37 pm
|
|
Nadrew wrote:
You didn't say "this belongs in Newbie central"! For shame ,Lummox. For shame.. Eh. I can see some justification for it being on this thread. LordJR may see it more as a question of how best to go about a particular task than as a question asking "How do I...?" Lummox JR |
Lummox JR wrote:
Nadrew wrote: But he did say "the code [for]". |
There should be only one turf per specific x,y,z loc, since that's their nature. Therefore I'd try this: if(theturf.name=="stars" && !theturf.contents.len) Lummox JR I don't just like to get code.. like any good programmer, I I want to know.. What does the !theturf.contents.len do?? contents.len = something is already there or not? otherwise contents would not have a len to begin with? LJR |
LordJR wrote:
I don't just like to get code.. like any good programmer, I I want to know.. What does the !theturf.contents.len do?? Since a turf is an atom, it has a contents list. By checking contents.len, I'm seeing if there's actually anything in that list or not. (When you say if(contents.len) you're really saying if(contents.len!=0), which works just as well.) Lummox JR |
Actually, I believe you can have multiple turfs at one loc, so long as the successive turfs have transparent areas.
-James |
Jmurph wrote:
Actually, I believe you can have multiple turfs at one loc, so long as the successive turfs have transparent areas. Nope. The map editor will allow you to place turfs with transparency on top of other turfs, but this simply creates one turf at that location with underlays of the previously placed turfs (or at least I believe that's what happens; you could try this and then check the turf's underlays var). Only the topmost turf actually exists as a turf. |
Leftley wrote:
Jmurph wrote: I believe the icons are meshed into one, not treated as actual underlays. It definitely only makes one turf, though. |
I believe they are actually underlays. At some point in the past, I complained about them not being in the actual underlays list, and Tom fixed it. An old map-saving routine of mine relied on this.
I think. I could just be making this all up. -AbyssDragon |
There should be only one turf per specific x,y,z loc, since that's their nature. Therefore I'd try this:
Lummox JR