Both NPC’s and players should be able to use a praise action:
[code]Understand “praise [someone]” as praising.
praising is an action applying to one thing.
If the noun is not a person, say “Kindly try praising a person instead.” instead.
[Carry out praising:
Say “I only need carry out praising if something is changing in the world, right?”.]
Report the player praising:
Say "You say nice thing about [printed name of the noun]. "
Report someone praising:
Say "[printed name of the actor] say nice thing about [printed name of the noun]. "[/code]
So far, if Gobba praises me, I get this:
Gobba say nice thing about yourself.
How do I make it say “you” instead?
Also - in my mind, the prober way would be to use a single report for both ‘player’ and ‘someone’. Then that report would refer dynamically to the actor:
IF ACTOR = PLAYER: You your you’re yourself, you’d …
IF ACTOR = NPC: He, his, he is, himself, he’d …
But I don’t know how to do this. And maybe constructing a sentence to dynamically supporting both 2nd and 3rd person is a bit much? What is the right thing to do here?
Not at all – the major new feature of the new version of Inform is exactly that feature (assuming you’re using the latest version):
Report an actor praising:
Say "[The actor] [say] nice things about [the noun]."
See the manual chapter 14. Note that “the printed name” is generally needed only in special cases and this is not one of them.
To have it print “yourself” or “himself” when praising oneself, change it to:
Report an actor praising:
Say "[The actor] [say] nice things about [if the noun is the actor][themselves][otherwise][the noun][end if]."
Thanks, chapter 14 looks useful! I ended up with this code:
Say "[The actor] [say] nice things about [regarding the noun][if the noun is the actor][themselves][otherwise][them][end if]."
But it requires a bit of work to make both actor and noun adaptive.
If I wanted to write:
You praise Gobba. He smiles.
Then it would need to adapt like this:
You praise Grobba. He smiles.
You praise yourself. You smiles.
Gobba praise you. You smiles.
Gobba praise himself. He smiles.
Gobba praise Gyrf. He smiles.
I’m unsure how to refer to the noun as respectively ‘Grobba’ and ‘He’. And in the last example, the reader won’t know if it is Gobba or Gyrf who smiles.
I think I’ll go back to multiple reports (Report someone praising – report the player praising) … this takes up more code, but is harder to screw up. Also, it’s a lot more readable without  everywhere.
I’m not sure I understand the problem. If you write your reporting like this…
Report an actor praising someone: say "[The actor] [praise] [the noun]. [They] [smile]."; rule succeeds.
Report an actor praising someone when the noun is the actor: say "[The actor] [indulge] in some self-laudatory boasting."; rule succeeds.
…the responses should be…
You praise Grobba. He smiles.
You indulge in some self-laudatory boasting.
Gobba praises you. You smile.
Gobba indulges in some self-laudatory boasting.
Gobba praises Gryf. He smiles.
You do need to deal with the special case when the noun and the actor are the same, but other than that Inform will deal with verb-noun agreement for you. (The last case, with the ambiguous pronoun, doesn’t seem to be a problem with Inform’s adaptive pronouns so much as with the example text you’re using.)
I still get “Gobba praises yourself. You smile.” And I guess I need to somehow define [praise] and [smile]?
But besides that, you’re right - it works!
To define “[praise]” and “[smile]” you just need to do this:
To praise is a verb.
To smile is a verb.
Now when Inform sees either of them in brackets, it knows it’s supposed to conjugate them. See §14.3 of the documentation.
As for the “yourself” problem, yeah, I think you need to special-case that. Since the subject of the sentence usually is the player, when Inform applies a substitution like [the noun] or [the actor] to the player, and it’s not at the beginning of the sentence, it prints “yourself.” (Inform often seems pretty magical, but it’s not smart enough to figure out whether the subject of the sentence is also the player, so it just checks to see whether it’s capitalized as a rule of thumb.)
This should work:
Report someone praising the player:
say "[The actor] [praise] you.";
as long as you get the rules sequenced in the right order. (The “rule succeeds” line stops the Report rulebook from running–we put it at the end of the more specific cases so we don’t get more than one report.)
Oops! I forgot about that. Try [you or the noun]. (This is from Assorted Text Generation by Emily Short.)
…yeah, “[you or the noun]” from Assorted Text Generation works better. That’s the one I always forget about.
I found Assorted Text Generation by Emily Short here, but when I included it, it gave an error?
Anyhow, thanks for To praise is a verb … now I get the point of 14.3
Yeah, the various Extensions sites…it’s a bit of a mess right now. You need this version.
Thanks, [you or the noun] is up and running now!
I have found that [regarding the actor] is a safe way to start each text, since it ensures that the game knows how it is supposed to deal with stuff like [they] or [sing].
… This is fantastic - and easier than I would have throught. This stuff can enable protagonist and NPC’s to be equally residents in the game world, both dealing with the same natural laws. This is like an entirely new era of IF! (seriously - it really IS quite cool!)
… Is there a way to detect if the player has told the actor to perform the action?
You can write rules like “after asking Bob to try eating the pineapple” or whatever.
Thanks - I ended up with these three lines:
A person is either not-being-ordered or being-ordered. A person is usually not-being-ordered.
Before asking someone (called npcperson) to try doing something: Now npcperson is being-ordered.
After asking someone (called npcperson) to try doing something: Now npcperson is not-being-ordered.
Then I can always check if the actor is being-ordered. Seem to work!