How can I create a report message for trying to access an object that is out of scope

In my game, the player has to access files from a computer. What I’d ideally like the behavior to be is:

Instead of doing something to the research files while the old pc is not visible:
	say "Files can only be accessed from a computer.";
	rule fails;

“Research files” is a thing in the computer room, btw.

Trying to run the game, however:

>read files
You can't see any such thing.

>examine files
You can't see any such thing.

I’ve tried using RULES to see at what point the parser is when ‘You can’t see any such thing’ gets triggered (I had RULES on in the above example), and I’ve even tried having an Every turn rule that places the research files in scope, but neither fixed the issue.

You’re thinking along the right lines, since to avoid the ‘you can’t see any such thing’ parser response and generate an action you can trap with your ‘instead’ rule, the files need to be in scope. This isn’t done with an ‘every turn’ rule, but with an ‘after deciding the scope’ rule:

After deciding the scope of the player:
	place the research files in scope.

An alternative would be to make the research files a part of the old pc, so that they are always in scope when the pc is in scope and vice versa, but this wouldn’t avoid the ‘you can’t see any such thing’ when the pc was elsewhere unless you also placed the research files in scope at all times as indicated above.


PS you don’t need to append ‘rule fails’ to the end of an instead rule: every instead rule fails by default. You do need to append ‘continue the action’ if you don’t want an instead rule to fail.

This almost gets me where I want to go. Unfortunately now it applies the “can’t reach inside rooms rule” instead of the rule I’ve made, but! Now it just goes to the “can’t reach inside rooms rule” rule. I’m thinking I could name my Instead rule and place it before that rule in the rulebook it’s in, but I’m having trouble finding where exactly it’s listed (RULES is no help here).

The “can’t reach inside rooms rule” is one of the accessibility rules, which run between the Before and the Instead rules to make sure the action is physically feasible. If you put your error message in a Before rule, it’ll intervene first. (But you will then need “rule fails” or “stop the action”, since Before rules don’t stop the action by default.)


Yes! That worked!

When I did try to place the rule, I got an error to do with object-based rules and instead rules (I’m going to have to look into the differences between rules at some point).

Problem. You’ve asked to put the rule ‘block access to files outside of computer room rule’ into the rulebook ‘Reaching inside’, which is based on an object and produces nothing; but it was originally written to go into a rulebook of a different kind, ‘Instead’, which is based on an action name and produces nothing. Because those kinds are different, ‘block access to files outside of computer room rule’ can’t go into ‘Reaching inside’.

Is there some sort of hidden way to show which rulebooks are currently being gone through while debugging? An extension or something? Cause it would be really helpful to see that detail for learning the language and figuring stuff out.

That would be the RULES testing command. You can also see an overview in the Index tab!

The RULES testing command doesn’t mention which rulebooks the rules are in. You just get a flat list.

Also, the Index isn’t searchable… you have to hunt and peck at disclosure buttons to figure out where the author of an extension may have put a specific rule, which can be really annoying.