Custom Library Messages

version 28/100614 by David Fisher

  • Home page
  • Beginning
  • Previous
  • Next



  • Section 3.2 - The current object - unindexed

    curr_obj is an object that varies.
    curr_obj_inform6_value is an object that varies.

    [ The current tense, number, person and gender for curr_obj;
    if curr_obj = the player, these are equal to the library message values,
    otherwise curr_obj_number is third person and the number and gender are
    determined by the object. ]

    temporary_tense is a tense that varies.
    use_temporary_tense is a truth state that varies.
    use_temporary_tense is false.
    curr_obj_number is a grammatical number that varies.
    curr_obj_person is a grammatical person that varies.
    curr_obj_gender is a gender that varies.

    [ the subject of the sentence, initially assumed to be the actor ]

    curr_subject is an object that varies.

    [ change the current object ]

    To set the current object to (x_ - an object) / (dbg_msg - text):
    if the main object is nothing, change the main object to the noun;
    if x_ is_nothing, change curr_obj to main object; [ make sure it is always valid ]
    otherwise change curr_obj to x_;
    if curr_obj is_nothing, change curr_obj to the player; [last resort]
    if library_message_debug is on begin;
    say "{[dbg_msg]:obj=";
    if curr_obj is the player, say "player"; [infinite recursion if prints player!]
    otherwise say "[curr_obj]";
    say "}";
    end if;
    if curr_obj is the player or curr_obj is_nothing, use the player's GNP;
    otherwise use the object's GNP.

    To use the player's GNP:
    change curr_obj_person to the library message person;
    change curr_obj_number to the library message grammatical number;
    change curr_obj_gender to the library message gender.

    To use the object's GNP:
    change curr_obj_person to third person;
    if curr_obj acts plural, change curr_obj_number to plural;
    otherwise change curr_obj_number to singular;
    change curr_obj_gender to the gender of curr_obj.

    To decide which gender is the gender of (x_ - an object):
    if x_ acts feminine, decide on gender feminine;
    if x_ acts neuter, decide on gender neuter;
    decide on gender masculine.

    To decide whether (x_ - an object) is_nothing:
    (- {x_} == nothing -).

    This is the get the curr_obj from Inform 6 rule:
    set the current object to curr_obj_inform6_value / "I6".

    To say current object is (x_ - an object):
    set the current object to x_ / "say curr obj".

    To make sure main object is set / (dbg_msg - text):
    if main object is nothing, change main object to the noun;
    set the current object to the main object / dbg_msg.

    [ called from Inform 6 ]

    This is the internal make main object the current object rule:
    set the current object to the main object / "internal".

    Include (-
    [ set_curr_obj x;
    (+curr_obj_inform6_value+) = x;
    (+get the curr_obj from Inform 6 rule+)(); ! notify Inform 7 about the change
    ];
    -)