I am using Inform 7 to make a game that is a bit conversation-heavy, but I’m using simple chat to do it simply because I haven’t found anything else that seems to work as well and as neatly. The problem is that I am having trouble with options that are like other options. For example, you can hold up the shop to steal something, or buy it. The snag is that the option you don’t choose stays in the menu and I have no idea how to make the shopkeeper remember which choice you made and react accordingly the next time you are there I also have no idea how to make a money system and enforce it in-game.
I read the instructions and found out you can type something as simple as “Deactivate Chat_node.” But this doesn’t seem to work - the script just gives me an error. here is a simple example of something that doesn’t work, the script works fine without the Deactivate line:
Report giving link to steal-Martian-coin: say "Palm the coin and put it in your pocket" instead.
Report giving text for steal-Martian-coin: instead say "[paragraph break]When nobody is looking you swipe the coin and slip it into your pocket, it should be worth a mint.”. Deactivate buy-Martian-coin. Carry out finding responses to steal-Martian-coin: link to its-time-to-leave-I-think-Martian-coin.
The phrase ‘Deactivate buy-Martian-coin.’ is not inside any rule. Phrases only work from inside a rule; they are meant to get processed only when the rules they belong to run. That is, it has to look something like this for instance:
Report giving text for steal-Martian-coin: deactivate buy-Martian-coin; instead say "[paragraph break]When nobody is looking you swipe the coin and slip it into your pocket, it should be worth a mint.”
Note that the ‘deactivate’ phrase needs to come before the ‘instead say’ phrase, since ‘instead’ will stop the rule from running after the very phrase it belongs to.
Mind if I usurp your topic so as not to clutter the board? It’s about the same thread title I would’ve chosen.
I’m a newbie IF writer with no programming experience, and menu conversations seem to be beyond my means. I need to make a door that can be gone through only once, and offers the player a choice of options [stay/leave], but ‘stop/continue the action’ seem incompatible… and this is just practice for the larger conversations I’ll need to write.
I seem adequately capable of reverse-engineering example sources, but the two examples included by the author and maintainer of Simple Chat are both tiny conversations, and moving a book to the player is just a little less than I need to figure it out.
Would anyone be willing to post examples of how they’ve used Simple Chat to carry out actions in the game world? Or, how else might I find how Simple Chat has been used to do things like prevent the player from moving?
I’ll tackle your first question, as it’s actually very easy to make simple chat do just about anything once you know where to put in the appropriate code. The trick is to put your desired actions in the “Report giving text for” rule of the desired chat node. Here’s a quick example.
Report giving link to opinion-node: say "Tell the gentleman your full opinion on the matters. ".
Report giving text for opinion-node:
say "'No sir, I don't like it!' you tell the man with no reservation.[paragraph break]He reacts by flinging a dollar bill at your face in disgust, then walks away. You catch the money in your hand as it gently falls down, and feel triumph.";
now dollar bill is carried by player;
now player is happy;
remove The Gentleman from play instead.
As you can see, you can treat “report giving text for” like other kinds of rules such as “instead of” or “before.” You simply list the things you want to happen, and the game will perform all of the desired actions once the chat node is triggered in conversation. Remember that no matter what you do, the last line still needs to have the word “instead” in order for simple chat to not print needless errors.
Now for your other question about using simple chat for door travel, it is possible. If you only need it for one door, that makes things even easier.
Bedroom is a room.
Questionable Door is a door.
Questionable Door is north of Bedroom.
Sinister Living Room is north of Questionable Door.
Doorask, door-yes, door-no are chat nodes.
Report giving text for doorask: say "You won't be able to come back after you go out there. Are you sure?" instead.
Carry out finding responses to doorask: link to door-yes; link to door-no.
Report giving link to door-yes: say "Yes, let's go. " instead.
Report giving text for door-yes:
say "Okay, here we go!";
now player is in Sinister Living Room instead.
Report giving link to door-no: say "No, I should stay for now. " instead.
Report giving text for door-no: say "You step away from the door." instead.
Instead of going north in Bedroom: run a conversation from doorask.
Instead of going south in Sinister Living Room: say "There's no way you're going back in there after that the dreaded panty-hose incident."
This is of course the simplest way to do this, and it should work in most situations. Your game might require a slightly different approach depending on what else is happening.
Beautiful, thank you. I should be able to figure out quickly now exactly where I went wrong.
Oh, 0k, thanks, I think I have it now. Also, that little hijack was very helpful, it might solve a big problem I’ve been having.
By the way I have been playing with the ‘Mood Variations’ module to make it so that talking to someone changes the way they react to you in future conversations, unfortunatly I don’t really understand the ‘interlocutor’ stuff - I’m not sure how I’m supposed to set it when there is more than one character in the game or room (and I get an error when I don’t use it). Is there a way to add or remove chat options for certain moods or when certain objects are carried (etc)? For example:
- Talk soothingly (only available when mood is ‘angry’)
- Give cheque (Becomes an option when you carry ‘Cheque for $4000’)
Also, is there any way I use it to affect standard descriptions of people?
(player types ‘look John’)
“John is the big rotund fellow who stands behind the bar, [when angry]he sees you looking at him and glares back furiously[or sad]he just doesn’t seem himself lately[at other times]he’s a cheery fellow and the patrons seem to really like him[end when].”
You need to define a ‘current interlocutor’ variable yourself, unless the conversation extension in use doesn’t (Eric Eve’s conversation extensions already do that but Simple Chat doesn’t).
If you have a ‘talking to’ action etc., a ‘before talking to’ rule should be a good place to set it.
The current interlocutor is an object that varies.
The current interlocutor is nothing.
Before talking to something: now the current interlocutor is the noun.
Also, you make ‘carry out finding responses’ rules conditional by adding when-clauses to them:
Carry out finding responses to hello Taxi Driver when the player carries the gun: link to you talkin to me.
(This may upset the order in which links are presented.)
That’s cool, is there a way to start a conversation from a different node or make it go in different ways depending on variables? For example, if the player talks to Jeff, can I set it so that when you talk to his wife she starts off saying “Oh, I heard you talking to Jeff!” Or something? It would make it easier to set up the murder-mystery I’m writing.
Rules generally will fire only under the conditions given in a when/while-clause. So you can have:
Report giving text for interview with Jenny when talked to Jeff is true and talked to Jenny is false and incriminating letter found is false: instead say "'Oh, I heard you talking to Jeff!'".
Another way, of course, is to put conditions in the output text:
Report giving text for interview with Jenny when talked to Jeff is true: instead say "'Oh, I heard you[if talked to Jenny is true][']ve been[end if] talking to Jeff[if talked to Jenny is true] since last time[end if]![if incriminating letter found is true] Yes, I did write that letter.'".
I hope that nobody minds that I’m asking questions in different threads, but I kinda have dyslexia so it makes it way easier for me to keep track of this stuff if I split it up into manageable chunks like Chat and Attack instead of having a mess of different questions I have to read through to find the right bit.
At the moment I’m starting to look at scripted chat events and trying to make chat change based on what is going on but I’m still struggling with scripting stuff. Is there a simple way to set some chat-nodes to on and others to off based on variables like male/female in a way that I can easily expand as I go on? I have been thinking about creating a cloned version of the ‘moods’ extension to change stuff in-dialogue based on a variable, would this work or is there a simpler way I’m missing?
I was also wondering, is it is possible to get it to instantly start a chat the first time you enter a room?
Sure. You just have to use any one of the numerous methods to trigger the conversation when the player enters the desired room. If you want to start the conversation without interrupting any of Inform’s usual movement processing, something like this should do it:
Last Report going to Waiting Room for the first time: run a conversation from hello-there.
Thanks, that works really well! Is there a way to activate and deactivate chat nodes based on variables? I’m having a tough time changing what people say and their moods based on events.
Well, I am not the most intimate with the inform 7 systems, so my initial suspicion is that you might not be able to do it without some condition checking of your own.
Perhaps you can make a phrase that toggles the nodes based on the necessary conditions? You will want to call this phrase just before the chat starts. Then you also call the phrase every time a chat node is processed.
The phrase is easy to make unless you are planning to use a really wild and complex set of condition checks. In this example, we have two nodes which can only be active when the character George is set to “irate.”
To check george's mood:
if george is irate:
now george-wheresthebeef is sc-active;
now george-tophats is sc-active;
now george-wheresthebeef is sc-inactive;
now george-tophats is sc-inactive.
Now you just type the name of the phrase (check george’s mood) in any part of the conversation code you need. I suggest you put it into most if not every “Carry out finding responses to” line before linking to anything. Like so:
Carry out finding responses to george-mad-hello: check george's mood; link to george-mad-apology; link to george-wheresthebeef; link to george-tophats.
Oh cool, thanks! That’s just what I wanted! I’ll try that soon. By the way, I am just experimenting with describing people before you meet them at the moment and have found you can do things like this and have it appear instead of their name, then get the game to understand a few key-words so you can talk to them:
Rex is in the London Arms Foyer. "A tall gentleman in a black coat stands to one side, smoking moodily."
Is it possible to change this description based on if you know Rex’s name or not and where Rex is? It would be nice if I could make it so the description changes to “Rex stands to one side, smoking moodily, his hand in the pocket of his coat.” If I have enough to do that I should be able to change it based on his mood too using IF commands.
I thought about using word replacement along the lines of this:
To say RexName:
if (the player knows his name);
say "A man";
But this is only really a partial solution that will need a lot of scripting and I don’t know how to trigger it. Could someone help me set it so that I can replace phrases like above, but also replace his whole description?
A say phrase is perhaps a bit over the top for that particular circumstance: what I’d do is a simple text substitution:
[code]Rex can be familiar or unfamiliar. Rex is unfamiliar.
The initial appearance of Rex is “[if Rex is familiar]A tall gentleman in a black coat[otherwise]Rex[end if] stands to one side, smoking moodily.”[/code]
In general, it’s only worthwhile to construct a say phrase if it expresses something a bit more complicated than is allowed in existing text-substitution markup, or if you’re going to be using that particular say phrase a lot.
If you have a name that changes based on a lot of different things (whether you know his name or not, how familiar you are with him), then a say phrase is definitely a good idea. You activate it like so:
[code]To say Rexmood:
if Rex is surly, say “blowing petulant smoke-rings”;
if Rex is angsty, say “smoking moodily”;
if Rex is lascivious, say “chain-smoking and ogling passers-by”;
The initial appearance of Rex is “[RexName] stands to one side, [Rexmood].”[/code]
Finally, if you want to turn the whole thing into a rule, the relevant activity is For printing a locale paragraph about Rex…
Cool thanks! How do I set Rex to familiar? I tried putting things like [set Rex familiar] in the text and tried stuff like: Rex is now familiar; in the chat-node, but it didn’t work.
You set it with
now Rex is familiar;
That’s normal code, not a say phrase, so you you’d put it in a normal rule. It won’t work as a text substitution. But with say phrases you can easily link a text substitution to a rule:
To say new-friend:
now Rex is familiar;
Instead of asking Rex about something when Rex is not familiar:
say "[new-friend]Ignoring your question, the man offers you his hand and shakes it vigorously. 'I don't believe I've had the pleasure. Rex Bystander, at your service.'";
‘Now’ is explained further in Writing with Inform 8.11.
Thanks, that’s working really well.
Ok I’ve been working on other stuff and I came back to test a change to one of my conversations, only now I suddenly keep getting errors like this in every section where I have text that is set by the simple moods extension:
I think it must be something to do with the moods extension because the error always seems to appear just in front of the added text and it doesn’t affect anything that doesn’t have moods yet. Can anyone help?