Help creating a virtual patient

Hi all:

I’m an eye doc trying to use Inform 7 to create scenarios for docs in training.
The plan is to create a bunch of patients with acute eye problems.
I have a bit of programming experience but I’m new to interactive fiction (except as a player of Infocom games).

I’d like some advice about how to proceed with a number of things.
I don’t generally have a problem with messing around until I find something that works but I’d like to do things the “Inform way” if I can. I really have looked over the documentation.

More details about the concept.
This will probably be a one room story.
The setting is an exam room in an emergency dept.
There’s a patient there.
She’s come in because she’s lost vision in one of her eyes.
I’d like the player to be able

  • to ask her questions
  • then proceed to examine her
  • then proceed to order appropriate tests
  • then to prescribe treatment

I’ve got a few things working.
I need help with some others.

Starting with the history, I want the player to be able to ask the patient questions about a number of things.
I understand that I can simply have a bunch of

Instead of asking Mable Barnett about "weight loss": say "Actually my clothes have been a little looser lately."
kinds of statements.
I could also create a table of topics and replies.

topic reply points "headache" "'Well, now that you mention it. I have had a headache over the last few weeks." 1 "weight loss" "'Actually my clothes have been a little looser lately." 1 "her foot" "I can't see from my right eye. Why in the world are you asking me about my feet?" 0
That will also give me the ability to give the player points when they ask relevant questions.
When they accumulate enough points I’ll let them go on to the exam.

What’s the best way to deal with all of the sensible synonyms?
Ask Mable about weight loss? weight? her weight?
Ask Mable about her feet? feet? foot? her right foot?
Is this going to be a matter of an endless number of understand statements?

etc.

Thanks
Jake

You can provide the options uses slashes and/or “or”, e.g.:

topic
“weight” or “her weight” or “weight loss” or “her weight loss”
“her feet/foot” or “feet/foot” or “her right foot” or “her left foot”
etc.

You can get more flexible parsing by using objects rather than topics–see Eric Eve’s conversation extensions (you probably would need only the most basic configuration).

–Erik

Moving right along with this project.
I’ve continued to wrestle with the objects vs topics question for different entities for the virtual patient.
Answers to history questions seem like natural topics rather than objects.
Body parts to examine seem like they could be objects with descriptions.
Diagnoses and treatments don’t seem like a natural for either.

Are there disadvantages to using values for these?
For instance,

A treatment is a kind of value.
Prednisone is a treatment.
Bed rest is a treatment.
Observation is treatment.
Meds is a list of treatments that varies.
Prescribing is an action applying to one treatment.
Understand "Prescribe [treatment]" as prescribing.
Carry out prescribing:
  add the treatment to Meds;
  say "You have now prescribed [meds].".

This seems like the right approach. Inform barfs on the add the treatment to Meds;phrase though. What am I missing? How do I get the subject of the prescribing verb into the instructions for carrying out prescribe?

Thanks

The main disadvantage to using values is that the player can only enter one value at a time, whereas she can enter two objects; the same is true of topics. E.g., the command “prescribe prednisone and bed rest” is only possible if you’re using objects. Otherwise, with values you can use “understand” statements to expand the vocabulary as with objects (see the bit of code below), and you can more easily manipulate the values than you can topics.

The reason that you couldn’t add the treatment to the list of meds is that you need to say “the treatment understood” rather than just “the treatment” so that Inform knows you’re referring to the treatment input by the player:

[code]A treatment is a kind of value. The treatments are prednisone, bed rest, and observation.

Understand “sleep” as bed rest.

Meds is a list of treatments that varies.

Prescribing is an action applying to one treatment. Understand “Prescribe [treatment]” as prescribing.

Carry out prescribing:
add the treatment understood to Meds;
say “You have now prescribed [meds].”[/code]

–Erik

Thanks Erik.
That worked.
Is there a way to understand why understood is needed for values and not objects?
I think I’ll stick with values. It seems more natural than having to declare a diagnosis or treatment as present in the room and then having to worry about suppressing the descriptions.

Well, “ understood” or “topic understood” is conceptually equivalent to “noun”/“second noun”: The principle is the same, it’s just that with objects there can be more than one object understood, hence the need to distinguish using noun and second noun. In other words, you can’t say “if the object is held by the player” in an action rule and expect Inform to understand it; you need to say “if the noun is held…” (or “if the second noun…”).

Whatever you’re comfortable with; aside from the limitation I mentioned and the fact that values may require more “understand” declarations than objects, they will work similarly.

If I were going to use objects, though, the method you describe is definitely not how I would do it. Eric Eve’s Conversation Framework extension, which I think I mentioned up-thread, illustrates how to create commands that refer to any object in the game, not just objects that are in the room–that’s the method I’d use.

–Erik

Thanks again Erik.
I’ve used Eric Eve’s built in Epistemology extension and turned everything: interview questions, exam findings, diagnoses, treatments, etc into subjects. Doing so helped me to clean up my code and make it more consistent from section to section. I didn’t see anything in the other EE conversation extensions that I needed (I think).

What did you mean by

?

Is there a shortcut for synonyms for objects that doesn’t exist for values?

Glad to hear it’s going well!

When you declare an object, Inform automatically allows each word in the object to refer to it independently, and also automatically disambiguates for you. So, two objects defined as:

cloudy left eye
clear right eye

…will automatically produce the following output:

To do the same with values, you’d need to use some extra understand statements (e.g., Understand “cloudy” or “cloudy eye” or “right eye” or “right cloudy eye” as the cloudy right eye), and probably a dummy value (for “eye” alone) that would make clear that more specific input is necessary (since Inform won’t auto-disambiguate values).

–Erik

Interesting.
That presents new problems though.
I guess I didn’t realize that the whole “or” and “/” thing isn’t supposed to be used for naming objects in table.

Table of Interview Question Definitions interview question importance response headaches or head pain important "Why yes I have been having headaches." chest pain unimportant "No, I haven't had any chest pain." eye pain important "No, my eyes don't hurt at all."

asking about “pain” leads to

and asking about “or” ends up referring to headaches.
Is there a way to get synonyms into a table without this complication.

Is there a way to get inform to spit out

when asking about “pain”

Never mind. Got this one on my own.
I created an extra text property for the printed name and a name printing rule to go with it.