So I want a phone to start ringing a few turns after it has been mentioned/seen. My code isn’t complete but this is what I’m looking at right now:
your phone is a mobile, which is a kind of thing that I have attached the property ‘ringing/not ringing’ to help identify each turn if the phone needs to be answered. The Call is the scene it takes place in.
[code]Before printing the name of your phone:
your phone rings in 2 turns from now.
At the time when your phone rings:
now your phone is ringing.
Every turn during The Call:
If your phone is ringing, say “VRRR VRRR! [The phone] vibrates, somebody is calling you.”.
The problem is this will set the timer every single time the phone is mentioned, so I tried attaching the clause ‘for the first time’ so I’d have:
Before printing the name of your phone for the first time:
This wasn’t working (I think this clause is for actions, not rules?)
How should I proeceed?
My next question is the next step:
I have code for answering the phone, an uncomplicated check-carry out but, I don’t know how I should launch into a dialog, especially if I want to be able to have multiple phone calls… Should I set up a scene just for the phone call (if so how do you trigger it?)
So I solved the first problem, really easily…
Before printing the name of your phone:
If your phone is not seen:
Now your phone is seen;
your phone rings in 2 turns from now;
My current problem is triggering a scene when the phone is answered (If indeed that is the best way to print some text)
The Conversation begins when answering.
however this will still begin the scene when answering fails, like trying to answer a wallet
You could try something like this. (No doubt it can be improved upon.)
[code]Someplace is a room.
The phone is a thing. The player carries the phone.
The player carries a wallet.
The phone can be quiet, ringing, or connected. The phone is ringing.
Every turn when the phone is ringing and the phone is visible:
say “VRRR VRRR! [The phone] vibrates. Somebody is calling you.”.
Answering it is an action applying to one touchable thing.
Understand “answer [thing]” as answering it.
Check answering it when the noun is not the phone:
say “[The noun] [aren’t] something you can answer.” instead.
Check answering it when the noun is the phone and the phone is not ringing:
say “Your phone isn’t ringing. There’s nothing to answer.” instead.
Carry out answering it:
now the phone is connected.
Phone Conversation is a scene.
Phone Conversation begins when the phone is connected.
Phone Conversation ends when the phone is quiet.
When Phone Conversation begins:
Test me with “scenes / answer wallet / answer phone”.[/code]
*Edited to add a wallet and a test script.
[code]A phone is in the study. The description is “It’s an odd phone.[phonecall]”
Phonerang is a truth state that varies.
To say phonecall:
if phonerang is false:
now phonerang is true;
ominous phonecall happens in three turns from now.
At the time when ominous phonecall happens:
say “The phone rings ominously. You pick it up. The caller says ‘[italic type]I’m calling from inside the house…[roman type]’”[/code]
That’s not exactly what you want since you want the phone to keep ringing, but that’s another way to trigger future events within a description with a “to say…” token in brackets inside quoted text.