Phantom door message
Posted: Tue Jan 31, 2012 7:55 pm
I recently tried to implement the extension cango.h by Cardinal Teulbachs and noticed some odd behavior from a door object. Whenever the YouCanGo() routine was called in a room with a door object called "pantry door", the following message would be displayed:
You open the pantry door and leave, closing it behind yourself.
I had neither opened, closed or interacted with the door in any way, nor had I left the room.
I experimented a little and discovered that the following bits of code display that same message:
It seems that any time a door object's door_to property is called, in any way, the message "you open the [door] and leave, closing it behind yourself." is displayed.
I think that the problem is found in the door_to property itself. Here is the code that displays the offending message:
If a door's "door_to" property is called, then it appears that the only way this code isn't executed is if the actor is the player and he either:
(1)needs to get out of something, or
(2)the door is closed and the player is attempting to go through it.
Therefore, if the door is closed and the player is on either side of the door, then this message will be displayed if the previous conditions are not true and the door_to property is called, no matter what.
I honestly don't know how to fix this and I need it to work properly for my current WIP.
I'm still learning Hugo so I could be wrong about where the problem lies. I would appreciate anyone's input.
You open the pantry door and leave, closing it behind yourself.
I had neither opened, closed or interacted with the door in any way, nor had I left the room.
I experimented a little and discovered that the following bits of code display that same message:
Code: Select all
if object.door_to: "Yes, it's a door.\n" ! The object is a door.
Code: Select all
if location.s_to: "You can go south.\n" ! The south object is a door.
Code: Select all
newroom = location.(s_obj.dir_to) ! the south object is a door.
I think that the problem is found in the door_to property itself. Here is the code that displays the offending message:
Code: Select all
if self is not open and (actor in location or
location = self.between #((parent(actor) = \
self.between #1) + 1))
{
! Notify the player that the player or a character
! has gone through the door:
!
OMessage(door, 5)
general = 2
}
(1)needs to get out of something, or
(2)the door is closed and the player is attempting to go through it.
Therefore, if the door is closed and the player is on either side of the door, then this message will be displayed if the previous conditions are not true and the door_to property is called, no matter what.
I honestly don't know how to fix this and I need it to work properly for my current WIP.
I'm still learning Hugo so I could be wrong about where the problem lies. I would appreciate anyone's input.