Int Fic Parse Name

It is easy to use parse_name (ParseName?) routines to separate words like "toilet" and "toilet paper". For the simple example, just use this name for the toilet:

 name 'toilet',

and for the toilet paper, use this parse_name routine:

 parse_name
 [w i p; w=NextWord();
         while(w=='toilet' or 'paper')
          {i++; if (w=='paper') p=1; w=NextWord();
          }
         if (p==1) return i;
 ],

However, this causes a problem: now you can't refer to the toilet paper ever, even away from the toilet. People are used to referring to things by their adjectives, like 'red'. Here is a new parse_name routine that only allows the toilet paper to be referred to as "toilet":

 parse_name
 [w i p; w=NextWord();
         while(w=='toilet' or 'paper')
          {i++; if (w=='paper') p=1; w=NextWord();
          }
         if (p==1 || TestScope(toilet)==0) return i;
 ],

This parse_name routine will only accept wording without "paper" when TestScope(toilet) equals 0, i.e. the toilet is not visible.

-- AndrewMackinnon

Go back to InteractiveFictionPatterns
EditText of this page (last edited March 1, 2002)
FindPage by searching (or browse LikePages or take a VisualTour)