"every turn in the presence of" sometimes compiles

I just discovered a weird bug in my WIP and traced it to a rule with a preamble of the form:

“Every turn in the presence of X when the location is Y and the Z door is closed:”

I tried to make an example that included an “every turn in the presence of” rule, but to my surprise, I got a compiler error saying “in the presence of” can only be used in an action description! Why doesn’t my WIP get a compiler error? Has anyone else encountered this problem?

Maybe the line is being parsed differently in the context of your app? A spurious “presence of X” room is showing up, or something?

Looking at the I6 code can help you figure out what the I7 compiler was thinking when it compiled a line. Sometimes. :slight_smile:

I’ll check that out sometime. I just looked at the one remaining instance of “in the presence,” from an actual action description, and I’m amazed how many trivial tests are performed:

 if (((((action ==##A132_x) &&  (actor==player) && (((I149_y == I149_y) && (true))&& (TestScope(I149_y, actor))))))) { ! Runs only while condition holds

And then it runs TestScope - doesn’t that loop over the entire scope? Remind me not to use that in frequently consulted rules!

Yes, “in the presence” is a scope test. You might be able to use a simpler location test, depending on your game.

(I don’t know why the (I149_y == I149_y) test is in there, but I think I6 optimizes out the &&true test, at least…)