most scope functions don't seem to work. What am I doing wrong ?

HagarQinan
09 Apr 2020, 04:24

for example : in the enter script of a room, I have :
msg ("start")
exits = ScopeExitsForRoom(player.parent)
foreach (exit, exits) {
msg (exit.name)
}
the return is just "start" (as proof that the script ran, but found no exits, while he should have found 2)
I have similar disappointing results for ScopeVisible (which doesn't return all visible objects in the room)
and so on and so on. I can't see any difference between the objets listed and not listed.

What am I missing here ?


mrangel
09 Apr 2020, 10:30

I don't see anything immediately wrong with that.

I assume you've checked the obvious things (exits are visible, room isn't dark).

Can you share the game so that I can take a closer look at it?


HagarQinan
16 Apr 2020, 14:09

Ah, yes. Sorry I didn't respond immediately. I was ... otherwise engaged.
In the mean time , by catching up on the reading of the documentation, I learned how to get at the sources of those functions, and so I actually could have figured out the answer myself. As it turns out, the exits were (intentionally) invisible, and ScopeExitsForRoom only shows visible exits (as you pointed out) . I also figured out that all exit scope functions use AllExits() as a basis, so nothing stops me from doing the same. Problem solved.
As to the other things, turned out I didn't quite grasp the Quest definition of "visible"
Thanks for the reply, by the way