lookForAtArea and lookForAt return different values at the same point
-
lookAtArea(top, left, bottom, right)
Top/bottom = y
lef/right = xI had the same issue, pretty annoying, cause lookForAt(type, x, y) means its X,Y instead of -Y,-X,+Y,+X
So in your case, to check x=10, y=13, do this:
JSON.stringify([
Game.rooms.E10N4.lookForAtArea('terrain',13,10,13,10),
Game.rooms.E10N4.lookForAt('terrain',10,13)
])
-
JSON.stringify([ Game.rooms.E10N4.lookForAtArea('terrain',10,13,10,13), Game.rooms.E10N4.lookForAt('terrain',13,10) ])
Still not same
-
[{"10":{"13":"swamp"}},"wall"]
-
I guess, the tile you are looking at has both wall AND swamp (which you can't see, since it is hidden by the wall) and thus different results can be returned. (Kind of the same when you build ramparts and then another structure on it).
-
chris, instead of wall ramparts is a structure, but wall, plain and swamp is a terrain
-
JSON.stringify([ Game.rooms.E10N4.lookForAtArea('terrain',10,13,10,13), Game.rooms.E10N4.lookForAt('terrain',13,10) ])
This checks just above the source keeper liar in your room. The normal walls are actually a terrain structure. Chris is correct, you can have multiple terrains on a single spot, in this case, there is a swamp underneath that wall.
-
heggico, you are wrong too! How you describe this?
JSON.stringify(Game.rooms.E10N4.lookAtArea(10,13,10,13))
{"10":{"13":[{"type":"terrain","terrain":"wall"}]}}
-
I don't see how i'm wrong? The block you are checking now is just above the keeper lair and it is a wall? Since that wall isn't placed by a player, but is an in game object its a terrain type. The output of that command seems correct.
-
Game.rooms.E10N4.lookForAtArea(10,13,10,13) return all types of gameobjects at area and there are no swamps!
Game.rooms.E10N4.lookAt(10,13) return all types of gameobjects at point and there are no swamps!
Game.rooms.E10N4.lookForAt('terrain',10,13) return only terrains and there are no swamps!
Game.rooms.E10N4.lookForAtArea('terrain',10,13,10,13) return only terrains and there are swamp present!
Fix it please!
-
Game.rooms.E10N4.lookForAtArea(10,13,10,13) return all types of gameobjects at area and there are no swamps!
Game.rooms.E10N4.lookAt(10,13) return all types of gameobjects at point and there are no swamps!
Game.rooms.E10N4.lookForAt('terrain',10,13) return only terrains and there are no swamps!
Game.rooms.E10N4.lookForAtArea('terrain',10,13,10,13) return only terrains and there are swamp present!Correct, this just because of the strange return values of these functions.
lookForAt: Get an object with the given type at the specified room position.
So a single object is returned, even if there is a swamp and a wall on a single spot.
lookAt: Get the list of objects at the specified room area.
So this returns all the objects in that spot, so it also returns both terrains, if there are any. Now looking at your functions:lookForAtArea(10,13,10,13) checks the spot just above the source keeper lair, at x=13, y=10, wich is a wall as you can see, but it may contain a swamp or a plain underneath. But does this even run? You didn't specify any type to check for, so i guess you meant lookAtArea. This function only seems to return a single object of a type, so only one terrain. I didn't test this explicitly though.
lookAt(10,13) checks at x=10, y=13, wich is a plain with nothing else, so no swamp
lookForAt('terrain',10,13) checks at x=10, y=13, wich is a plain with nothing else, so again, no swamp
lookForAtArea('terrain',10,13,10,13) checks at x=13, y=10, above the keeper lair. This checks all the terrains, so also the ones underneath the wall that you are currently checking, wich can return a swamp
Now, I do agree that lookForAtArea and lookAtArea should have both returned swamps. And lookForAt and lookAt only returning a single object if it can contain more than one is kind strange too..
-
Thanks for reporting, this must be fixed now.