Custom Library Messages

version 28/100614 by David Fisher

  • Home page
  • Beginning
  • Previous
  • Next



  • Section 3.12 - Miscellaneous decision rules

    To decide if game over:
    (- deadflag -).

    To decide whether noun is living:
    (- noun has animate -).

    To decide whether noun is doing the action:
    (- noun == actor -).

    To decide whether noun is not doing the action:
    (- noun ~= actor -).

    To decide whether player is doing the action:
    (- actor == player -).

    To decide whether player is not doing the action:
    (- actor ~= player -).

    [
    To decide whether player can see the actor:
    (- I7_CanSee(player, actor) -).
    ]

    To decide whether there are multiple objects:
    (- multiflag == 1 -).

    To decide whether there are not multiple objects:
    (- multiflag ~= 1 -).

    [ perform a binary search to quickly find the message id in the
    table of library messages (assumes the table has been sorted) ]

    This is the print library message rule:
    change libmsg-was-empty to 1;
    let n1 be 1;
    let n2 be the number of rows in the table of library messages;
    while n1 <= n2 begin;
    let mid be n1 plus n2;
         change mid to mid divided by 2;
         choose row mid in the table of library messages;
         if the message id entry is library-message-id begin;
         if the message text entry is not "" begin;
             say the message text entry;
                change libmsg-was-empty to 0;
         end if;
             change n1 to n2 + 1; [ to force the loop to stop ]
         end if;
         if the message id entry < library-message-id, change n1 to mid plus 1;
    if the message id entry > library-message-id, change n2 to mid minus 1;
    end while.

    libmsg-was-empty is a number that varies.