~ubuntu-branches/ubuntu/gutsy/inform/gutsy

« back to all changes in this revision

Viewing changes to include/adhints.txt

  • Committer: Bazaar Package Importer
  • Author(s): Mark Baker
  • Date: 2004-03-29 23:52:44 UTC
  • Revision ID: james.westby@ubuntu.com-20040329235244-fox1z1yv7d6vojoo
Tags: upstream-6.30
ImportĀ upstreamĀ versionĀ 6.30

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
[Last revision: January 31, 1996, AdHints v0.9]
 
2
 
 
3
REQUIREMENTS:
 
4
Library 5/12 (or later)
 
5
Inform 5.5 (or later)
 
6
NewMenu.h to replace DoMenu and LowKeyMenu
 
7
 
 
8
USING THE ADHINTS LIBRARY IN INFORM:
 
9
 
 
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. 
 
15
 
 
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"; 
 
19
 
 
20
They are:
 
21
Constant SHOWSOLVEDTAG;
 
22
Include "AdHints";
 
23
Include "ah_bal";
 
24
 
 
25
[In addition, to allow the menus to change dynamically and otherwise
 
26
 perform properly, you need to include NewMenu.h:
 
27
 
 
28
before including Parser:
 
29
  Replace Low_KeyMenu;
 
30
  Replace DoMenu;
 
31
 
 
32
then before including AdHints.h:
 
33
  Include "NewMenu";
 
34
 
 
35
otherwise there will be some undefined symbol problems. ]
 
36
 
 
37
A sample would be:
 
38
 
 
39
Object  Cottage_Puzzle "Cottage Puzzle" Hints
 
40
 has    general
 
41
 class  HintClass
 
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 \
 
46
                   looking.",
 
47
        hint_check [;
 
48
            if (h_box has moved) give self solved;
 
49
        ];
 
50
 
 
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 
 
53
moved, it is solved.
 
54
 
 
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).
 
59
 
 
60
A more complicated hint structure might be:
 
61
 
 
62
Object  Box_Puzzle "Box Puzzle" Hints
 
63
 class  HintClass
 
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 \
 
66
                   things."
 
67
                  "Of course, you might try looking at your spellbook."
 
68
                  "(The next hint is explicit)"
 
69
                  "Maybe the REZROV spell would be useful.",
 
70
        hint_check [;
 
71
            if (h_box has moved) give self general;
 
72
            if (h_box hasnt locked) give self solved;
 
73
        ];
 
74
 
 
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
 
77
considered solved. 
 
78
 
 
79
 
 
80
THE INTERFACE:
 
81
 
 
82
AdHints implements several new verbs (some of which are available only 
 
83
for debugging):
 
84
GENERAL:
 
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
 
89
DEBUGGING:
 
90
  Puzzles     -- lists all puzzles under the Hints object
 
91
  AllHints    -- shows every single hint
 
92
 
 
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). 
 
98
 
 
99
CUSTOMIZING:
 
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
 
102
them are: 
 
103
 
 
104
Constant variablename;
 
105
(e.g.  Constant GIVEHINTSONCE;  )
 
106
 
 
107
The variables are:
 
108
 
 
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. 
 
113
 
 
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. 
 
117
 
 
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
 
121
actually given. 
 
122
 
 
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. 
 
125
 
 
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. 
 
129
 
 
130
HINTDEBUGVERBS: This causes the debugging verbs to be available without
 
131
having all the debugging and tracing information displayed. 
 
132
 
 
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. 
 
137
 
 
138
 
 
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. 
 
148
 
 
149
COMMENTS:
 
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: 
 
161
 
 
162
    ftp://skaro.lawlib.wm.edu/pub/users/mike/inform-stuff/adhints/
 
163
 
 
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. 
 
166
 
 
167
SPECIAL NOTE:
 
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.
 
171
 
 
172