!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Menus.inf Example of how to use the altmenu system
! (1.0) by L. Ross Raszewski (
[email protected])
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Constant STORY "MENUS AND MENUS";
Constant Headline "^An interactive example^By L. Ross Raszewski^";
message "Please make sure you have version 5.0a of altmenu.h!";
! First, we have to add these two replace directives
Replace Domenu;
Replace Lowkey_menu;
! Now, include the standard library
Include "Parser";
Include "Verblib";
Include "Grammar";
! Finally, the library files, in this order
Include "utility";
Include "domenu";
Include "Altmenu";
Include "Hints";
! A room to get the player started
object menus "Land of Menus"
with description "Welcome to the land of menus.
Type HINT to see the main menu.",
has light;
! This is a simple menu. It uses Altmenu's multi-line description feature:
Menu hm "The really big menu"
with description "Please select one of the following items.^
This is a multi-line description.^",
! We need to specify the number of lines of description.
number 3;
! First, an option
Option -> "What is this, anyway?",
with description "This is an example of how to use the menuing system
contained in the files Altmenu.h, domenu.h, and hints.h";
! Separators appear on the menu, but cannot be selected
Separator -> "[This is a separator]";
! Hints. for hints with logn descriptions, it's better to use
! the description property of the hint object, because some interpreters
! may break if they see a really, really long object name.
HintTopic -> "How about a hint?";
Hint -> -> "Okay";
Hint -> -> "How's this?";
Hint -> -> "Not good?";
Hint -> -> "Sorry.";
Hint -> -> "But it's all you're gonna get!";
! You can embed one menu in another
Menu -> "What are some other things this library can do?", with
! This menu has a subtitle bar
sup_bar "Suplementary title",
! And defines its own banner tags
banner_tags "N=Go Down" "P=Go up" "Enter=Select" " Q=[bug]" "Q=back" 8 7;
! Lots of useless options to pad out the multi-page menu
Option -> -> "This"
! using the "Tag" entry point, you can alter how an item is listed in the
! menu. This one prints a message after the name if the option has not been
! selected
with tag [; print (name) self;
if (self hasnt general) print "(You haven't selected this option yet)";
],
! THe description property does the work of noting that the item has been
! selected.
description [; give self general;];
! these options are left blank. Probably a dumb idea in a real game, but this
! is just an example. Of course, on large screens, this might not trigger
! multipage mode, but you should still get the idea.
! resize your viewing window to about, say, 25 lines to see multipage in work
Option -> -> "menu";
Option -> -> "has";
Option -> -> "more";
Option -> -> "than";
Option -> -> "a";
Option -> -> "page";
Option -> -> "of";
Option -> -> "options";
Option -> -> "but";
Option -> -> "most";
Option -> -> "of";
Option -> -> "them";
Option -> -> "do";
Option -> -> "nothing";
Option -> -> "whatsoever";
Option -> -> "with";
Option -> -> "the";
Option -> -> "exception";
Option -> -> "of";
Option -> -> "the";
Option -> -> "last";
Option -> -> "few";
Option -> -> "options";
Option -> -> "below";
Option -> -> "the";
Option -> -> "separators";
Option -> -> "here";
Option -> -> ".";
! You can also make a separator by giving a normal option "locked"
Option -> -> "If you don't know" has locked;
Separator -> -> "Whose signs these are";
Separator -> -> "You can't have traveled";
Separator -> -> "very far";
! This is a swich option. Its label changes how the name is printed depending
! on its current state. The "toggle" property alters the state of the option
SwitchOption -> -> "Burma Shave",
with label [; if (self.number>0) style reverse;
print "Burma Shave";
style roman;
],
toggle [; self.number = -1 * self.number;],
number 1;
! The return value of description is passed back to domenu, so returning 3
! quits.
Option -> -> "Go Back" with description [; return 3;];
! And now, we start the game
[ Initialise;
hint_menu=hm; ! Set up our menu to work with hint.h's built-in grammar
location=menus;
print "^^^";
];