I am trying to implement a ‘call’ verb, to call people using a mobile phone:
Calling is an action applying to one thing. Understand “call [any thing]” as calling.
I’m using “any thing” because that should allow the object of the verb to be a person who is not in the same room.
I’ve implemented the people I’m trying to call, but not given them any location:
Mum is a person.
Mr Smith is a person.
but when I try:
call Mr Smith
He’s not available.
Why? because “off-stage”?
So, I changed to
Mr Smith is a person. Mr Smith is in limbo.
Mum is a person. Mum is in limbo.
Limbo is a room.
and the response:
You can’t reach into limbo.
So, how to define a command that needs to refer to things not present? I thought I’m doing like the manual instructs.
You need to define the action as applying to one “visible” thing:
Calling is an action applying to one visible thing.
“Visible thing” encompasses more than “thing” in this context–“thing” is effectively “touchable thing,” which means that as you have it, the action invokes the reaching inside rules.
This is an absolutely perennial issue that people have, because Inform’s terminology is confusing here–it seems like visible thing is more restrictive than “thing,” but it’s really less restrictive. My attempt at a comprehensive explanation is here (you might also want to scroll up and down that thread).
BTW, it’s helpful to put your code in code tags–hit the “code” button and paste your code in between the tags that look like
Your code here.
OK thanks Matt for the help!
BTW once you’ve got that in place you don’t need the Limbo room. I think the difference between off-stage things and things in another room is just that you get a different message when the reachability rules fail.
Ok, I get the thing about needing someone to be “visible” in order to call them on the phone. Now what I’m trying to do is to make it so you can talk to the person, asking and telling them things as if they were actually in the room with you. I want this to be possible if and only if you’re actually on the phone with them. I tried placing the NPC “in scope”, but this doesn’t seem to achieve anything. Here’s what I’ve got so far:
[code]Calling is an action applying to one visible thing.
Understand “call [any thing]” as calling.
Instead of calling anyone when the noun is visible: say “[noun][apostrophe]s right here!”
Instead of calling anyone when a touchable phone is ringing: say “You had better answer that first!”
Instead of calling anyone when no phone is touchable: say “There’s nothing here to call [noun] on.”
Carry out calling anyone when a phone is touchable:
say “You pick up the receiver and dial the number.[line break]”;
wait for any key;
say “‘Hello?’[line break]
‘Hey, it’s Joe.’[line break]
‘Hey. What’s up?’”;
place the noun in scope.[/code]
Looking through the forum, I didn’t really find anything that specifically dealt with changing the scope of an object for an extended period of time, if it’s even possible. Hopefully this is a relevant place to ask this question since we’re already discussing phone conversations.
See if this Recipe Book entry regarding Telephones helps any:
The “Four Cheeses” example begins to explain the scoping issue, though I believe it takes more work depending on the needs of your game. It’s a good starting point.
The Recipe Book is also part of the documentation in the IDE if you want to click the buttons to experiment with the examples.
Specifically about your code, “place… in scope” doesn’t work in action rules like “carry out”; scope is used to let the parser figure out what words it should understand when converting the command into an action, so by the time you reach the action-processing stage, it’s too late to change scope.
So “place… in scope” can only be used in rules for the deciding the scope of activity. (Almost always, in “after deciding the scope of the player” rules.)
That means you can’t do something like placing something in scope and leaving it there. But you can key your After deciding the scope of the player rule to some state, and then the object will be put in scope as long as the state holds. That’s what Four Cheeses does–it has an “After deciding the scope of the player when the player reaches someone” rule, which keeps the thing in scope as long as “the player reaches someone” (where “reaches” is a relation that was defined in the example, and gets set when the player first makes the phone call).
Hey guys! Thanks for the advice. As a beginner, I found the documentation to be mostly incomprehensible and overwhelming, so I’ve mostly avoided it thus far. Now that I understand what’s going on a little better, I found the example to be pretty useful.