Inform - Support - Source

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing parserm.h

ScopeWithin_O (lines 3096-3173)

3096  [ ScopeWithin_O domain nosearch context i ad n;
3097   
3098  !  multiexcept doesn't have second parameter in scope
3099     if (context==MULTIEXCEPT_TOKEN && domain==advance_warning) jump DontAccept;
3100   
3101  !  If the scope reason is unusual, don't parse.
3102   
3103        if (scope_reason~=PARSING_REASON or TALKING_REASON)
3104        {   DoScopeAction(domain); jump DontAccept; }
3105   
3106  !  "it" or "them" matches to the it-object only.  (Note that (1) this means
3107  !  that "it" will only be understood if the object in question is still
3108  !  in context, and (2) only one match can ever be made in this case.)
3109   
3110        if (match_from <= num_words)  ! If there's any text to match, that is
3111        {   wn=match_from;
3112            i=NounWord();
3113            if (i==1 && player==domain)  MakeMatch(domain, 1);
3114   
3115            if (i>=2 && i<128 && (LanguagePronouns-->i == domain))
3116                MakeMatch(domain, 1);
3117        }
3118   
3119  !  Construing the current word as the start of a noun, can it refer to the
3120  !  object?
3121   
3122        wn = match_from;
3123        if (TryGivenObject(domain) > 0)
3124            if (indef_nspec_at>0 && match_from~=indef_nspec_at)
3125            {   !  This case arises if the player has typed a number in
3126                !  which is hypothetically an indefinite descriptor:
3127                !  e.g. "take two clubs".  We have just checked the object
3128                !  against the word "clubs", in the hope of eventually finding
3129                !  two such objects.  But we also backtrack and check it
3130                !  against the words "two clubs", in case it turns out to
3131                !  be the 2 of Clubs from a pack of cards, say.  If it does
3132                !  match against "two clubs", we tear up our original
3133                !  assumption about the meaning of "two" and lapse back into
3134                !  definite mode.
3135            
3136                wn = indef_nspec_at;
3137                if (TryGivenObject(domain) > 0)
3138                {   match_from = indef_nspec_at;
3139                    ResetDescriptors();                  
3140                }
3141                wn = match_from;
3142            }
3143   
3144        .DontAccept;
3145   
3146  !  Shall we consider the possessions of the current object, as well?
3147  !  Only if it's a container (so, for instance, if a dwarf carries a
3148  !  sword, then "drop sword" will not be accepted, but "dwarf, drop sword"
3149  !  will).
3150  !  Also, only if there are such possessions.
3151  !
3152  !  Notice that the parser can see "into" anything flagged as
3153  !  transparent - such as a dwarf whose sword you can get at.
3154   
3155        if (child(domain)~=0 && domain ~= nosearch && IsSeeThrough(domain)==1)
3156            ScopeWithin(domain,nosearch,context);
3157   
3158  !  Drag any extras into context
3159   
3160     ad = domain.&add_to_scope;
3161     if (ad ~= 0)
3162     {   if (UnsignedCompare(ad-->0,top_object) > 0)
3163         {   ats_flag = 2+context;
3164             RunRoutines(domain, add_to_scope);
3165             ats_flag = 0;
3166         }
3167         else
3168         {   n=domain.#add_to_scope;
3169             for (i=0:(2*i)<n:i++)
3170                 ScopeWithin_O(ad-->i,0,context);
3171         }
3172     }
3173  ];


Last updated 27 February 2004. This web site has not been fully supported since April 2008. Information may be out of date. This page was originally managed by Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight.