I have some actions that depend on whether something is in the location, but the noun in question is always part of something else. How do I make this work? “If (the noun) is part of something in the location” compiles but doesn’t seem to do anything.
Both “if the noun is enclosed by the location” or “if the location of the noun is the location of the player” should work. If you need to check if the thing is directly in the location (and not, for example, in a container) you can use “if the noun is in the location or the holder of the noun is in the location”.
On a related point, is there a convenient way to test whether something is, directly or indirectly, inside something else, while ignoring things that are parts of something else? I have the following situation:
I am implementing a dimensional transmogrification apparatus. As everybody knows, simultaneous multiple dimensional transmogrification, while perhaps theoretically possible, raises a risk that it might warp the Einsteinian space-time watchamawhozit and cause the entire universe to collapse into the Black Hole of Calcutta. Accordingly, when the player tries to effect dimensional transmogrification, I want to check whether there is more than one object in the DTA; if so, it will abort dimensional transmogrification and generate an appropriate error message.
If I do this by testing whether the number of things in the DTA is greater than 1, the player can get around the restriction (and possible destroy the universe) by putting a container, which in turn holds one or more other things, into the DTA. Alternatively, if the test keys off the number of things “enclosed by” the DTA, the restriction will be violated even by a single object, if that object has parts (which is not what I want).
I think I can get where I need by the following approach:
- Generate a list of things enclosed by the DTA.
- Step through the list, testing each entry to see if it is a part of something; if so remove it from the list.
- Test the number of entries in the pared-down list to see if it is greater than zero.
This seems pretty cumbersome, and I was wondering if there is a more direct way to do it.
Sorry, the third step in the “cumbersome” approach should be testing to see if the number of entries in the list is greater than one.
You could try a definition:
[code]Definition: a thing is independent if it is not a part of something.
Every turn when the number of independent things enclosed by the DTA > 1:
say “Oh dear.”;
end the story saying “The universe has been destroyed”.
Thanks, Juhana. That sounds like an efficient way to do it.
Juhana’s method isn’t working for me. I’m writing a check rule about it, so it’s phrased in the negative, and it’s a type of noun, not a single thing. But anyway “if a (noun type) is not enclosed by the location” seems to always trigger.
What’s the check for, exactly? Something like “if a container is not enclosed by the location” is true when there’s at least one container somewhere else (so it’s the same as writing “if every container is enclosed by the location.”)
You can try this out to be sure, but I think you can phrase it as “if no K is enclosed by the location.” Otherwise, you’ll have to say “if the number of K enclosed by the location is 0.” If it’s a single condition by itself, you can say “Unless a K is enclosed by the location.”