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.
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.