Isaac wrote:Two New Questions:
Would someone please explain or post an example of the use for 'entitiesAt' ?
What exactly does this function do? (Aside from what's hinted by the name.
![Wink ;)](./images/smilies/icon_e_wink.gif)
)
Pick a square with stuff in it and run this script:
Code: Select all
for entity in entitiesAt(1, 17, 16) do
print("entity is "..entity.name)
if entity.name == "lurker_hood" then
do this
end
end
entitiesAt cycles through everything in the square (level, x, y) so you use it as an iterator in a loop and then you check all the items in that square for something.
Try this:
Code: Select all
for entity in allEntities(1) do
print("entity is "..entity.name)
end
And it spits out everything in level 1, pretty cool and useful.
When trying to figure something out in a script, put a print line in to see what it's doing.
And is what is the way to detect the calling object within the called script?
*Meaning if Button_1 (of several) triggers a script (that they all are connected to), how can the calling button ID be detected?
I'd like to know this too!