1
[Last revision: January 31, 1996, AdHints v0.9]
4
Library 5/12 (or later)
6
NewMenu.h to replace DoMenu and LowKeyMenu
8
USING THE ADHINTS LIBRARY IN INFORM:
10
In practice, one declares a series of objects, all contained within an
11
object called Hints, with the name of the puzzle in short_name, a property
12
called 'the_hints' which contains one or more strings to act as the
13
(consecutive) hints, and a hint_check routine to set general and solved
14
based on the status of the game.
16
All adaptive hint examples are for the demonstration game BALANCES. The
17
adaptive hints are contained in a file called ah_bal.h and three lines
18
were added before the line Include "Grammar";
21
Constant SHOWSOLVEDTAG;
25
[In addition, to allow the menus to change dynamically and otherwise
26
perform properly, you need to include NewMenu.h:
28
before including Parser:
32
then before including AdHints.h:
35
otherwise there will be some undefined symbol problems. ]
39
Object Cottage_Puzzle "Cottage Puzzle" Hints
42
with short_name "What to do in the Cottage",
43
the_hints "Maybe you should look around some."
44
"Perhaps you should even try looking at objects in the room."
45
"In fact, the furniture might be a good place to start \
48
if (h_box has moved) give self solved;
51
Notice that it starts with general (which means that it is available to the
52
player from the very beginning), and that as soon as the h_box has been
55
It is probably a good idea to point out that the hint_check routine is
56
run in an AfterPrompt() routine within AdHints.h, so special precautions
57
should probably be taken if you define your own AfterPrompt() (for boxed
58
quotations, for example).
60
A more complicated hint structure might be:
62
Object Box_Puzzle "Box Puzzle" Hints
64
with short_name "What to do with the box",
65
the_hints "Hmmm, I wonder if there isn't a useful ability to unlock \
67
"Of course, you might try looking at your spellbook."
68
"(The next hint is explicit)"
69
"Maybe the REZROV spell would be useful.",
71
if (h_box has moved) give self general;
72
if (h_box hasnt locked) give self solved;
75
Notice that the hint_check routine causes the hint to be available after
76
h_box has been moved, and as soon as it is unlocked, the puzzle is
82
AdHints implements several new verbs (some of which are available only
85
Hint, Hints -- goes into the hints system
86
Hints off -- disables hints for the remainder of the game
87
Hints on -- parity routine, doesn't actually re-enable the hints
88
Review -- looks at past hints
90
Puzzles -- lists all puzzles under the Hints object
91
AllHints -- shows every single hint
93
If the player uses 'Hints off', the hints will be unavailable for the
94
remainder of the game *regardless* of the use of 'Hints on'. This is
95
preserved over saved games since the state is saved in a global variable
96
called AH_hints_available. Set this to 1 if you need to re-enable hints
97
for some reason (for instance, in an AMUSING routine).
100
The easiest way to customize the behavior of the adaptive hints system
101
is to define one or more constants/variables. The 'correct' way to define
104
Constant variablename;
105
(e.g. Constant GIVEHINTSONCE; )
109
GIVEHINTSONCE: This causes a hint to be given by the hint verb only once.
110
This is a particular nuisance (from the player's perspective) if
111
NOHINTREVIEW is also defined, since the hints will be given but a single
112
time and be utterly unretrievable afterwards.
114
NOHINTREVIEW: This disables the Review verb. It does not disable the
115
ReviewSub() routine, so the programmer may call it up (say, at the end of
116
the game) somewhere else in the code.
118
REVIEWGIVENONLY: The default behavior is for Review to display any hints
119
which have been given and any hints for puzzles which have been solved.
120
Defining this causes Review to display only those hints which were
123
SHOWSOLVEDTAG: If defined, this causes the string "(solved)" to appear
124
after any hint title in the Review menu if the puzzle has been solved.
126
HINTDEBUG: This causes extra internal information to be displayed and
127
allows access to debugging verbs. Probably not useful unless you are
128
hacking at the actual hints system.
130
HINTDEBUGVERBS: This causes the debugging verbs to be available without
131
having all the debugging and tracing information displayed.
133
NOTE: The defines modify the behavior at compile-time! That means that
134
(for instance) the "(solved)" tag either appears or doesn't. This may
135
change in future versions if interest is expressed, but it doesn't seem
136
worth the space trade-off, in my opinion.
139
INSIDE THE ADAPTIVE HINTS:
140
The source code can, of course, be examined. The brief overview is
141
that there is an AfterPrompt() routine which executes AH_UpdateHints() in
142
order to run hint_check on each hint object each turn. If you define your
143
own AfterPrompt(), call it AfterPrompt2 and make certain it is defined
144
before including AdHints.h.
145
Each hint should be declared as being of class HintClass (although
146
that does practically nothing as of yet -- this will probably change as
147
the system improves) to pick up appropriate defaults.
150
I have tried to make a general, useful adaptive hints module, and I
151
think I have succeeded to a certain extent. However, I'm sure I missed
152
some things, and I would appreciate comments, criticisms, corrections,
153
suggestions, bug fixes, bug reports, and anything else which might improve
154
the module. Yes, it's pretty large, but it's a pretty large task that's
155
being done. I'm not 100% sure of my paging code, but it survived my
156
testing, and I'm sure the source code could be a little more elegant, and
157
I'd like to not have to replace the DoMenu stuff, so I have submitted my
158
minor corrections to Parser.h.
159
Commentary of any sort should be mailed to mike@lawlib.wm.edu and the
160
'correct' home site is:
162
ftp://skaro.lawlib.wm.edu/pub/users/mike/inform-stuff/adhints/
164
After a first round of review, barring extremely major complications,
165
AdHints.h will be uploaded to ftp.gmd.de as a 1.0 release.
168
To allow use in the 1996 IF Competition without waiting for me to
169
finish up the last couple of things I want, I am releasing 0.92 to
170
FTP.GMD.DE for that specific and express purpose.