I have a room with a number of enterable supporters, some of which can be accessed from a number of the others. What is a clear, concise and exhaustive way of writing a reaching outside rule, when there is access to a number of supporters from one of the other supporters?
One thing I did in one of my games (which is now in the Comp), which has a similar situation, is I had a separate routine, which was accessed when the player was on a supporter (these were movable supporters, which made it complicated)âit would gather up a list of objects (including other supporters which may be nearby) that were reachable, which included objects that were on/within other objects. Then, if any of the objects in the playerâs command required touchability, and were not on that list, access was denied. But I donât know if this is an efficient way to do itâŚ??
Oreach is a list of objects which varies. Oreach is {nothing}.
To objectsreachable:
if the holder of the player is:
-- the swivel chair:
now oreach is {the file cabinet, the small picture window, the iron desk};
repeat with n running through things which are on the iron desk:
add n to oreach.[âŚ.]
A rule for reaching outside of the swivel chair:
objectsreachable;
if putting something on something:
if the second noun is listed in oreach:
allow access;
otherwise:
say "You will have to get off your lazy duff, first.";
deny access;
otherwise if inserting something into something:
if the second noun is listed in oreach:
allow access;
otherwise:
say "You will have to get off your lazy duff, first.";
otherwise if the noun is listed in oreach:
allow access;
otherwise if throwing something at something:
if the noun is listed in oreach:
allow access;
otherwise:
say "You will have to get off your lazy duff, first.";
deny access.
Mutual reachability relates things to each other.
The verb to be reachable from implies the mutual reachability relation.
To decide what object is the penultimate enclosure of (the item - a thing):
let the current level be the item;
while the current level is not a room:
let the current level be the holder of the current level;
decide on the current level.
Indirect reachability relates a thing (called X) to a thing (called Y) when the penultimate enclosure of X is reachable from the penultimate enclosure of Y.
The verb to be available to implies the indirect reachability relation.
Now you just have to establish the relationships:
The chair is reachable from the table.
[This automatically works in reverse, too! No need to specify the other direction.]
And then you can use them freely!
Rule for reaching inside a supporter (called the destination) when the player is enclosed by a supporter (called the source):
if the destination is reachable from the source, allow access;
deny access.
In your own rules, you also have a convenient shorthand now for âis this on a supporter reachable from the playerâs supporter?â:
I take it that if I want a denial message for, say, an apple on a chair, when the player is standing on a desk, I can say â
A rule for reaching outside of the oak desk:
if the noun is available to the player:
allow access;
otherwise:
say "You'll need to get off the desk, first.";
deny access.
Or do I need only the second clause (the denial) in a reaching outside rule for that specific supporter?
Then youâd want to change the âmutual reachabilityâ relation to ââŚrelates various things to various thingsâ (which makes it non-reciprocal). Probably give the relation a different name, too, since itâs no longer mutual.
I typically see an object that is on the floor of a room as unavailable to the player if the player is on a supporterâmost of the time. With these relations, how do I âdeny accessâ if the holder of the object is the room?
That would be a âreaching outsideâ rule, since itâs about the playerâs enclosure, not the targetâs. You can make a new adjective (âtallâ or such), then make a ârule for reaching outside a tall supporterâ that denies access.
I think I may have a bit of a misunderstanding about âreaching outsideâ rules, here. Is a reaching outside rule stopped when the rule gets to âallow accessâ or âdeny accessâ (then goes no further with the remaining clauses)?
I take it I will need to write separate reaching outside rules for each of my supporters, to deal with objects that are not on a supporter. I guess the question I have with this is, will the interpreter run through the reaching inside rules (the ones you showed me), first, before checking the reaching outside rules? The reason I ask is that I may have clauses in my reaching outside rules (for the individual supporters) that may stop the process. Exampleâthere are several other objects in the room (with the supporters) that are not reachable from any of those supporters (I donât want actions possible with these objects while the player is on one of the supporters). Can I write a rule like this â
The comfy chair is reachable from the oak desk.
Rule for reaching outside of the comfy chair:
say "You'll have to get off your lazy duff, first.";
deny access.
Will this allow the player to sit in the comfy chair, put objects on the desk, take them off, etc, and still prevent the player from fiddling with the portrait on the wall, or the rug on the floor?
âReaching insideâ rules determine if youâre allowed to touch things that are on a particular supporter (*). âReaching outsideâ rules determine if youâre allowed to touch things while youâre on a particular supporter (*). If either one denies access, the action will fail; they both need to allow it.
(*) Not just supporters, technically, but also containers, vehicles, even rooms!
Okay Daniel, one more question and I will leave you alone.
I am still struggling with this. Here is what I have so far (along with the reaching inside rules mentioned aboveâ
An officesupp is a kind of supporter. The oak desk, John's chair, the straight-backed chair and the comfortable chair are officesupps.
The oak desk is reachable from John's chair.
The oak desk is reachable from the straight-backed chair.
The oak desk is reachable from the comfortable chair.
A rule for reaching outside of the oak desk:
if putting something on something:
if the second noun is available to the player and the noun is available to the player:
allow access;
if the second noun is an officesupp and the noun is available to the player:
allow access;
if the second noun is available to the player or the second noun is an officesupp:
if the noun is enclosed by the player:
allow access;
say "[The second noun] is out of reach from your position on John's desk.";
deny access;
if inserting something into something:
if the second noun is available to the player and the noun is available to the player:
allow access;
if the second noun is an officesupp and the noun is available to the player:
allow access;
if the second noun is available to the player or the second noun is an officesupp:
if the noun is enclosed by the player:
allow access;
say "[The second noun] is out of reach from your position on John's desk.";
deny access;
if the noun is an officesupp:
allow access;
if the noun is available to the player:
allow access;
if the noun is not available to the player:
say "[The noun] is out of reach from your position on John's desk.";
deny access.
With this, so far, I have only been able to put things on the office (Johnâs) chair, but not take them off, if I am on the desk. I keep getting the message '[the noun] is out of reach from your position on the desk." Even though the noun is available, because the oak desk is reachable from Johnâs chair. I just canât figure out what I am doing wrongâŚ? is there some point where I have to outright say that the stuff on the chair is available to the player, when the player is on the desk?
Disregard the code I have above, I have changed it completely. Now what I have works, all except about âto be available to the playerâ. For some reason, when I put an object on a supporter, while standing on another supporter (both of which are reachable from each other) that object is not being marked as âavailable to the playerâ. While I have pasted your code into my project exactly, and made the office chair reachable from the oak desk, and I can put an object on the chair while standing on the desk, I cannot take the object back. I put some code into the reaching outside rule for the desk like soâ
say "[The noun] cannot be reached from your position on the desk,[if the noun is available to the player] though it was available[otherwise] because it's unavailable[end if].";
deny access.
I am getting ââŚbecause itâs unavailable.â Is there something missing??
Looking over this again, I might actually disentangle it from Reaching Inside/Reaching Outside in order to keep things cleaner. Or rather, Iâd hook it in at the end of the rulebook, but do all the processing separately.
Last reaching outside:
if the action requires a touchable noun and the noun is not available to the player:
say "[The noun] [are] out of reach.";
deny access;
if the action requires a touchable second noun and the second noun is not available to the player:
say "[The second noun] [are] out of reach.";
deny access.
This depends on âavailableâ working, so Iâll see about debugging that later. But this way you donât need a new reaching rule for every action.