How can I refresh an action?

I use the following code in one of my rooms

enteringRoom( me )
    {
        if(key.isHeldBy(me)) { pictureWindow.updateContents('<img src="pics/Test2.png">'); } else if(!key.isHeldBy(me)) { pictureWindow.updateContents('<img src="pics/Test1.png">');}
    }

If the player has a key, then an image is shown. If the player does not, than another image is shown. This works when entering the room. If I drop the key in that room, I want the enteringRoom function to refresh, so the image gets updated correctly. Right now it does not work. Either I am missing something, or there is another function that I can use maybe? or a better way to do this? Can someone correct this for me please? I plan on having lots of visible objects that can be picked up and dropped.

This is how I solved it. If anyone has anything to add, please do. The goal is to be able to pick up an item anywhere, drop it anywhere else, but only affect an image in the correct location.

key: Thing
    name = 'key'
    noun='key'
    adjective ='gold'
    desc = "A golden key"
    location = startRoom
    
    dobjFor(Drop)
    {

        verify() {  }
        
        action()
        {
            moveInto(me.location);
            
            if(me.location == pedestalRoom)
                pictureWindow.updateContents('<img src="pics/pedestal.png">');
        }
    }
    
    dobjFor(Take)
    {

        verify() {  }
        
        action()
        {
            moveInto(me);
            if(me.location == pedestalRoom)
                pictureWindow.updateContents('<img src="pics/pedestalUP.png">');
        }
    }
    
;

If the player enters the pedestal room, then it will correctly also update the image.

pedestalRoom: OutdoorRoom 'pedestal'
    "The orb looks like pristine crystal. Not a single flaw."
    enteringRoom( me )
    {
        if(key.isHeldBy(me)) { pictureWindow.updateContents('<img src="pics/pedestalUP.png">'); } else if(!key.isHeldBy(me)) { pictureWindow.updateContents('<img src="pics/pedestal.png">');}
    }
    out = clearingRoom
;

That’s correct. Another solution would be to use roomDaemon method instead of enteringRoom which is called on every turn the player is in the room and not only once the player arrives.

Alright, I’m happy I got that part right. Is there some equivalent to a Boolean in TADS?

Of course, little unusual are keywords true and nil instead of true and false.