Question about extension "Problem Solving Characters"

It appears this extension allows you to write rules so the player can say “Bob, get the potato” and he’ll have things to try if the potato is not immediately accessible.

Is there a way in the code to issue commands to NPCs directly - i.e. so Bob could autonomously (cued by another circumstance) decide he’s hungry for a potato - without the player doing it? I don’t suppose it’s as simple as “Potato Scene is a scene. When Potato Scene begins, try bob eating the potato.”…then if the potato is in another room he’ll try going there?

“Try asking Bob to try taking the potato.”

Try using the “we could try” phrase from the extension, which I know runs the “when we are blocked” rules (because the example is based on recursion).

EDIT: Matt, wouldn’t that require Bob to be in the location?

I don’t think so. (Tried it with Bob not in the location and it worked.) If you type “Bob, take the potato” then Bob has to be in scope in order for the parser to understand that “Bob” means Bob, but once you’ve converted it to “try asking Bob to take the potato” then I don’t think it matters whether Bob is in scope or touchable or anything.

From what I gather from Editable Stored Actions, asking someone to do something isn’t an action in its own right; the only difference between the stored action involved in “try asking Bob to take the potato” and the stored action involved in “try Bob taking the potato” is that the first one has a flag set that indicates that it’s a request. (In fact, if you want to take arbitrary stored actions and feed them into the Problem-Solving Characters machinery, you could use Editable Stored Actions to turn them into requests.)

I haven’t looked into this too deeply, though, so I could be wrong.

I just looked at the source, and am having no success understanding the I6 internals (it seems to be generating a function name from the stored action, then deleting the last two characters, then calling it?). But the “we could try” phrase seems to set other variables as well. If “Try asking foo to try barring” works I’d recommend sticking with that.

I don’t know of a way through the extension of doing this, but I’ve written a custom function to have characters search for weapons if they are unarmed that is somewhat similar. I had to program A.I. through every turn rules to do this – so that characters move autonomously, no matter what the character is doing. It’s a more unorthodox method, but if you can’t find any other way, I’ll send you my code examples, or add them here. If you can find a native I7 solution through the extension, maybe that’s better.

If one of these syntaxes works to start the action autonomously, you could tell the NPC to try attacking, then write a rule like this:

[code]Before someone attacking (this is the can’t attack without a weapon rule): if the actor does not carry a weapon, stop the action.

When we are blocked by the can’t attack without a weapon rule: [pathfinding code].[/code]

Thanks for that – I haven’t really used the rule based functions, yet. I use “If (x matches y), next;” functions to skip a loop iteration. But, my function does do something similar. It basically gives the NPC enough A.I. to not run at the character like a zombie if they are unarmed. (Unless they’re a zombie. But, I haven’t put any zombies in my game. :smiley:)

Yes. “When play begins, try Bob taking the potato.”