I have a non-player character in an Inform 7 Interactive Fiction story that I would like to get a simple reply from. The character is a robot doctor. When you get on the exam table the robot doctor holds out a tongue depressor and asks you to say, "Ah." I would like the character to say something when the player types, "say ah" but so far it's not working.
Here is my code thus far:
The exam table is a supporter in the Med Bay. It is fixed in place and enterable.
In the Med Bay is a person called Auto-Doc.
After entering the exam table, say "A number of bright lights embedded in an overhead panel bathe you in a cold, white light. A panel in the wall opens and an auto-doc trundles forth on a three-wheeled base. Clutching a tongue depressor in its mechanical grip, a small speaker hidden within crackles with the words 'Say, ah.'"
After speaking in the presence of the Auto-Doc, say "Mmm. Mm-hmm. Very interesting."
The last line is causing the compiler to throw an error, but I am unable to figure out what to use. I've tried Instead of speaking, After telling the Auto-Doc something, After saying ah in the presence of the Auto-Doc, and so far nothing is working.
Any hints as to how I can get the Auto-Doc to say something after the player types "say ah"? I'd even be happy with the Auto-Doc replying the same way no matter what the player says.
Here's a handy tip: command ACTIONS while playing the game in the IDE to see the action name when you type commands.
>actions
Actions listing on.
>say ah
(to Auto-Doc)
[answering Auto-Doc that "ah"]
There is no reply.
[answering Auto-Doc that "ah" - succeeded]
>
So the rule you're looking for is:
Instead of answering Auto-Doc that "ah":
say "Mmm. Mm-hmm. Very interesting."
After some more research, I have discovered that the responses understood by Inform are yes, no, and sorry. So understand "ah" and "say ah" as saying yes. followed by Instead of saying yes in the presence of the Auto-Doc, say "Mmm. Mm-hmm. Very interesting." is one way to do it.
Here's what the code looks like now:
The exam table is a supporter in the Med Bay. It is fixed in place and enterable.
After entering the exam table, say "A number of LEDs embedded in the ceiling switch on, bathing you in a cold, white light. A panel in the wall opens and an auto-doc trundles forth on a three-wheeled base. Clutching a tongue depressor in its mechanical grip, a small speaker hidden within crackles with the words 'Say, ah.'"
In the Med Bay is a person called Auto-Doc.
Instead of saying yes in the presence of the Auto-Doc, say "Mmm. Mm-hmm. Very interesting."
Understand "ah" and "say ah" as saying yes when location is Med Bay.
Instead of saying no in the presence of the Auto-Doc, say "Hmm..."
This sets up two different non-committal responses for saying yes and no. Saying 'ah' is understood as saying yes, so the player gets a response.
Related
I have an action, throwing, which is understood using "throw/chuck/lob/etc."
I have a noun, the log, which is understood using "log/trunk/wood/etc."
You can throw things, and throwing the log should behave the same as any other throw action... except when the user types the specific phrase "chuck wood", where the response should be "How much wood could a woodchuck chuck?".
Hilarious, I'm sure you'll agree!
In a similar vein, I want to respond to "throw party" with a special response; However, in this case party is not a noun in the game, so it should not be recognised in any other context and I don't really want to create a dummy object for it.
How do I implement the responses above?
Do I need to use a different technique for the first and second case (i.e. where the noun is an object in the game vs. when it is just 'some text' with no associated object)?
How do I implement the responses above?
After reading a command:
if the player's command matches "throw party":
say "I'll bring the appetizers!";
reject the player's command;
if the player's command matches "chuck wood":
say "How much wood could a woodchuck chuck?";
reject the player's command.
See §18.33. Reading a command for more info.
Do I need to use a different technique for the first and second case?
Apparently not. In fact the verb need not even be a real action (if the player's command matches "xyzzy" …)
I have the following string:
dt <- "I feel the night explode When we're together Emotion overload In the heat of pleasure Take me I'm yours into your arms Never let me go Tonight I really need to know Tell it to my heart Tell me I'm the only one Is this really love or just a game Tell it to my heart I can feel my body rock Every time you call my name The passion's so complete It's never ending As long as I receive This message you're sending Body to body, soul to soul Always feel you near So say the words I long to hear Tell it to my heart Tell me I'm the only one Is this really love or just a game Tell it to my heart I can feel my body rock Every time you call my name Love...love on the run Breaking us down Though we keep holding on I don't want to lose No...I can't let you go... Tell it to my heart Tell me I'm the only one Is this really love or just a game Tell it to my heart I can feel my body rock Every time you call my name Tell it to my heart Tell me from the stars Tell it to my heart Tell it to my heart Tell me from the stars Tell it to my heart Never make it stop Oh take it to the heart Oh no no ah ah Tell it to my heart Tell me I'm the only one Is this really love or just a game Tell it to my heart I can feel my body rock Every time you call my name"
I tried
unlist(strsplit(dt, split = "[[:upper:]]"))
but it takes out the capital letters.
I want to split it so that each string starts with a capital letter. For example,
"I feel the night explode",
"When we're together",
"Emotion overload", etc.
Is there a way to split it like that? Thanks!
You need to make use of "lookarounds"
x <- "I feel the night explode When we're together Emotion overload In the heat of pleasure Take me I'm yours into your arms Never let me go Tonight I really need to know Tell it to my heart Tell me I'm the only one Is this really love or just a game Tell it to my heart I can feel my body rock Every time you call my name The passion's so complete It's never ending As long as I receive This message you're sending Body to body, soul to soul Always feel you near So say the words I long to hear Tell it to my heart Tell me I'm the only one Is this really love or just a game Tell it to my heart I can feel my body rock Every time you call my name Love...love on the run Breaking us down Though we keep holding on I don't want to lose No...I can't let you go... Tell it to my heart Tell me I'm the only one Is this really love or just a game Tell it to my heart I can feel my body rock Every time you call my name Tell it to my heart Tell me from the stars Tell it to my heart Tell it to my heart Tell me from the stars Tell it to my heart Never make it stop Oh take it to the heart Oh no no ah ah Tell it to my heart Tell me I'm the only one Is this really love or just a game Tell it to my heart I can feel my body rock Every time you call my name"
v <- unlist(strsplit(x, split = "(?=\\s[A-Z])", perl=TRUE))
v <- v[v!=" "]
head(v)
# [1] "I feel the night explode" "When we're together"
# [3] "Emotion overload" "In the heat of pleasure"
# [5] "Take me" "I'm yours into your arms"
ooh_yeah_baby_baby <- "I feel the night explode When we're together Emotion overload In the heat of pleasure Take me I'm yours into your arms Never let me go Tonight I really need to know Tell it to my heart Tell me I'm the only one Is this really love or just a game Tell it to my heart I can feel my body rock Every time you call my name The passion's so complete It's never ending As long as I receive This message you're sending Body to body, soul to soul Always feel you near So say the words I long to hear Tell it to my heart Tell me I'm the only one Is this really love or just a game Tell it to my heart I can feel my body rock Every time you call my name Love...love on the run Breaking us down Though we keep holding on I don't want to lose No...I can't let you go... Tell it to my heart Tell me I'm the only one Is this really love or just a game Tell it to my heart I can feel my body rock Every time you call my name Tell it to my heart Tell me from the stars Tell it to my heart Tell it to my heart Tell me from the stars Tell it to my heart Never make it stop Oh take it to the heart Oh no no ah ah Tell it to my heart Tell me I'm the only one Is this really love or just a game Tell it to my heart I can feel my body rock Every time you call my name"
unlist(stringr::str_split(ooh_yeah_baby_baby, "(?=\\p{Upper})"))[-1]
I'm very, very new to this language, and wrapping my head around "how to do things with stuff" is proving to be a very frustrating endeavor.
My goal here is to create a mechanic where certain rooms are dangerous, and become more dangerous the longer the player stays in them. If the player stays in a dangerous room for too long, a death scene is triggered.
I've got code that looks like this:
[The "danger rule"]
A room has a number called danger level. The danger level of a room is usually 0.
Definition: A room is dangerous if its danger level is 1 or more.
Definition: A room is deadly if its danger level is 9 or more.
Every turn (this is the increasing danger rule):
If the player is in a dangerous room:
Increase danger level by 1.
Every turn (this is the death by danger rule):
If the room is deadly:
do nothing.[Later...]
Every turn (this is the danger explanation rule):
say danger level.
[further down]
The Feeding Chamber is south of the dungeon."You enter a large, dimly lit room with straw on the floor, surrounded by various cages embedded in the wall.[line break]Blood spatters are all over the floor, and it looks as if there's been a fight recently". After going to the feeding chamber for the first time:
try looking;
say "It smells like grues around here. I would be careful if I were you..";
The Feeding Chamber has danger level 5.
I can't seem to figure out how to properly work with the "danger level of a room". The explanation rule I defined causes a runtime error when entering a dangerous room:
`*** Run-time problem P31: Attempt to use a property of the 'nothing' non-object: property danger level`
..And attempts to re-word the rule to something like the danger level of the room or the danger level of this room lead to perplexing compilation messages such as:
`In the sentence 'say the danger level of the room' , it looks as if you intend 'danger level of the room' to be a property, but 'a room' is not specific enough about who or what the owner is.`
What is the "right" way to reference properties of objects in this way?
The magic words here were "of the location". If we pretend that that this was another programming language for a moment, the way I was writing this was as if I was referring to a class "the room" rather than an instance of the class currently being referenced "the location".
The working rule is as follows:
Every turn while the player is in a dangerous room:
Increase danger level of the location by 1.
The trick is to give Inform enough information to know which particular thing you're referring to. The problematic sentence in the original question is perfectly valid english that a human could parse, but the computer needs a bit more help in determining what room we mean when we say "the room".
When the player character goes into the Staffroom at the orphanage/boarding school they live at, said player has two turns before they hear the manager's footsteps coming down the hall and they are urged to hide. I've done this through use of number variables. At this point I have another number variable (set up like a true/false thingy by only using 0 and 1) to govern whether or not trying to do anything except 'hiding' or 'hiding wrongly' gives the response 'There's no time for that, just hide!'. The problem is this: Whenever I start the game, ANY ACTION is rejected and met by 'There's no time for that, just hide!'.
Code:
NOTSITS is a number variable.
When play begins:
now NOTSITS is 0.
Every turn when the location is the Staffroom:
increase NOTSITS by 1.
Every turn when the location is the Staffroom:
if NOTSITS is 2:
now HYF is 1;
say "From the hall outside, you hear footsteps... Shit, that sounds like Rodger![paragraph break]HIDE!".
HYF is a number variable.
When play begins:
now HYF is 0.
Every turn :
if HYF is 1:
instead of doing anything other than hiding or hiding wrongly:
say "There's no time for that, just hide!".
Hiding is an action applying to nothing.
Understand "hide" as hiding.
Hiding wrongly is an action applying to one thing.
Understand "hide in [something]" as hiding wrongly.
Instead of hiding:
try entering the empty cupboard;
now HYF is 0.
Instead of hiding wrongly, say "Don't waste time with stupidity, just hide!"
Please don't suggest using Inform 7's own time system to solve this. I tried that and it was a far bigger shizztorm of problems than this has been.
I think the problem is that you're relying too much on every turn rules, but they run after the actions have all been processed, so it's too late for them to do what you want them too. I also defined hiding as a synonym for entering, because that action already exists, and it's what you want to happen. So try this instead:
First turn is a truth state variable. First turn is true.
The staffroom is a room.
In the staffroom is an enterable container called the empty cupboard.
Understand "hide" as entering.
Carry out entering when first turn is true:
now first turn is false;
Understand "hide in [something]" as a mistake ("Don't waste time with stupidity, just hide!").
Instead of doing something other than looking or entering when first turn is true:
say "There's no time for that, just hide!";
(Also in the future it will help if you provide the full source code, or at least all that's relevant. This time you left out the staffroom and cupboard.)
You can specify an action and its time of appearance after entering a room:
After going to Staffroom for the first time:
manager comes in three turns from now.
At the time when manager comes:
YOUR STUFF
"The events depicted are artificial in that processes do not always experience them, but they illustrate various state transitions."
I am unable to understand the perfect meaning of this sentence. I assume this is because of I am not native English speaker or I don't have much experience about processes and their states. What the above sentence tries to convey? Is it saying that The process which is first time experiencing the state will consider it as artificial or some thing more. Kindly guide me so that I am able to clear what is the meaning of this sentence. Following is the some more information about the line. Following will help you to find the line in book if you want to read the other sentences with this sentences.
Name of the Book: "The Design of the UNIX operating system"
Author : "M.J.Bach"
Chapter : " 6 - The Structure of Processes"
Page number : "147"
Topic : "6.1 - Process states and transitions"
paragraph number : "2 from the beginning of the page"
Line number related to paragraph : "2 line in paragraph."
I don't have my copy of Bach handy at the moment, so I may be a bit off base on what I remember, but I think what it is trying to say is that it may help conceptually to think of a process going from state A to state B and then to state C, but a real-world OS may choose to go directly from A to C and just perform the steps for both transitions at once, because there may not be any real reason to actually have a state B and allow processes to live in that state.