Making an action unique

I made an action called talk to. And I only want it to apply to a character once per conversation. I thought about applying a counter to each character. But I’m having issues with that as I’m too new at Inform 7. I’m wondering is there a better way.

I think it would be helpful to explain in more detail what you mean by this

3 Likes
A person can be tired of conversation. A person is usually not tired of conversation.
After talking to a person:
    now the noun is tired of conversation;
    continue the action.
Check talking to a person:
    if the noun is tired of conversation, say "[The noun] [ignore] you." instead.
To ignore is a verb.
4 Likes

If that’s all you need, this also works:

To ignore is a verb.
Check talking to a person:
	if we have talked to the noun, say "[The noun] [ignore] you." instead.

See §9.12. Actions as conditions in Writing with Inform

2 Likes

So I should say that the background of this issue is that I’m trying to make a game or four out of a novel I wrote. So there’s an abundance of dialogue. I suppose I’m trying to figure out how to handle that.

So in my attempt to handle this, I’m trying to reuse an action called talk to by using a counter. I’m actually having issues updating the counter. But currently, the code for one character looks like this

Instead of talk to Levi in the ASM: 
if levicounter is 0 begin;
say "'Yeah, you did. You mind?' you say.[line break]
'I’ll get it,' says Levi.[line break]
Levi took out a pen light from a pocket in his flight suit. He used it to find the breaker on the bulkhead.[line break]
'You’re lucky, son. Only two breakers popped. You could have killed the ship. Lights coming on,' says Levi. He pushed in the button breaker and the lights came back on.[line break]
'I’m leaving the breaker you should have pulled pulled. You’re welcome,' says Levi.[line break]
'Sure, old man,' said Sam with a smile.[line break]
'Who you callin’ old, boy?' Though the senior astronaut tries to make his tone as gruff as he could, he couldn’t hide his smile.[line break]
The heavy Russian accented and curt voice of the commander comes over the intercom and says, 'Captain Stellacuston, Report to the bridge immediately.'[line break]
'Commander Crotchety's on the rampage. I’ll have to finish this later,' you say. You give a sigh and shake your head. Your smile disapears. You pull your hand away from the radio unit.[line break]
'At ease, young captain. Commander Lordsudov has a lot on his plate with the Encounter accelerating at 30 Gs. That’s a lot of stress on the ship and the crew. And it’s the only way we’re ever going to make that rendezvous with the Qars,' says Levi.[line break]
'Sure, I guess. But he’s always on my case, and I don’t know why.'[line break]
'I’m sure he’ll tell you. Just get on up there. You know he ain’t got no patience.'"; 
Now the description of the ASM is "A round lighted room with boxes laying about and wires hanging from the ceiling. The elevator is to the [bold type]east[roman type].[levicounter]";
let levicounter be levicounter plus 1;
end if.

Thanks for making me aware of the Actions as conditions. I need to think about it but first thought is that maybe it may be not enough for my situation.

You can invent your own counters for conditions, as you have done, and some people do prefer that, in which case you need now levicounter is levicounter plus 1 rather than let levicounter be levicounter plus 1.
However, the easiest way to increase a counter by one is simply increment levicounter.

On the other hand you can get Inform to handle counters for conditions for you: see Writing for Inform §7.16. Repeated actions.

This short example illustrates both techniques:

"Talking_to" by PB

Lab is a room.

Bob, Sue and Liz are people in the Lab.

Talking to is an action applying to one thing.  Understand "talk to [someone]" as talking to.

bobcounter is initially 0.

Carry out talking to Bob:
	increment bobcounter;

Report talking to Bob when bobcounter is 1:
	say "'Firstly,' says Bob...";
	
Report talking to Bob when bobcounter is 2:
	say "'Secondly,' says Bob...";
	
Report talking to Bob when bobcounter is 3:
	say "'Thirdly,' says Bob...";

Report talking to Sue in the Lab for the first time:
	say "'Firstly,' says Sue...";

Report talking to Sue in the Lab for the second time:
	say "'Secondly,' says Sue...";

Report talking to Sue in the Lab for the third time:
	say "'Thirdly,' says Sue...";
	
Test me with "talk to Bob/g/g/talk to Sue/g/g"