Miscellany


§1. Identification.

Constant WORLDMODELKIT = 1;
Constant USE_SCORING = WorldModelKit`SCORING_CFGV;

§2. Global Variables. These are not the only global variables defined in the template layer: those needed locally only by single sections (and not used in definitions of phrases in the Standard Rules, or referred to by Inform directly) are defined within those sections — they can be regarded as unimportant implementation details, subject to change at whim. The variables here, on the other hand, are more important to understand.

! (1)
Global location = 0; ! does not = I7 "location": see below
Global sline1; Global sline2;

! (2)
Global undo_flag;

! (4)
Global story_complete = 0;
Global resurrect_please = false;

! (5)
Global not_yet_in_play = true; ! set false when first command received
Global turns = 1; ! = I7 "turn count"
Global the_time = NULL; ! = I7 "time of day"
Global time_rate = 1;

Constant NUMBER_SCENES_CREATED = ICOUNT_SCENE;
Constant SCENE_ARRAY_SIZE = (NUMBER_SCENES_CREATED+2);
Array scene_started --> SCENE_ARRAY_SIZE;
Array scene_ended --> SCENE_ARRAY_SIZE;
Array scene_status --> SCENE_ARRAY_SIZE;
Array scene_endings --> SCENE_ARRAY_SIZE;
Array scene_latest_ending --> SCENE_ARRAY_SIZE;

! (6)
Global score; ! = I7 "score"
Global last_score; ! = I7 "last notified score"
Global notify_mode = 1; ! score notification on or off
Global left_hand_status_line = T_SL_Location; ! = I7 "left hand status line"
Global right_hand_status_line = T_SL_Score_Moves; ! = I7 "right hand status line"

! (7)
Global real_location; ! = I7 "location"
Global visibility_ceiling; ! highest object in tree visible to player
Global visibility_levels; ! distance in tree to that

Global SACK_OBJECT; ! current player's holdall item in use

! (8)
Global act_requester;
Global actor; ! = I7 "person asked" = I7 "person reaching"
Global actors_location; ! like real_location, but for the actor
Global actor_location; ! = I7 "actor-location"
Global meta; ! action is out of world
Global inp1;
Global inp2;
Array  multiple_object --> WorldModelKit`MULTI_OBJ_LIST_SIZE_CFGV; ! multiple-object list (I6 table array)
Global toomany_flag; ! multiple-object list overflowed
Global multiflag; ! multiple-object being processed
Global multiple_object_item; ! item currently being processed in multiple-object list
Global noun; ! = I7 "noun"
Global second; ! = I7 "second noun"
Global keep_silent; ! true if current action is being tried silently
Global trace_actions = 0;

Global untouchable_object;
Global untouchable_silence;
Global touch_persona;

Global special_word; ! dictionary address of first word in "[text]" token
Global consult_from = 1; ! word number of start of "[text]" token
Global consult_words; ! number of words in "[text]" token
Global parsed_number; ! value from any token not an object
Global special_number1; ! first value, if token not an object
Global special_number2; ! second value, if token not an object

Array  parser_results --> 16; ! for parser to write its results in
Global parser_trace = 0; ! normally 0, but 1 to 5 traces parser workings
Global pronoun_word; ! records which pronoun ("it", "them", ...) caused an error
Global pronoun_obj; ! and what object it was thought to refer to

Global players_command = 100; ! = I7 "player's command"
Global matched_text; ! = I7 "matched text"
Global understand_as_mistake_number; ! which form of "Understand... as a mistake"
Global particular_possession; ! = I7 "particular possession"

! (9)
Global parser_action; ! written by the parser for the benefit of GPRs
Global parser_one;
Global parser_two;
Global parameters; ! number of I7 tokens parsed on the current line
Global action_reversed; ! (parameters would be reversed in order)
Global wn; ! word number within "parse" buffer (from 1)
Global num_words; ! number of words in buffer
Global verb_word; ! dictionary address of command verb
Global verb_wordnum; ! word number of command verb

! (10)
Global scope_reason = PARSING_REASON; ! current reason for searching scope
Global scope_token; ! for "scope=Routine" grammar tokens
Global scope_error;
Global scope_stage; ! 1, 2 then 3
Global advance_warning; ! what a later-named thing will be
Global reason_code = NULL; ! for the I6 veneer

Global ats_flag = 0; ! for AddToScope routines
Global ats_hls;

! (11)
Global move_pushing;
Global move_from;
Global move_to;
Global move_by;
Global move_through;

! (12)
Global lookmode = WorldModelKit`ROOM_DESC_DETAIL_CFGV; ! 1 = BRIEF, 2 = VERBOSE, 3 = SUPERBRIEF
Global c_style; ! current list-writer style
Global c_depth; ! current recursion depth
Global c_iterator; ! current iteration function
Global lt_value = EMPTY_TEXT_VALUE; ! common value of list_together
Global listing_together; ! object number of one member of a group being listed together
Global listing_size; ! size of such a group
Global c_margin; ! current level of indentation printed by WriteListFrom()
Global inventory_stage = 1; ! 1 or 2 according to the context in which list_together uses

Global debug_scenes = 0;

§3. Compass. I6 identified compass directions as being children of the pseudo-object Compass, so we define it. (Note that Compass is not a valid I7 object, and is used for no other purpose.) Because of the traditional structure of language definitions, this needs to come first.

Object Compass "compass" has concealed;

§4. Score and Rankings Table. The following command tells Inform to compile constant definitions for INITIAL_MAX_SCORE and/or RANKING_TABLE, in cases where there are scores and rankings. If there's no ranking table, RANKING_TABLE is left undefined, so that we can #ifdef this possibility later.

Global MAX_SCORE = INITIAL_MAX_SCORE;

§5. Other odds and ends.

[ ParserError error_type;
    if (error_type) PrintSingleParagraph(error_type);
    rfalse;
];

[ UnknownVerb v;
    if (WorldModelKit`NO_VERB_VERB_EXISTS) {
        verb_wordnum = 0; return 'no.verb';
    }
    rfalse;
];
[ PrintVerb v;
    if (WorldModelKit`NO_VERB_VERB_EXISTS) {
        if (v == 'no.verb') { print "do something to"; rtrue; }
    }
    rfalse;
];