! HINTS Invisiclues-style Help menu ! "tool kit" fot Inform 5.5 or later by ! L. Ross Raszewski ! ! This file is not a hint generator, but it does provide some functions to ! help make a hint file. It performs the Infocom courtesy of offering the ! opertunity to disable the hints, and automatically displays hints that ! have already been read. This was tailored after some avid study of the ! invisiclues included with several Infocom games, and having made some ! changes for the sake of not needing to replace DoMenu. ! Before Inclusion, create an array Clues--> where Clues-->n is one less ! than the number of clues for the nth clue in your file. ! Create a function Main_Menu() to draw the first level of your hint system ! (using DoMenu, or such) ! Give your clue-giving functions three local variables (hint, cluesleft, flag) ! For each clue, have some code along the lines of: (n is the same as above, i ! is the literal value of Clues-->n. You'd use real numbers, but I won't) ! ! hint="The first hint"; ! flag=1; ! for(cluesleft=i:GiveHint(n,hint,cluesleft,flag)==0:cluesleft--) ! { flag=0; ! switch(cluesleft) ! {i: hint="The second hint to be revealed"; ! i-1: hint="and so on down to"; ! 1: hint="The Last Clue"; ! };};Clues-->n=Clues-->n+1; ! ! Just insert a piece like this into your code and GiveHint will produce text ! like: ! (Press Q to quit, or any other key for another hint) ! ! The First hint (i left) ! Pressing any key other than q or escape will print ! The second hint to be revealed (i-1 left) ! down to ! The Last Clue ! [That's All, Folks] ! ! If you exit the hint menu and then return, all previously revealed hints ! will be displayed as well. ! ! Set Clues-->0 to an initial value of 0, as it's used for internal purposes. ! This can probably be integrated into an adaptive hint system, though I ! haven't tried it. ! System_file; [ HelpSub; If (Clues-->0==0) {print "[Warning: It is recognized that the temptation for help \ may at times be so exceedingly strong that you might fetch hints \ prematurely. Therefore, you may at any time during the story type \ HINTS OFF, and this will disallow the seeking out of help for the \ present session of the story. If you still want a hint now, indicate \ HINT.]"; Clues-->0=1; rtrue;} If (Clues-->0==2) print_ret "Hints have been disabled."; Main_Menu(); ]; [ HelpOffSub; print "HINTS disabled."; Clues-->0=2; rtrue; ]; [ GiveHint h hint Clues_left flag keypress; if (flag==1) print "(Press Q to quit, any other key for another hint.)^^^^"; print (string) hint; if (Clues_left ~= 0) {print " (", Clues_left, " hint"; if (Clues_left > 1) print "s"; print " left.)";}; if (Clues_left==0) print "^^[That's all, folks]"; new_line; if (Clues_left~=Clues-->h) rfalse; Clues-->h=Clues-->h-1; @read_char 1 0 0 keypress; if (keypress == 'Q' or 'q' or 27 || Clues_left==0) rtrue; rfalse; ]; Verb meta "Help" "Hint" "hints" "clues" "clue" * "off" ->HelpOff * ->Help;