Making Planner work

I’m creating a game that makes use of Planner and Basic Plans by Nate Cull, but they don’t seem to be working. They’ll show as “starting planning” but will never choose an action. I’ve made a demo game to illustrate this, with all the interceding things that could be messing it up (although I’ve tried removing all of them and it still won’t work).

"Planner Test" by Charm Cochran

Include Planner by Nate Cull. Include Basic Plans by Nate Cull.

Orange Room is a room. "The walls and floor and ceiling are painted a blinding orange."

Yellow Door is an open door. "It's a simple door, painted yellow." It is openable and not lockable. Yellow Door is east of Orange Room and west of Green Room.

Green Room is north of Violet Room.

John is a man in Orange Room. The description of John is "He seems to have a wish, but is waiting for something first."

An on/off button is a kind of thing.
Instead of pushing an on/off button which is part of a switched off device (called the machine): 
	try switching on the machine.

The Action Cuer is a switched off device in Violet Room. 
The grand button is an on/off button. It is part of the action cuer.

John's Journey is a scene. John's Journey begins when the action cuer is switched on.

When John's Journey begins, say "John starts his journey!"

Every turn during John's Journey:
	have John plan an action for being-in with John and Violet Room;
	
Test me with "plans on / e / s / press button / z / z / z"

Is there something obvious that I’m doing wrong? Do Planner and Basic Plans just not work in 6M62?

1 Like

I’m not familiar with these extensions but have downloaded them so that I can start to investigate deeper.

However, I did a cursory kind of testing by booting your game, then typing ‘rules all’ before typing ‘test me.’ This way we can see what rules are running and in what order, etc.

I saw this:

[Rule "basic testing being in rule" applies.]

Planner: no action chose

So as a consequence of the basic testing being in rule, no action is being chosen. That rule says

Planning-testing when the desired relation is being-in (this is the basic testing being in rule):
	if the desired param1 is in the desired param2, rule succeeds;
	rule fails;

So the rule fails if param1 is NOT in param2. Does this mean it isn’t working because John isn’t in the Violet room? That’s my quick read, but that may not be right. What we DO know now is that the plan is failing the test as specified by the rule above. See if knowing that helps.
EDIT: Sorry, the John-Violet thing I said is nonsensical, 'cos he’s on the journey. But I need to look at how this extension works later…

-Wade

Interesting. I have no idea why that’s making it fail. From the comments in Planner:

[This is where you put rules to test goals. Normally this would be a simple check against an I7 relation or property, and does not often need to be overridden.]

Planning-testing rules is a rulebook.

So I believe it’s meant to test whether the goal is met or not. I tried switching the order of the basic testing being in rule and the the basic travel with best route rule in Planner to see if the latter (the one we want to fire) would take precedence, and it didn’t. As I understand it, failing a planning-testing rule is meant to trigger an action, not prevent it. So perhaps there’s some disconnect between the two rules?

On the topic of ‘Does the extension work?’, I tried the example project, Alchemy. I didn’t feel confident about it because it has no ‘test me’ command and it has a typo in it that prevents it from running out of the box.

Anyway! I ran it, and I think it’s meant to make Bob carry out plans every turn if you just WAIT repeatedly. But all he does is scratch his head repeatedly. So, maybe the extension is buggy, or does not work in 6M62.

-Wade

2 Likes

Yeah, that’s my experience as well. I was worried I had messed up the extension somehow, but it’s beginning to look like I’ll just need to find a different solution.

I reckon it can probably be updated to be made workable. I’m just not the guy to do it as I’ve only ever used the built-in relations :slight_smile: though we can’t guarantee that’s the source of the problem. It could be some phraseology or subtle function change between Inform versions.

-Wade

1 Like

Fair enough—I’ll see if I can work up an updated version, although I’m still far from an expert on Inform.

It looks like a bug in Planner was identified and fixed previously. Alchemy works (along with the typo fix) with this change. I’ll commit the fix to the repo later today.

[Edited: I’ve pushed the fixes to the Friends repo.]

3 Likes

Good catch! Thank you!

I did actually find that thread before and implement the changes in my copy of the extension before making this thread, but it’s entirely possible I did implement them incorrectly. I’ve found a work-around, but since Planner would be significantly more elegant I’ll give it another go once it’s updated!

[Edit: I actually think the first code change suggested in the thread had already been implemented in the version I downloaded.]

Update: I must have implemented the changes incorrectly when I tried myself because with the updated versions of Planner and Basic Plans, Alchemy appears to be working as it should.

One small caveat is that it won’t plan paths through doors without some slight alterations to the code, but those are easy fixes and with them my own example works properly as well!