1
!-----------------------------------------------------------------------------
2
! Manual.H An Inform _6_ library (Backward compatable)
3
! to generate nicely-formatted browseable text
4
! for Z-Machine books and built-in manuals.
7
! Yes, that's right. The library-writer who brought you 'TimeWait', 'Date',
8
! 'PluralF', 'Footnotes', and all of those other useless #include files has
9
! finally perfected (I hope) his manual-writing library in a form that allows
10
! you, yes you, to create an "Inform book".
11
! (I'm not being pompous, I'm just glad to have gotten this working, I've
12
! been working on it for a while, and it's never been easy to modify.)
14
! So, how does it work?
15
! Simple: you provide a call to the routine WriteManual with the
16
! following arguments:
18
! WriteManual(DoFunc,Title,Titlelength,PageNames,PageNameLength,
19
! NumberOfPages,[StartPageNumber]);
21
! DoFunc: A function which can be called with 1 argument, and which prints
22
! a page of text based on that argument (probably with a switch
24
! Title: The Title you want to appear on the first line of the header
26
! Titlelength: The number of characters in the title (used for centering)
27
! PageNames: An array containing the titles of the pages to appear on
28
! the second line of the header
29
! PageNameLength: An Array containing the lengths of the PageNames
30
! NumberOfPages: Just what it says
31
! StartPageNumber: For indexing (I'll write that later), you can call the
32
! manual to any page. By default, it will start on page 0
33
! which should be a title page.
35
! Toss something like this into your code:
37
! WriteManual(DoPage,"Zork - Game Manual",18,pspage,pspn,3);
39
! Verb meta "manual" "instructions" * ->Manual;
41
! and "Manual" will bring up a manual. Your DoPage(mpage); should run
46
! 0: @erase_window -1; box "Zork Manual";
47
! 1: "This is page 1";
48
! 2: "This is Page 2";
52
! pspage --> "Title" "Page 1" "Page 2" "Hey, Page 3";
55
! Note that the banner will only appear on the title page if the user
56
! holds down on the "p" key (It will sort of flicker as it is drawn by
57
! ManualPage and erased by DoPage).
59
! Up and P work as page up, Down and N work as page down, Esc and Q work as
60
! exit, and [Space] will advance from page 0.
62
! This also checks pretty_flag, and produces a lowkey_Menu, which simply
63
! writes to the screen and asks for an N, P or Q. Lowkey menus will not
64
! start on page 0, but the player can pageup to them.
66
! If you have any trouble, or comments on this or any of my libraries,
67
! _please_ write me at rraszews@skipjack.bluecrab.org
68
! I'm always glad to hear from people using my libraries.
70
! Thanks to Graham Nelson for Inform, The Guys on R.A.I-F, and whoever
71
! told me that Inform 6.05 would actually _work_ on my story files.
75
[ WriteManual doman title titlel pagen pagel npages startp pnum flag;
76
if (pretty_flag==0) {LowKeyManual(doman,title,pagen,npages,startp); rtrue;};
79
switch(ManualPage(pnum,pagen-->pnum,pagel->pnum,title,titlel,doman))
84
if (pnum>npages) pnum=pnum--;}
86
print "^^Back to story...^^"; rtrue;
89
[ ManualPage mpage header l title titlel doman i j keypress;
90
i=0->33; if (i==0) i=80;
93
@split_window 3; @set_window 1; style reverse;
94
@set_cursor 1 1; spaces(i); @set_cursor 2 1; spaces(i); @set_cursor 3 1; spaces(i);
95
j=(i/2)-(titlel/2); @set_cursor 1 j;print (string) title;style bold;style reverse;
96
j=(i/2)-l;@set_cursor 2 j; print (string) header; style roman; style reverse;
97
@set_cursor 2 2; print "P = previous page";
98
j=i-13 ; @set_cursor 2 j; print "N = next page";
99
@set_cursor 3 2; print "Q = resume story";
100
@set_cursor 3 j; print "Page ", mpage;
101
@set_window 0; style roman; font on; indirect(doman,mpage); new_line;
102
do { @read_char 1 0 0 keypress;} until ((keypress==129 or 'P' or 'p' or 130
103
or 'N' or 'n' or 'q' or 'Q' or 27)
104
|| (keypress==32 or 10 or 13 && mpage==0));
106
if (keypress==129 or 'P' or 'p') return 0;
107
if (keypress==32 or 10 or 13 && mpage==0) return 1;
108
if (keypress==130 or 'N' or 'n') return 1;
109
if (keypress==27 or 'Q' or 'q') return 2;
112
[ LowKeyManual doman title pagen npages startp i j k;
113
if (startp==0) startp=1;
114
print "^^^"; print (string) title;
117
{ print (string) pagen-->j; print "^";
119
print "^^[Press ~N~ for the next page, ~P~ for the previous,
121
do {@read_char 1 0 0 i;} until (i=='N' or 'n' or 'P' or 'p' or 'Q' or 'q');
122
if (i=='N' or 'n') j++;
123
if (i=='P' or 'p') j--;
124
if (i=='Q' or 'q') k=1;