ainslec / adventuron-issue-tracker

Adventuron Issues Tracker
4 stars 0 forks source link

noun1_is and noun2_is implementations should return true if raw noun1 or noun2 matches (when used with a dynamic parameter) #470

Open ainslec opened 2 years ago

ainslec commented 2 years ago

Consider that noun1_is should work (when it is a parameter) if it matches the original noun too (the noun the parser understands by its position in the logical sentence.

Spoiler: I think it should.

ChrisM (in Discord) wondered why this did not work:

start_at = my_location
locations {
   my_location : location "You are in a room.";
}
strings {
fruit : string "banana" ;
}
on_command {

   : match "hold _"  {
     : if (noun1_is (fruit)) {
       : print {("You hold the "+fruit)};
     }
      : else_if (noun1_is "orange") {
       : print "You hold the orange";
      }
   }
}

My description of why this doesn't currently work OK, here is the explanation noun1_is (and its ilk) do something in particular The thing they do is they test to see if the provided string matches a noun or any of its aliases For example, if you specified in your vocabulary that tree was the same as bushes, then noun1_is "tree" or noun1_is "bushes" would return true. What it doesn't do is return true if tree or bushes were never a noun Nouns are registered in the following ways

  1. Value defining objects (via the object id). e.g. red_key : object "a red key"; --> this would register "red" as an adjective, and "key" as a noun
  2. Via the vocabulary section - this is where you can associate words with other words in a group.
  3. Via calling noun1_is or noun2_is with an explicit string, e.g. noun1_is "apple" would register "apple" as a noun even if it is not declared anywhere else. So, it's a bit like text adventure quantum physics the observation changes the state checking for an explicit static noun, actually registers the static string as a noun