To get something with something will mean needing another action that takes two nouns.
Getting it with is an action applying to one visible thing and one carried thing.
Understand "take [something] with/using [something]" as getting it with.
Understand "get [something] with/using [something]" as getting it with.
“Carry” and “hold” are straight-up aliases of “take” but “get” isn’t, so we need to add an Understand line for “get”, too.
We don’t want to try to rewrite the taking action – it has lots of check rules that we’d end up wanting to duplicate – better to just redirect to it, which you can do with a before rule. Conveniently, this happens before the basic accessibility rule, so we don’t have to worry about it being blocked. So, Before assisted-taking the key with the stick, instead try taking the key.
… but whoops, but now we’re back up against taking failing because of the accessibility rule. So we’ll fall back on setting a global variable to make it work. But because we’re doing this before accessibility, we have to ensure the stick is carried ourselves:
Getting-key-with-stick is initially false.
Before getting the key with the stick:
unless the stick is carried, carry out the implicitly taking activity with the stick;
if the stick is carried begin;
now getting-key-with-stick is true;
instead try taking key;
end if;
The can't reach outside closed containers rule does nothing when getting-key-with-stick is true and the player is in the jail cell.
And we need to turn that setting back off…
After taking key when getting-key-with-stick is true:
now getting-key-with-stick is false;
continue the action;
By default, any After rule stops the action, meaning the Report rules aren’t reached, so we continue the action
.
Since we also want to point the player toward get key with stick
we’ll use a before taking
rule. Since that happens before the basic accessibility rule, we don’t need to worry about the accessibility rule blocking the action with its own message. By default, one can get things in the room when in an open enterable container, but allowing this would undermine the premise that the key is out of reach, so we’ll take care of both of these cases.
Before taking the key when the player is in the jail cell and getting-key-with-stick is false:
say "It's out of reach. ";
if the jail cell is open, instead say "[We] [would have] to leave the cell.";
instead say "[We] [would need] to get the key [italic type]with[roman type] something."
So now things are basically working, but we end up with the plain old “Taken.” reporting line. So let’s rewrite that After rule.
To reach is a verb.
After taking key when getting-key-with-stick is true:
now getting-key-with-stick is false;
if the player is in the jail cell and the jail cell is closed and the key is not in the jail cell, say "[We] [reach] through the bars with the stick and get the key.";
else say "The stick was gratuitous, but [we] [get] the key."
This time we don’t continue the action because we want to avoid the default Report rule. We also handle the case of a smart-aleck player doing get key with stick
elsewhere. We checked that the key is not in the jail cell in case the player had dropped it within the jail cell after the fact. We don’t check that it’s really in the Sheriff’s Office, because scope handling got is that for free.
But we haven’t done anything about any other uses of get thing with thing
. There should be some sort of default message. And maybe automatically redirecting to ordinary taking. And we’ve said the key is out of reach when you’re in the cell, but that’s not true about anything else – anything from the jail cell could be taken from the sheriff’s office and anything but the key could be taken from the sheriff’s office while in the jail cell. So we might want a message for that.
And what about dropping the keys in the Sheriff’s Office after the fact? Then they might or might not be in reach without the stick. So maybe establish that there’s a hook and have the key automatically get put back on the hook when dropped in the Sheriff’s Office.
And currently if you get the key with the stick when the jail cell is open you get the “The stick was gratuitous” message. Maybe something else is more appropriate.
And there are probably other things I haven’t thought of. Modeling the world is tricky.