[I6+PunyInform] Does AskFor needs a permission to work?


I’m trying to do something in PunyInform and so I started (again) learning Inform6. It’s been like 15 years since my last failure, but now things seem easier - although I’m locked anyway.

The point: IIRC, you may need to give “consent” to NPC to accept orders et similia in I7 (er… I’m not sure: my usual NPC is either ethereal or isn’t there at all). I don’t know if this is true for I6, too.
This because, I can’t seem to be able to make the AskFor routine work (the NPC has “better things to do” all the time), while it works for Ask and Tell.

Dis the code:

life [;
   AskFor, Ask, Tell:
      if (self has general) "Your plate is full already.";
        else switch (second) {
            move Turkey to Bar;
            give self general;
            "You decide for a full turkey. The girl serves you in a minute.";
            "~We don't serve that, Sir. I'm sorry.~";

ASK/TELL WAITRESS ABOUT works just fine. ASK HER FOR never does. That’s why I’m starting to think she needs consent.

Thanks for the help!

AskFor is not one of the actions presented to the life routine (DM4 chapter 17). Needs to come in a standard before or after routine, I think.

1 Like

You can do this by putting the code in a Give action within the waitress’s orders property, although it looks like this only actually fires when the object the player’s asking for is in scope. The only time I need to do this in my current WIP is when the object IS in scope, so this way works fine for me, but YMMV.

1 Like

Assuming that you gave your waitress the animate property, did you also give her the female property, which is necessary for “her” to work?

Currently in a hurry so I was not able to copy your code and try to reproduce the problem.

For instant help with Puny, which can be a real time-saver when you’re actively developing something, you can join our Discord, too: PunyInform

Side-note: I’ve released the full sources of H1DC together with the BuildTools for Puny, you might want to have a look, especially when you’re dipping your toe into Puny. Might spoiler something if you did not play it yet though: Puddle-BuildTools/hibernated1.inf at master · ByteProject/Puddle-BuildTools · GitHub


This is it.

Now, a new problem arises: how can I put the turkey in scope before parsing the Give order? I tried two different solutions, both I’m unhappy with:

  1. I put the turkey in the room, with concealed. Too bad, the object reacts to everything and I don’t want this to happen ('cause the turkey would be, es: in the kitchen, and not “here”).

  2. I PutInScope(Turkey). But it doesn’t work, because it does nothing (I’m running it at the wrong moment, probably, as I put the PutInScope in the Give: section.).

Addendum. (not really needed, just for code cleanliness)

I have to duplicate all the code for Ask and AskFor (there are several “turkeys” in the game…) because they parse the “second noun” differently (Ask is second and AskFor is noun).

The (improvised) commands <<AskFor self noun>> or <<Ask self second>> do obviously return a numeric value and don’t work :slight_smile:

Ok, I guess the second part is simply solved here.

AND: this solves the problem neatly overall, as I don’t really need to give orders to NPCs in my game :slight_smile:
(It doesn’t solve it generically, tho, so I won’t tag is as solved).

1 Like

I’d be happy to help you, but I’m not sure exactly what you want to achieve with putting the turkey in scope at the last possible moment.

You want “ask for turkey” to work, but there shouldn’t be a turkey in the room, so “examine turkey” shouldn’t work?

If this is the case, you could solve this with a scope token in the grammar. Something like:

Extend ‘ask’ first

  • ‘for’ scope=AskScope → AskForSomething;
[ AskScope;
  if(scope_stage == 2) {

The rfalse at the end means that all other objects that would usually be in scope are also in scope for this grammar line, so the player can also ask for a wrench which they can see. Change it to rtrue if the player should only be able to ask for the things you’ve explicitly added to scope in the routine.


If you mean that you need to write the same code in a lot of different turkey objects, this is where classes come in. You write the code in the class, and create any number of turkey objects which are all of this class, and they inherit the code.

1 Like

Thanks a lot. I will try the PlaceInScope routine you suggested. It was exactly what I’m looking for, that is being able to ask for things which are stored out of game and not in the location.

As per the second thing, only in part: the point is that I need both ASK GIRL FOR TURKEY and ASK GIRL ABOUT TURKEY to give the same result (in the case specific: the turkey being put into the room).
Unfortunately, I can’t do something like AskFor: <<Ask self second>> because there is no second in the AskFor routine. Same applies with Ask (Ask: <<AskFor self noun>>, because the noun is the NPC). [NOTE: I don’t even know if these are the right syntaxes for those actions].

First of all: Are you using the Inform 6 standard library or PunyInform to compile this? They may not behave exactly the same.

You can’t (meaningfully) issue an action in code for an action that has a topic token. But you should be able to issue an AskFor action from the life routine. Or you could throw in the grammar extension I suggested to skip the Ask action altogether if the player asks for one of the special items.

I.e. I would expect something like this to work:

Object Waitress "waitress"
    name 'waitress',
    before [;
        if(second == Turkey) "We're all out of turkey, I'm afraid!"; 
        ! (Or some other code to handle this)
    life [;
        if(second == 'turkey') <<AskFor self Turkey>>;
  has animate female;

BTW, you can make both “ask waitress for turkey” and “ask waitress about turkey” trigger an AskForSomething action:

Extend 'ask' first
* creature 'for'/'about' scope=AskScope -> AskForSomething;

( + the AskScope routine I showed above)

Thanks a lot. I will try both suggestions, as I’m sure my shortcuts will break the game at some unforeseeable point.

PS: I’m compiling in PunyInform.

1 Like