Unsuccessful attempts by actor....

I have an NPC in my review game that is completely obedient, by a persuasion rule that succeeds. He does whatever is asked. I also have some Unsuccessful attempt rules that report failures appropriately. I also have a ‘mind control’ verb, which links to a table, and cross-references to a number via an ‘Instead’ rule, which takes the number and translates it into an action tried by my NPC, so no matter where the player is in the game, if the player ‘psychs’ an appropriate ‘text’, the NPC will try the associated action. If the player can see the NPC, it will show the NPC attempting the action, otherwise the player will ‘hear some movement somewhere’(it’s a small gaming area). My problem is, if I use the mind-control verb I created, in the presence of the NPC, it will report him doing the action, but only if the action is successful. If I try to make the NPC do an action that I know will not succeed, such as go through a closed door, my Unsuccessful attempt by rule will not kick in, and nothing is reported. The Unsuccessful attempt rules will operate if the player actually tells the NPC directly, but they don’t seem to work if I do the mind-control. Part of my code–

[code]Persuasion rule for asking people to try doing something: persuasion succeeds.
Unsuccessful attempt by John going:
if the reason the action failed is the can’t go through closed doors rule:
say “Predictably, John strides right into the door.”;
otherwise:
say “John walks right into the wall, as expected.”

Table 2 - Psychic Coercion
Topic presponse
“north” 1
“south” 2

Psyching is an action applying to one topic. Understand “psych [text]” as psyching.

Instead of psyching:
if the topic understood is not a topic listed in table 2:
say “You feel a confusion, as if the cosmos didn’t understand your wishes…”;
otherwise:
if the player can see John:
say “John gets a confused look on his face, then he proceeds…”;
otherwise:
say “You hear movement somewhere…”;
if the presponse entry is:
– 1:
try John going north;
– 2:
try John going south.[/code]

Okay, problem solved–originally, my ‘psyching’ rule was an ‘After’ rule, and none of the unsuccessful rules would work if I tried ‘psyching’, so I changed the rule to an Instead rule, and clumped my Check rule into it. In the original location, there is a door to the north. It’s a locked door–for which I have no Unsuccessful attempt rule. After I had changed to an Instead rule, I tried only north(and there is no Unsuccessful attempt rule for a locked door, and did not try the other direction.

Thanks anyway.

Actually, I was wrong. I think the problem is with ‘if the action failed…’ Could it be because ‘the action’ would not be the NPC’s, but the player’s, and I have no unsuccessful attempt rules for ‘psyching’…??

The problem seems to be that “unsuccessful attempt” rules are only considered after persuasion actions. Your psych outcomes don’t involve persuasion (since you write “try John going north”, not “try asking John to try going north”).

The solution is complex, because you won’t be able to “try asking John” to do things unless he’s in scope; but if he’s in scope then his actions will be reported, even when they shouldn’t be. One solution is to have a condition in your psyching rule which tests whether John is present or not.

Instead of psyching:
	if the topic understood is not a topic listed in table 2:
		say "You feel a confusion, as if the cosmos didn't understand your wishes...";
	otherwise:
		if the player can see John:
			say "John gets a confused look on his face, then he proceeds...";
		otherwise:
			say "You hear movement somewhere...";
		if the presponse entry is:
			-- 1:
				if the player can see John:
					try asking John to try going north;
				else:
					try John going north;
			-- 2:
				if the player can see John:
					try asking John to try going south;
				else:
					try John going south.

Alternatively, put John in scope at all times. (That means you don’t need a special psyching action, because “JOHN, GO N” will always work.) Then adapt your unsuccessful attempt/report rules so that they print something suitable when John isn’t in the location.

After deciding the scope of the player: place John in scope.
	
Unsuccessful attempt by John going when John is in the location:
	if the reason the action failed is the can't go through closed doors rule:
		say "Predictably, John strides right into the door.";
	otherwise:
		say "John walks right into the wall, as expected."
Unsuccessful attempt by John going:
	say "You here a muffled thud from somewhere nearby."
After John going when the room gone to is not the location and the room gone from is not the location:
	say "You hear movement nearby."

(This has the downside that you will need to write rules covering anything the player might ask John to do. The player can always “see” John, so Inform will produce reports on his actions unless instructed otherwise.)

Thanks, JRB. Fortunately, this is only for a review game–now I know the problem has more to do with Persuasion or lack thereof, and I can use those routines in a future game.