Default Messages

version 12/091223 by David Fisher

  • Home page
  • Beginning
  • Previous
  • Next



  • Section 1.3 - Altering messages

    When play begins:
    init library messages;
    add the custom library messages.

    To add the custom library messages:
    repeat through the table of custom library messages begin;
    set message id entry to the message text entry;
    end repeat.

    To set (id_ - library message id) to (msg_ - text):
    update the row with id of id_ to msg_.

    [ perform a binary search to quickly find the message id
    (table is guaranteed to be sorted) ]

    To update the row with id of (id_ - library message id) to (msg_ - text):
    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 id_ begin;
    change the message text entry to msg_;
    change n1 to n2 + 1; [ to force the loop to stop ]
         end if;
         if the message id entry < id_, change n1 to mid_ plus 1;
    if the message id entry > id_, change n2 to mid_ minus 1;
    end while.