inform7

Global visibility of another person in Inform7?


In a segment of a project I am working on for college, it is asked that one is able to steer another person using a kind of a walkie-talkie. However this requires some kind of global access to the person one should be able to control like that. One could probably do one of the following:

Unfortunately I was unable to find anything like that in the documentation (visibility is only lighting in one room, reachability only opening/taking something out of something). Another way I thought of was saving the origin room of both, place them in one secret room, c1 then asks c2 to try doing something, both are placed to their positions, and the action asked for is carried out by c2.
However writing this as a before rules does not work, because it is already cancelled by the default check rule. On the other hand I cannot write:

Check asking c2to try doing something

because that is to general.
Any ideas, approaches or solutions are welcome!


Solution

  • The concept you're looking for is "scope" (Writing with Inform ch. 18.29.) The following places "c2" in scope and therefore makes it accessible everywhere:

    After deciding the scope of the player:
        place c2 in scope.
    

    You can also make it conditional:

    After deciding the scope of the player when the player is carrying the walkie talkie:
        place c2 in scope.
    

    The rest is fine tuning. The following prevents commands that aren't logical when c2 isn't physically in the same space (like "look at c2"):

    Before doing something to c2 when c2 is not in the location and not answering c2 that:
        say "C2 isn't here right now. You can tell it what to do through the walkie talkie by commanding for example C2, JUMP." instead.
    

    This one prevents the "You can't reach into..." error when the issued command is invalid:

    Before answering c2 that:
        say "C2 doesn't understand that command." instead.