Inform - Support - Source

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing parserm.h

SearchScope (lines 2939-2998)

2939  !  SearchScope  domain1 domain2 context
2940  !
2941  !  Works out what objects are in scope (possibly asking an outside routine),
2942  !  but does not look at anything the player has typed.
2943  ! ----------------------------------------------------------------------------
2944   
2945  [ SearchScope domain1 domain2 context i;
2946   
2947    i=0;
2948  !  Everything is in scope to the debugging commands
2949   
2950  #ifdef DEBUG;
2951    if (scope_reason==PARSING_REASON
2952        && verb_word == 'purloin' or 'tree' or 'abstract'
2953                         or 'gonear' or 'scope' or 'showobj')
2954    {   for (i=selfobj:i<=top_object:i++)
2955            if (i ofclass Object && (parent(i)==0 || parent(i) ofclass Object))
2956                PlaceInScope(i);
2957        rtrue;
2958    }
2959  #endif;
2960   
2961  !  First, a scope token gets priority here:
2962   
2963    if (scope_token ~= 0)
2964    {   scope_stage=2;
2965        if (indirect(scope_token)~=0) rtrue;
2966    }
2967   
2968  !  Next, call any user-supplied routine adding things to the scope,
2969  !  which may circumvent the usual routines altogether if they return true:
2970   
2971    if (actor==domain1 or domain2 && InScope(actor)~=0) rtrue;
2972   
2973  !  Pick up everything in the location except the actor's possessions;
2974  !  then go through those.  (This ensures the actor's possessions are in
2975  !  scope even in Darkness.)
2976   
2977    if (context==MULTIINSIDE_TOKEN && advance_warning ~= -1)
2978    {   if (IsSeeThrough(advance_warning)==1)
2979            ScopeWithin(advance_warning, 0, context);
2980    }
2981    else
2982    {   if (domain1~=0 && domain1 has supporter or container)
2983            ScopeWithin_O(domain1, domain1, context);
2984        ScopeWithin(domain1, domain2, context);
2985        if (domain2~=0 && domain2 has supporter or container)
2986            ScopeWithin_O(domain2, domain2, context);
2987        ScopeWithin(domain2, 0, context);
2988    }
2989   
2990  !  A special rule applies:
2991  !  in Darkness as in light, the actor is always in scope to himself.
2992   
2993    if (thedark == domain1 or domain2)
2994    {   ScopeWithin_O(actor, actor, context);
2995        if (parent(actor) has supporter or container)
2996            ScopeWithin_O(parent(actor), parent(actor), context);
2997    }
2998  ];


Last updated 27 February 2004. This site is no longer supported; information may be out of date.
Maintained as a historical archive by the Interactive Fiction Technology Foundation. Copyright 1993-2018 IFTF, CC-BY-SA unless otherwise noted.
This page was originally managed by Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight.