You can stop a hudmessage by printing an empty message with the same id:
HudMessage(s:""; 0, 100, 0, 0, 0, 0);
A counter for the players to store how often they executed the script each would let you use the same inventory to also stop showing the picture. To also add more pages, you'd need:
1. Some way to address the pictures shown
2. Some way to do so in sequence
You could store the pictures in an array or use strparam with a strict naming scheme, but I'll use arrays. Then you'd implement some counter. A user variable seems mostly fitting, cuz the player is the script's activator, among many other benefits an inventory counter or a player count sized map array don't have.
You'd add user int user_page_index to the player, then the acs could look like so. You can also extend the same script to make more inventory for more monsters, which might be interesting. (Also didn't test but it looks good!)
Code: Select all
#define MAX_PAGES 2
script "IMPLOG" (void)
{
str log_pages[MAX_PAGES] = { "pdaimp1", "pdaimp2" };
int i = GetUserVariable(0, "user_page_index");
// Flipping pages
if(0 <= i && i < MAX_PAGES)
{
SetFont(log_pages[i]);
SetHudSize(640, 480, true);
HudMessage(s:"a"; HUDMSG_PLAIN, 100, CR_UNTRANSLATED, 320.0, 240.0, 0);
i++;
}
// Done reading
else
{
HudMessage(s:""; 0, 100, 0, 0, 0, 0);
i = 0;
}
SetUserVariable(0, "user_page_index", i);
}
// When somebody exits while you're reading, the message gets cleared, so
// the page count should be reset, too.
script "Reset Page" enter
{
SetUserVariable(0, "user_page_index", 0);
}
edit: saw a missing ,