Implementing Look Down in TADS 3?

Hi,

Is there a way to implement

Look Down

in TADS 3, easily? Something that works everywhere, but can also differentiate according to circumstances, such as sitting, location, and that kind of thing? I’m pretty sure it’s been done before, but a quick websearch didn’t find anything.

I’ll add that it has been done before. This is what happens in my example game, in Workbench [something or other.]

>look down
You see no down here.

And this is Thaumistry, from Steam.

>look down
You see nothing unusual about the floor.

So, are there any examples of how to do this out there? Or can I just update my library?

1 Like

This is the solution I came up with so far; not sure it’s the best one. I don’t know how to redirect it to x floor yet.

DefineAction( LookDown, LookAction );

modify LookDownAction
    execAction() { "You're looking down."; }
;

VerbRule( LookDown )
    ('look' | 'l') ('down' | 'd')
    :LookDownAction
    verbPhrase = 'look down'
;

I can highly recommend the LookDir extension by Erik Eve to achieve this: (http://ifarchive.org/if-archive/programming/tads3/library/contributions/LookDir.zip)

When included you can just add properties to the room like:

yourRoom: Room 
  downLook = "You look down"
;

or

yourRoom: Room 
    downLook() {
        if(gPlayerChar.posture==sitting) {
            "The ground looks closer from here";
        } else {
            "Down you look ";
        }
    }
;
1 Like

Thank you.

Is there a way, with this extension, to modify look down and leave everything else in the default setting? So that

>look down
You're looking down.
>look up
You see nothing remarkable about the ceiling.

works everywhere, without having to modify all the room descriptions for this?

I believe so. The readme describes a property called defaultLook(dirn) that I think should do the trick. I haven’t tried it myself.

I tried

modify Room
{
    defaultLook( dirn )
    {
    if ( dirn is in (downDirection) )
        "You're looking down.";
    else 
        defaultReport( &nothingRemarkable, dirn );
        
    }
}

based on the soucre code. But as far as I can tell, this never hooks the defaultLook used by the extension. And if I try to define defaultLook(dirn) as a global function, I just get this error.

The symbol “defaultLook” is already defined, so you cannot use it as the name
of a function here. This symbol is already being used as the name of an object
or property elsewhere in your program. Change the name to a unique symbol.

The default behaviour seems to be to say “you see nothing unusual/remarkable about dirwall/dir” depending on if you are in an OutdoorRoom or a Room. So it seems you already have those defaults

Yes, it’s just I want to hook the default for look down; let’s say “You’re looking down.” Everything else should still remain the default. Eventually I want to change it depending on the player character, such as “You’re so nearsighted you bend over to look at the <floor/ground/whatever>.” And I possibly allow the player to choose between protagonists, or switch during the game. So, yeah; I have something complex in mind, but I want the basics first.

Alright, in that case

modify Room
    downLook() {
        "You look down on the floor";
    } 
;
modify OutdoorRoom
    downLook() {
        "You look down on the ground";
    } 
;

or just the generic

modify BasicLocation
    downLook() {
        "You look down.";
    } 
;

For all kinds of rooms

Thank you; that does the trick for the moment.