1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -*- Inform -*- !!!!
2
! AltMenu An Inform 6 Library extension to create
3
! object-oriented menus. By L. Ross Raszewski
4
! (rraszews@skipjack.bluecrab.org)
5
! Requires DoMenu.h and Center.h
6
! First of all, let me say that this is inspired heavily by Graham Nelson's
7
! own alternative menu system. While the code is all my own, I'm not the
8
! sort of person who would shamelessly copy someone else's idea without at
9
! least mentioning them.
10
! Graham's implemenatation is really a lot more impressive code-wise. Mine
11
! is really just a shell for DoMenu. However, my library uses the extended
12
! functions of the DoMenu Library I've written.
14
! To activate a menu, send the select(); message to the appropriate
16
! Menu objectname "Title of the Menu"
17
! with description "If given, this text will be displayed above the menu
19
! number (number of lines in the description),
20
! title_bar "If given, this will be displayed on the top line and the
21
! object name will appear on the second line.";
22
! The children of a menu object are the options on the menu. All children of
23
! a menu MUST be of class Option, or of an option-ovide a select and doname property, but that's all Class
25
! Option -> "Title of the option"
26
! with description [; string or rouine to be printed when Option is selected
27
! returns 1 to prompt a waitforkey, 2 to return instanly
28
! to the menu, or 3 to return and quit the menu];
29
! option.select(); is called when an option is selected, so you could change
33
! This is part of a series actually, these are inter-dependant libraries.
34
! For this to work, you have to include:
35
! center.h -> Centers a line of text (or a routine to print one) in
36
! the upper or lower window.
37
! DoMenu -> A modified DoMenu routine to allow long headers and 2-line
39
! For maximum enjoyment, add on (not required)
40
! Hints.H (UPDATED) -> A system for making object-oriented hints which appear
41
! formatted in the same way as Infocom's InvisiClues
46
with select [; return self.description();],
47
doname [; print (name) self;];
52
with select [; DoMenu(self.emblazon,self.titles,self.execute);
54
emblazon [ o; if (self provides description) self.description();
56
objectloop (o in self) {
62
titles [ i o; if (menu_item==-1) {
63
if (self provides title_bar)
64
item_name=self.doname;
65
if (self provides number)
70
if (self provides title_bar)
71
item_name=self.title_bar;
72
else item_name=self.doname;
73
return children(self);
76
for (i=1:o~=nothing:i++)
77
{if (menu_item==i) item_name=o.doname;
82
for (i=1:o~=nothing:i++)
83
{if (menu_item==i) return o.select();