[Adventuron] Trouble with disambiguation in beta

I’m having some trouble disambiguating between similarly named objects in beta. This has been driving me bananas in a lengthy game, but stripped down to the essentials, it’s this:

######################################
#  Adventuron                        #
######################################

start_at = my_location

######################################
#  Locations                         #
######################################

locations {

   my_location : location "You are in a room." ;
   
}

######################################
#  Connections                       #
######################################

connections {

   from, direction, to = [
      
   ]
   
}

######################################
#  Objects                           #
######################################

objects {
   
cupboard : scenery "a cupboard"  at = "my_location"  container_type="bag";
   
green_banana : object "a green banana"at = "my_location"  ;
yellow_banana : object "a yellow banana";
black_banana : object "a black banana" ; 
}


######################################
#  On Command                        #
######################################

on_command {
   
   : match "put _"  {
    : if (noun2_is "cupboard") {
           : if (s1_location() == "inventory") {
                       : insert_in_container "cupboard";
                     }
                     : else {
                        : print "You don't have it." ;
                        
                     }
                     
              }
              }
}

…in classroom, GET BANANA and PUT BANANA IN CUPBOARD == You put the green banana inside the cupboard.

in beta, it doesn’t work == You don't have it.

Why is s1 not recognised as being in the inventory in the beta version? I have a feeling that this used to work (I’ve just noticed that it now doesn’t), so perhaps something has changed that has caused this to break?

Sorry to hear about your frustrations.

I’ll take a look at this later this afternoon.

Thanks, as ever…

Hi,

Please update to the latest beta.

I’ve actually taken this opportunity to remove the (undocumented functions) s1_location() and s2_location(). There was a bug, but now they are gone it doesn’t much matter.

As you were using these function to discover if something was part of of your inventory, you can use the following approach instead:

The disambiguate_s1 “carried” step to limit the bananas that will map to s1(). If your verb / noun combo (“banana”) maps to two bananas then s1() will return "ambiguous.

Disambiguation forces the player to choose a banana from carried bananas if there is more than one. Only now will parent_of(s1()) return the parent object of the disambiguated banana.

The rule of thumb is that s1() may return “ambiguous” if there are two objects that share the same noun. Before you call anything involving s1() where an ambiguous noun is possible, call : disambiguate_s1 “carried|known|universal|present|beside|worn|notworn”;

Chris

on_command {
   : match "put _"  {
      : if (noun2_is "cupboard") {
         : disambiguate_s1 "carried";
         : if (parent_of(s1()) == "inventory") {
            : insert_in_container "cupboard";
         }
         : else {
            : print "You don't have it." ;
         }
      }
   }
}

Perfect, thanks. That’s fixed.