New Posture Prepositions

For reasons, I am interested in changing the actorInPrep property of a surface based on the actor in question. What I can’t figure out is what if anything I can test to make that happen.

What I want:

>x carpet
Some of the 70's best shag!

Casper is floating above the carpet.

You are standing on the carpet.

I had elsewhere created a new posture, ‘floating.’ What I get:

>x carpet
Some of the 70's best shag!

Casper is floating on the carpet.

You are standing on the carpet.

I can certainly make actorInPrep = 'above' but that breaks the PC description. Ideally, I’d like to change actorInPrep based on the posture of the actor being tested.

One idea I conceived of was to override the standard descriptions to remap the player character under objInPrep instead of actorInPrep but that felt really kludgey. And while I have no immediate plans, I’d prefer not to rule out PC levitation this early. :]

I noticed a verb definition method that I thought would help, but I have no real idea what it does. And it did not help when overridden. (The commented out is what is defined for ‘standing on’ posture.)

VerbRule(FloatAbove)  // Verb not actually usable, just exists for Posture
    (('levitate' | 'float') |
         (('levitate' | 'float') 'above') ) singleDobj : FloatAboveAction
    verbPhrase = 'float/floating (above what)'
    askDobjResponseProd = singleNoun

    adjustDefaultObjectPrep(prep, obj)
        // { return (obj != nil ? obj.actorInPrep + ' ' : prep); }
                { return ('above'); }

gActor isn’t going to get me what I want obvi, because that refers to the current command initiator, and does not change for each actor being listed. Anyone know the hidden variable I can’t find? Or know another way to tackle this?

Perhaps it wouldn’t be flexible enough for your purposes, but another way at it might be to modify the relevant Listers? Lists and Listers

1 Like

I’m not sure what the rest of your code looks like, but if the carpet is something like a Platform, then you can do this by changing the way libMessages.actorInRoom() works instead of how carpet.actorInPrep is defined—the libMessages method has access to the actor instance being described.

Simple complete example:

#charset "us-ascii"
#include <adv3.h>
#include <en_us.h>

class Ghost: Person;

modify Thing
        objAbovePrep = 'above'
        actorAbovePrep = (objAbovePrep)
        actorAboveName = (actorAbovePrep + ' ' + theNameObj)

modify libMessages
        actorInRoom(actor, cont) {
                if(actor.ofKind(Ghost)) {
                        "\^<<actor.nameIs>> <<actor.posture.participle>>
                                <<cont.actorAboveName>>. ";
                } else {
                        inherited(actor, cont);

class Carpet: Platform
        allowedPostures = [ sitting, lying, standing, floating ]

floating: Posture
        postureDesc = 'floating'
        msgVerbIPresent = 'float{s}'
        msgVerbIPast = 'floated'
        msgVerbTPresent = 'float{s}'
        msgVerbTPast = 'floated'
        participle = 'floating'

startRoom: OutdoorRoom 'Void'
        "This is a featureless void with some carpet. "
+me: Person;
+carpet: Fixture, Carpet 'carpet' 'carpet'
        "It's wall to wall.  Even though there are no walls. "
++ghost: Ghost 'ghost' 'ghost'
        "It's a generic ghost. "
        posture = floating

versionInfo: GameID;
gameMain: GameMainDef initialPlayerChar = me;


This is a featureless void with some carpet.

The ghost is floating above the carpet.

>stand on carpet
Okay, you're now standing on the carpet.

>x carpet
It's wall to wall.  Even though there are no walls.

The ghost is floating above the carpet.

You are standing on the carpet.


This example assumes that ghosts are the only things capable of floating, but that would be easy enough to tweak if that’s not true in your game.

You’ll also probably need to define actorActorInAName and the other related methods if platforms aren’t the only things ghosts float over. And if the player can become a ghost or float via other means you’ll want to also supply libMessages.actorInRoomStatus() and the other status-setting properties.

1 Like

I was getting ready to go jbg’s route…

That said, if there are only a very few things that Casper might float over, it would surely be easier to tweak Casper’s specialDesc and make his showSpecialDescInContents simply call showSpecialDesc (instead of the ordinary call to listActorPosture, which eventually uses the messageprops that include actorInPrep…)
Or, change showSpecialDescInContents to say "Casper is floating over <<location.theName>>. "; or something like that.

1 Like

I played with the showSpecialDescInContents for a bit, but realized that only handled the X CARPET scenario. A room listing would still have the wrong preposition. I think @jbg’s solution covers both pretty slickly.

I am embarrassed to say that I worked backwards from your proposal and was about to triumphantly show my code, only to realize I had reimplemented his solution! My intent was to play with both solutions to see what worked best. Picked the wrong one to start with??

It may not work… but the assumption was that specialDesc would be changed to say if(Casper here) yada else if…
For situations where there’s only five or six places he might be listed…

1 Like

D’oh, of course. Yeah, I missed that obvious lifeline and fell into much deeper waters.

1 Like