I thought this would be a simple matter of blocking "location DoListen" from the room object's before property and telling it to "Perform" the Listen command on the sound object if that object is in the location. When I tried this, the Hugo Engine crashed. I think I know why -- the "location DoListen" rule runs the "DoListen" verbroutine through the Perform() routine, which is caught again by the same "location DoListen" rule. So I have a problem with recursion.
I almost corrected this problem using PreParse (in the player object's before property). The right code is triggered, advancing the game state in the way that I want, but then the default response for an empty "LISTEN" command is printed after my response for listening to the correct object ("Be a little more specific about exactly what you'd like to listen to.")
I don't know how to suppress the library message here. I'll copy my PreParse code below, but I think this code is pretty workable.
Code: Select all
actor PreParse
{
if (word[1] = "listen") and Contains (crypt, player)
{
if voices in crypt
{
Perform(&DoListen, voices)
}
else
{
return false
}
}
else
{
return false
}
}