Keep an array of the packed addresses of text already seen in the game.
For example:
Constant MAX_MESSAGES 100; ! Number of messages needing storing
Global no_messages = 0; ! Number of messages stored
Array message_text --> MAX_MESSAGES; ! Packed address of messages
[ Message
first ! packed address of message to print first time
other ! packed address to print thereafter
i; ! loop counter
for (i = 0: i < no_messages: i++)
if (message_text-->i == first) {
print (string) other;
return;
}
if (no_messages >= MAX_MESSAGES) "** Out of message space **";
message_text-->no_messages = first;
no_messages ++;
print (string) first;
];
Then the call `Message("~Go away, thou foolish worm!~ bellows the \
Mage.","The Mage ignores your entreaty.");' will do what you want.
If you have thousands of such messages, then it might be worth keeping
the `message_text' array sorted for faster lookup, but for a few hundred
the above inefficient version should run fast enough.
-- Gareth Rees