home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / bbs / trivial2 / trivia.scr < prev   
Text File  |  1985-12-30  |  30KB  |  1,082 lines

  1. script
  2. ;-------------------------------------------------------------------------
  3. ;
  4. ;               Trivial Pursuit Game
  5. ;
  6. ;             written by Keith Ledbetter
  7. ;     for BBS Express! ST Bulletin Board System
  8. ;
  9. ;                ******************
  10. ;                **  edited by:  **
  11. ;****************** Kolonel Kink ************************
  12. ;* Would appreciate it if you add my board to your list.*
  13. ;*   Compu-erotica BBS .. EXST .. 3/12 .. 312-425-6061  *
  14. ;********************************************************
  15. ;
  16. ;  o Some of these changes I didn't really need myself but
  17. ;    I read some of the comments on the ICD BBS from other
  18. ;    users and decided since I was going to rewrite it I
  19. ;    might as well include your ideas as options.
  20. ;
  21. ;  o I had to delete most of the program comments in order
  22. ;    to fit all my changes in one file.
  23. ;
  24. ;  o This script must be compiled with SC.TTP.
  25. ;
  26. ;  o Change the PATHNAME variable to your folder name.
  27. ;
  28. ;  o Change the HEADING variable to your BBS name.
  29. ;
  30. ;  o Change the ADD_LEVEL variable to the command security
  31. ;    level of users that you want to be able to add questions
  32. ;    to the trivia game.
  33. ;
  34. ;  o Change the SHOW_ANSWERS variable to your choice.  If set
  35. ;    to 'Y', then the user will be shown the correct answer to
  36. ;    any question that he misses.
  37. ;
  38. ;  o Change the WAIT_FOR_VALIDATION variable to your choice.
  39. ;    If set to 'N', then new questions added by users WILL NOT
  40. ;    be used until you edit the question files and change the
  41. ;    validated flags to 'Y'.   If WAIT_FOR_VALIDATION = 'N'
  42. ;    then newly added questions will be used immediately.
  43. ;
  44. ;  o Change the LOG_FILE variable to the full path/filename
  45. ;    where your system's log is located. If you specify 'Y'
  46. ;    to WAIT_FOR_VALIDATION you will get a flag in the log
  47. ;    letting you know you need to validate a question.
  48. ;
  49. ;  o Change the SYSOP_NAME variable to your handle. Even if
  50. ;    you specify 'Y' to WAIT_FOR_VALIDATION the questions
  51. ;    that you yourself enter will automatically be validated.
  52. ;
  53. ;  o Change MAX_QUESTIONS variable to 'N' if you don't want to
  54. ;    impose a limit to the number of questions in a game. Set
  55. ;    to the maximum number of questions you want a player to
  56. ;    be asked if you wish to make that restriction.
  57. ;
  58. ;  o Change MAX_TIME variable to 'N' if you don't want to
  59. ;    impose a time limit per game. Otherwise change to the
  60. ;    number of minutes you wish each game to last.
  61. ;
  62. ;  o Change SHOW_AUTHOR variable to 'Y' if you wish that the
  63. ;    person who entered the question is displayed along with
  64. ;    the question when it is asked. 'N' will not display the
  65. ;    author's name.
  66. ;
  67. ;  o Change the REPEATS variable to 'N' if you wish to dis-
  68. ;    qualify a category if all the questions were used in
  69. ;    the round. In this case if the number of eligible cat-
  70. ;    egories gets down to one the game is ended. If 'Y' the
  71. ;    questions will be repeated if encountered a 2nd time.
  72. ;
  73. ;  o If you would like to change the subjects in Trivial Pursuit
  74. ;    I heavily highlighted the sections you need to change.
  75. ;    You will need to specify the category name as well as the
  76. ;    filename for your new category.
  77. ;
  78. ;=========================================================================
  79. ;    If you make any changes to this script and reupload it to be shared
  80. ;  with other sysops, PLEASE update this 'program history block' area!
  81. ;
  82. ;  Revision Block
  83. ;
  84. ;   Date      Programmer      Modifications
  85. ; ---------------------------------------------------------------------
  86. ;  11-16-87   K. Ledbetter   Initial release.
  87. ;  11-17-87   K. Ledbetter   Added multiple possible answers (up to 3).
  88. ;  11-17-87   K. Ledbetter   Added switch to show correct answers.
  89. ;  12-08-87   K. Kink        Sysop's questions are validated regardless
  90. ;                            of validation setting.
  91. ;  12-09-87   K. Kink        Maximum number of questions per game may
  92. ;                            be set by sysop.
  93. ;  12-10-87   K. Kink        Maximum time per game may be set.
  94. ;  12-11-87   K. Kink        Author's name may be shown to player.
  95. ;  12-12-87   K. Kink        Option to disqualify repeat questions
  96. ;                            whithin a game.
  97. ;-------------------------------------------------------------------------
  98.  
  99. define  REPEATS      = 'N'              ;'Y' or 'N'.
  100. define  SHOW_AUTHOR  = 'Y'              ;'Y' or 'N'.
  101. define  SYSOP_NAME   = 'Sysop'          ;your handle.
  102. define  PATHNAME     = 'd:\trivia\'     ;where your files are.
  103. define  HEADING      = 'bbs'            ;your BBS name.
  104. define  ADD_LEVEL    = 1                ;level of users that can add ?'s.
  105. define  SHOW_ANSWERS = 'Y'              ;'Y' or 'N'.
  106. define  WAIT_FOR_VALIDATION = 'N'       ;'Y' or 'N'.
  107. define  MAX_QUESTIONS = 'N'             ;'N' or max.no. of questions per game.
  108. define  MAX_TIME      = 'N'             ;'N' or max.time limit per game.
  109. define  LOG_FILE     = 'c:log.dat'      ;full path/filename location of
  110.                                         ;system's log.
  111.  
  112. integer total_score          ;this user's score so far
  113. integer pt_value             ;how much next question is worth
  114. integer category             ;category we're asking from
  115. integer num_right            ;# correct answers
  116. integer num_wrong            ;# wrong answers
  117. integer video_width = '&11'
  118. integer itemp                ;temp work field
  119.  
  120. integer t1_cat               ;temp question fields
  121. integer t1_value
  122. integer t1_note
  123. string  t1_quest1
  124. string  t1_quest2
  125. string  t1_answer1
  126. string  t1_answer2
  127. string  t1_answer3
  128. string  t1_valid
  129. string  t1_author
  130.  
  131. integer c1_cat               ;category 1 data
  132. integer c1_value
  133. integer c1_note
  134. string  c1_quest1
  135. string  c1_quest2
  136. string  c1_answer1
  137. string  c1_answer2
  138. string  c1_answer3
  139. string  c1_valid
  140. string  c1_author
  141.  
  142. integer c2_cat               ;category 2 data
  143. integer c2_value
  144. integer c2_note
  145. string  c2_quest1
  146. string  c2_quest2
  147. string  c2_answer1
  148. string  c2_answer2
  149. string  c2_answer3
  150. string  c2_valid
  151. string  c2_author
  152.  
  153. integer sub_pos1             ;position in subject file 1
  154. integer sub_pos2             ;                    file 2
  155. integer sub_pos3             ;   "     "     "    file 3
  156. integer sub_pos4             ;                    file 4
  157. integer sub_pos5             ;   "     "     "    file 5
  158. integer sub_pos6             ;                    file 6
  159.  
  160. string  instr                ;generic input field
  161. string  quest1               ;question line 1
  162. string  quest2               ;         line 2
  163. string  the_answer1          ;the correct answers
  164. string  the_answer2          ;the correct answers
  165. string  the_answer3          ;the correct answers
  166. string  user_selection       ;selection from the menu
  167. string  question_filename    ;current file we're going after
  168. string  cat_name             ;name of a category
  169. string  authr                ;person who entered question
  170.  
  171. integer temp                 ;temp field
  172. integer store                ;used by sort routine
  173. integer pointer              ;  ..ditto..
  174. integer total_games          ;total rounds played
  175. integer count
  176. integer idx
  177. integer highest
  178. integer lockout              ;stops EOF lockout, I hope.
  179. define  number_of_questions  ;questions asked counter.
  180. define  time                 ;time comparator variable.
  181. define  time_left            ;time left in game.
  182. define  perm_note            ;note data
  183.  
  184. define flag1                 ;flags for category status
  185. define flag2
  186. define flag3
  187. define flag4
  188. define flag5
  189. define flag6
  190.  
  191. define stpt1                 ;starting point values
  192. define stpt2
  193. define stpt3
  194. define stpt4
  195. define stpt5
  196. define stpt6
  197.  
  198. define flag_count            ;flag accumulator
  199. define ind1                  ;disqualified questions
  200. define ind2
  201. define ind3
  202. define ind4
  203. define ind5
  204. define ind6
  205.  
  206. Main_processing:
  207.  
  208.    if time_exceeded then
  209.       exit
  210.    endif
  211.  
  212.    gosub header
  213.  
  214.    printe '\{\r1\b\}  Play Trivia           ' center
  215.    printe
  216.    printe '\{\r2\b\}  See the Hall of Fame  ' center
  217.    printe
  218.    printe '\{\r3\b\}  Add a Trivia Question ' center
  219.    printe
  220.    printe '\{\r4\b\}  Tips on Playing Trivia' center
  221.    printe
  222.    printe '\{\rX\b\}  Exit                  ' center
  223.    printe
  224.    print  'Your selection: '  center
  225.    input (user_selection, 1, noreturn)
  226.    if user_selection = 'x' then
  227.       exit
  228.    ef user_selection = '2' then
  229.       goto Display_Scores
  230.    ef user_selection = '3' then
  231.       goto Add_a_Question
  232.    ef user_selection = '4' then
  233.       goto Show_help_files
  234.    endif
  235.  
  236. Start_new_game:
  237.    clear screen
  238.    printe '\n\n\n\n'
  239.    print '\i  Initializing game...  \o' center
  240.  
  241.    gosub Get_positions
  242.    stpt1 = sub_pos1
  243.    stpt2 = sub_pos2
  244.    stpt3 = sub_pos3
  245.    stpt4 = sub_pos4
  246.    stpt5 = sub_pos5
  247.    stpt6 = sub_pos6
  248.    flag1 = 'OFF'
  249.    flag2 = 'OFF'
  250.    flag3 = 'OFF'
  251.    flag4 = 'OFF'
  252.    flag5 = 'OFF'
  253.    flag6 = 'OFF'
  254.  
  255.    total_games = 0
  256.    total_score = 0
  257.    num_right   = 0
  258.    num_wrong   = 0
  259.    if max_questions = 'N' then
  260.       number_of_questions = 1
  261.    else
  262.       number_of_questions = max_questions
  263.    endif
  264.    if max_time = 'N' then
  265.       time = 500
  266.    else
  267.       time = &32 + max_time
  268.    endif
  269.  
  270. Get_a_category:
  271.    if time_exceeded then
  272.       exit
  273.    endif
  274.    if repeats = 'Y' then
  275.       goto GC
  276.    endif
  277.    flag_count = 0
  278.    if flag1 = 'STOP' then
  279.       ind1 = '1'
  280.       flag_count = flag_count + 1
  281.    endif
  282.    if flag2 = 'STOP' then
  283.       ind2 = '2'
  284.       flag_count = flag_count + 1
  285.    endif
  286.    if flag3 = 'STOP' then
  287.       ind3 = '3'
  288.       flag_count = flag_count + 1
  289.    endif
  290.    if flag4 = 'STOP' then
  291.       ind4 = '4'
  292.       flag_count = flag_count + 1
  293.    endif
  294.    if flag5 = 'STOP' then
  295.       ind5 = '5'
  296.       flag_count = flag_count + 1
  297.    endif
  298.    if flag6 = 'STOP' then
  299.       ind6 = '6'
  300.       flag_count = flag_count + 1
  301.    endif
  302.    if flag_count = 5 then
  303.       goto flag_ex
  304.    endif
  305.  
  306. Get1:
  307.    instr = random (6)
  308.    gosub get_cat
  309.    if instr = 0 then
  310.       goto get1
  311.    endif
  312.    c1_cat = instr
  313.  
  314. Get2:
  315.    instr = random (6)
  316.    gosub get_cat
  317.    if instr = 0 then
  318.       goto get2
  319.    endif
  320.    If c1_cat = instr then
  321.       goto get2
  322.    endif
  323.    c2_cat = instr
  324.  
  325. Keep_going:
  326.    gosub header
  327.    if &32 > time then
  328.       goto max_time_ex
  329.    endif
  330.    instr = &32
  331.    if max_time # 'N' then
  332.       time_left = time - instr
  333.       printe '\g\i You have [time_left] minutes left in this game \o\b' center
  334.       printe
  335.    endif
  336.    if max_questions # 'N' then
  337.       printe '\g\i You have [number_of_questions] questions left \o\b' center
  338.       printe
  339.    endif
  340.    if number_of_questions = 0 then
  341.       goto max_questions_ex
  342.    endif
  343.    printe 'Your current score: [total_score]' center
  344.    printe
  345.    printe 'Right/wrong: [num_right]/[num_wrong]' center
  346.    printe
  347.    print '\i   Reading questions...   \o' center
  348.  
  349.    t1_cat = c1_cat
  350.    gosub Get_a_Question
  351.    c1_value  = t1_value
  352.    c1_quest1 = t1_quest1
  353.    c1_quest2 = t1_quest2
  354.    c1_answer1= t1_answer1
  355.    c1_answer2= t1_answer2
  356.    c1_answer3= t1_answer3
  357.    c1_valid  = t1_valid
  358.    c1_note   = t1_note
  359.    c1_author = t1_author
  360.  
  361.    t1_cat = c2_cat
  362.    gosub Get_a_Question
  363.    c2_value  = t1_value
  364.    c2_quest1 = t1_quest1
  365.    c2_quest2 = t1_quest2
  366.    c2_answer1= t1_answer1
  367.    c2_answer2= t1_answer2
  368.    c2_answer3= t1_answer3
  369.    c2_valid  = t1_valid
  370.    c2_note   = t1_note
  371.    c2_author = t1_author
  372.  
  373.    backspace 26
  374.    printe '\i Please choose a category \o'
  375.    printe
  376.  
  377.    category = c1_cat
  378.    gosub show_category
  379.    instr = cat_name
  380.    expand (instr, 19)
  381.    printe '1. [instr] ([c1_value] pts)' center
  382.  
  383.    category = c2_cat
  384.    gosub show_category
  385.    instr = cat_name
  386.    expand (instr, 19)
  387.    printe '2. [instr] ([c2_value] pts)' center
  388.  
  389.    printe
  390.    printe 'Q. Quit game                  ' center
  391.    printe
  392. Re_choice:
  393.    print 'Your choice? ' center
  394.    input (user_selection, 1, noreturn)
  395.    if max_questions # 'N' then
  396.       number_of_questions = number_of_questions - 1
  397.    endif
  398.    if user_selection = '1' then
  399.       category   = c1_cat
  400.       quest1     = c1_quest1
  401.       quest2     = c1_quest2
  402.       pt_value   = c1_value
  403.       the_answer1= c1_answer1
  404.       the_answer2= c1_answer2
  405.       the_answer3= c1_answer3
  406.       perm_note  = c1_note
  407.       authr      = c1_author
  408.    ef user_selection = '2' then
  409.       category   = c2_cat
  410.       quest1     = c2_quest1
  411.       quest2     = c2_quest2
  412.       pt_value   = c2_value
  413.       the_answer1= c2_answer1
  414.       the_answer2= c2_answer2
  415.       the_answer3= c2_answer3
  416.       perm_note  = c2_note
  417.       authr      = c2_author
  418.    ef user_selection = 'Q' then
  419.       goto Update_Score_File
  420.    else
  421.       goto re_choice
  422.    endif
  423.  
  424. Try_question:
  425.    if quest1 = 'Empty' then
  426.       printe
  427.       printe 'Sorry, that category is empty!' center
  428.       gosub any_key
  429.       goto get_a_category
  430.    endif
  431.  
  432.    gosub header
  433.    gosub show_category
  434.  
  435.    printe
  436.    printe 'Topic category: [cat_name]' center
  437.    printe
  438.    printe 'Point value: [pt_value]' center
  439.    printe
  440.    if show_author = 'Y' then
  441.       printe 'Asked by: [authr]'
  442.       printe
  443.    endif
  444.    printe 'The question:'
  445.    printe '-------------'
  446.    printe '   [quest1]'
  447.    printe '   [quest2]'
  448.    printe
  449.  
  450.    gosub write_positions
  451.  
  452.    print 'Your answer is: '
  453.    input (instr, 70, noreturn)
  454.    printe
  455.  
  456.    if instr = the_answer1
  457.       goto right_answer
  458.    ef instr = the_answer2
  459.       goto right_answer
  460.    ef instr = the_answer3
  461.       goto right_answer
  462.    else
  463.       goto wrong_answer
  464.    endif
  465.  
  466. Right_answer:
  467.    printe 'That answer is \rcorrect\b!' center
  468.    num_right = num_right + 1
  469.    total_score = total_score + pt_value
  470.    goto carry_on
  471.  
  472. Wrong_answer:
  473.    printe 'Sorry, that answer is \rwrong\b.' center
  474.    printe
  475.    num_wrong = num_wrong + 1
  476.    total_score = total_score - 1
  477.  
  478.    if SHOW_ANSWERS = 'Y' then
  479.      printe '\iThe correct answer is:\o' center
  480.      printe '[the_answer1]' center
  481.    endif
  482.  
  483.    goto carry_on
  484.  
  485. Carry_on:
  486.    if total_score > 999 then
  487.       total_score = 999
  488.    endif
  489.  
  490.    increase (total_games)
  491.    printe
  492.    gosub Any_key
  493.  
  494.    goto get_a_category
  495.  
  496. ;===============================================================
  497. ;   Allow the user to add a new question to the trivia file.
  498. ;===============================================================
  499.  
  500. Add_a_Question:
  501.    if Command_level (add_level)
  502.    else
  503.       printe
  504.       printe 'Sorry, you\"re not authorized for that!'
  505.       printe
  506.       gosub any_key
  507.       goto main_processing
  508.    endif
  509.    gosub Header
  510.    printe
  511.    printe 'Add a Trivia question' center
  512.    printe
  513.    printe '\i Add to which category? \o' center
  514.    printe
  515.  
  516. ;************************************************************************
  517. ;************************************************************************
  518.                                                                     ;****
  519.    printe '1.  Geography          ' center ;************************  **
  520.    printe '2.  Entertainment      ' center ;* Change these names to*  **
  521.    printe '3.  History            ' center ;* match your categories*  **
  522.    printe '4.  Arts and Liturature' center ;************************
  523.    printe '5.  Science and Nature ' center
  524.    printe '6.  Sports and Leisure ' center
  525.    printe
  526.    printe 'Q.  Quit               ' center
  527.  
  528. AQ_select:
  529.    printe
  530.    print  'Selection: ' center
  531.    input (instr, 1, noreturn)
  532.    if instr = 'Q'
  533.       goto main_processing
  534.    ef instr = '1'
  535.       question_filename = 'geogrphy.que'
  536.       category = 'Geography'
  537.    ef instr = '2'                          ;************************
  538.       question_filename = 'entrtain.que'   ;* You must also change *
  539.       category = 'Entertainment'           ;* these to go with any *
  540.    ef instr = '3'                          ;* category changes.    *
  541.       question_filename = 'history.que'    ;************************
  542.       category = 'History'
  543.    ef instr = '4'
  544.       question_filename = 'arts.que'
  545.       category = 'Arts and Literature'
  546.    ef instr = '5'
  547.       question_filename = 'science.que'
  548.       category = 'Science and Nature'
  549.    ef instr = '6'
  550.       question_filename = 'sports.que'
  551.       category = 'Sports and Leisure'                                ;**
  552.    else                                                              ;**
  553.       goto AQ_select                                                 ;** 
  554.    endif                                                             ;**
  555.                                                                     ;****
  556. ;************************************************************************
  557. ;************************************************************************
  558.  
  559.    gosub header
  560.    printe
  561.    printe 'Category: [category]' center
  562.    printe
  563.    printe
  564.    printe 'Enter your trivia question below.' center
  565.    printe
  566.    printe 'Two 70-column lines are allowed. ' center
  567.    printe
  568.    print '->'
  569.    input (c1_quest1, 70, noreturn)
  570.    print '->'
  571.    input (c1_quest2, 70)
  572.    printe
  573.    printe 'Enter up to 3 answers to this question'
  574.    printe '(ie: "Illinois", "IL", "ILL"):'
  575.    print '1->'
  576.    input (c1_answer1, 70)
  577.    print '2->'
  578.    input (c1_answer2, 70)
  579.    print '3->'
  580.    input (c1_answer3, 70)
  581.    printe
  582.  
  583. AQ_reval:
  584.    print 'Enter the point value (1-9): '
  585.    input (c1_value, 2, noreturn)
  586.    if c1_value = NUMERIC then
  587.    else
  588.       goto AQ_reval
  589.    endif
  590.    if c1_value < 1
  591.       goto AQ_reval
  592.    ef c1_value > 9
  593.       goto AQ_reval
  594.    endif
  595.  
  596.    gosub header
  597.    printe
  598.    printe
  599.    printe 'Question will be added as:'
  600.    printe
  601.    printe '\iQuestion:\o'
  602.    printe '   [c1_quest1]'
  603.    printe '   [c1_quest2]'
  604.    printe
  605.    printe '\iAnswer(s):\o'
  606.    printe '   [c1_answer1]'
  607.    printe '   [c1_answer2]'
  608.    printe '   [c1_answer3]'
  609.    printe
  610.    printe '\iPoint value\o is [c1_value] points'
  611.    printe
  612.    print 'Add this question to file (y/n)? '
  613.    input (instr, 1, noreturn)
  614.    if instr = 'N'
  615.       goto Add_a_Question
  616.    endif
  617.    printe
  618.    print 'Updating appropriate file...'
  619.  
  620.         open ('[pathname][question_filename]', append)
  621.  
  622.    if &1 # Sysop_name then
  623.       goto checkit
  624.       endif
  625.    fprinte 'Valid : Y'
  626.    goto passup
  627.  
  628. Checkit:
  629.    if WAIT_FOR_VALIDATION = 'y' then
  630.       fprinte 'Valid : N'
  631.    else
  632.       fprinte 'Valid : Y'
  633.    endif
  634.  
  635. Passup:
  636.    fprinte 'Points: [c1_value]'
  637.    fprinte 'Author: &1'
  638.    fprinte 'Quest1: [c1_quest1]'
  639.    fprinte 'Quest2: [c1_quest2]'
  640.    fprinte 'Answer: [c1_answer1]'
  641.    fprinte 'Answer: [c1_answer2]'
  642.    fprinte 'Answer: [c1_answer3]'
  643.    fprinte
  644.    close
  645.  
  646.    if &1 = sysop_name then
  647.       printe
  648.       gosub any_key
  649.       goto Add_a_question
  650.    endif
  651.  
  652.    if WAIT_FOR_VALIDATION = 'y' then
  653.       printe
  654.       printe
  655.       printe 'Thanks!  This question will be\vadded to the active game as'
  656.       printe 'soon as the SysOp validates it.'
  657.       printe
  658.  
  659. ;=========================================================================
  660. ; This section posts a flag to the system's log to show an added question
  661. ;=========================================================================
  662.  
  663.    open [Log_File] append
  664.    fprinte '************************* NEW QUESTION IN [question_filename]'
  665.    close
  666.    gosub any_key
  667.    endif
  668.  
  669.    goto Add_a_question
  670.  
  671. ;===============================================================
  672. ;            Show the current Hall of Fame to the user
  673. ;===============================================================
  674. Display_Scores:
  675.    gosub header
  676.    printe '\rTrivia Hall of Fame\b'  Center
  677.    clear (table)
  678.    count = table_load ('[Pathname]TrScore.Dat')
  679.    printe
  680.    printe '\b   User\"s Name         Date    Score' Center
  681.    printe '\g--------------------- --------  -----\b' Center
  682.    for idx = 1 to count do
  683.       temp = table_get (idx)
  684.       Expand (temp, 35)
  685.       if idx = 1 then
  686.          printE '\r[temp]\b'  center
  687.       else
  688.          printE 'temp' center
  689.       endif
  690.    endfor
  691.    printe
  692.    print 'Press <\rRETURN\b> To Continue..' Center
  693.    input temp 1
  694.    goto main_processing
  695.  
  696. ;===============================================================
  697. ;         See if this user made it into the Hall of Fame.
  698. ;===============================================================
  699.  
  700. Update_Score_File:
  701.    if total_games = 0 then
  702.       goto Display_Scores
  703.    endif
  704.    gosub header
  705.    printe '\rTrivia Hall of Fame\b' Center
  706.    printe
  707.    print 'Checking Your Score...' center
  708.    clear (table)
  709.    count = table_load ('[Pathname]TrScore.Dat')
  710.    pointer = 20
  711.    for idx = 1 to 10 do
  712.       temp = table_get (idx)
  713.       temp = copy (temp, 33, 3)
  714.       table_put (pointer, temp)
  715.       increase (pointer)
  716.    endfor
  717.    for idx = 20 to 29 do
  718.       itemp = table_get (idx)
  719.       if total_score > itemp then
  720.          break
  721.       endif
  722.    endfor
  723.    if idx < 30 then
  724.       goto Enter_Hall
  725.    endif
  726.  
  727.    printe '\n'
  728.    printe 'Sorry, your score isn\"t in the Top 10' center
  729.    printe
  730.    print 'Press <\rRETURN\b> To Continue..' center
  731.    input temp 1
  732.    goto Display_Scores
  733.  
  734. Enter_Hall:
  735.    Bell
  736.    printe '\n'
  737.    printe 'You made it into the Hall of Fame!!' center
  738.    printe
  739.    print 'Inserting your name into the books...' Center
  740.  
  741.    highest = total_score
  742.    pointer = 0
  743.    for idx = 20 to 29 do
  744.       itemp = table_get (idx)
  745.       if itemp < highest then
  746.          highest = itemp
  747.          pointer = idx
  748.       endif
  749.    endfor
  750.    table_put (pointer, total_score)
  751.    itemp = pointer - 19
  752.    temp = '&1'
  753.    temp = copy (temp, 1, 21)
  754.    Expand (temp, 22)
  755.    table_put (itemp, '[temp]&24  [total_score]')
  756.  
  757.    gosub Sort_Scores
  758.  
  759.    open ('[Pathname]TrScore.Dat', Output)
  760.    for idx = 50 to 59 do
  761.       temp = table_get (idx)
  762.       fprintE temp
  763.    endfor
  764.    close
  765.    goto Display_Scores
  766.  
  767. Sort_Scores:
  768.    store   = 40
  769. Sort:
  770.    highest = ' '
  771.    pointer = 0
  772.    for idx = 20 to 29 do
  773.       temp = table_get (idx)
  774.       if temp > highest then
  775.          highest = temp
  776.          pointer = idx
  777.       endif
  778.    endfor
  779.    temp = table_get (pointer)
  780.    table_put (store, temp)
  781.    table_put (pointer, '   ')
  782.    itemp = pointer - 19
  783.    temp = table_get (itemp)
  784.    itemp = store + 10
  785.    table_put (itemp, temp)
  786.    increase (store)
  787.    if store < 50 then
  788.       goto sort
  789.    endif
  790. return
  791.  
  792. Get_a_question:
  793.    lockout = 0
  794.  
  795. ;************************************************************************
  796. ;************************************************************************
  797.                                                                     ;****
  798.    if t1_cat = 1                                                     ;**
  799.       question_filename = 'geogrphy.que'                             ;**
  800.    ef t1_cat = 2                            ;*********************    **
  801.       question_filename = 'entrtain.que'    ;* More changes for  *    **
  802.    ef t1_cat = 3                            ;* a category switch.*
  803.       question_filename = 'history.que'     ;*********************
  804.    ef t1_cat = 4
  805.       question_filename = 'arts.que'
  806.    ef t1_cat = 5
  807.       question_filename = 'science.que'                              ;**
  808.    else                                                              ;**
  809.       question_filename = 'sports.que'                               ;**
  810.    endif                                                             ;**
  811.                                                                     ;****
  812. ;************************************************************************
  813. ;************************************************************************
  814.  
  815.    if file_exists ('[pathname][question_filename]') then
  816.    else
  817.       t1_value = 0
  818.       t1_quest1 = 'Empty'
  819.       t1_quest2 = ''
  820.       t1_answer1= ''
  821.       t1_answer2= ''
  822.       t1_answer3= ''
  823.       t1_author = ''
  824.       RETURN
  825.    endif
  826.  
  827.    open ('[pathname][question_filename]', input)
  828.  
  829.    if t1_cat = 1
  830.       POINT (sub_pos1)
  831.    ef t1_cat = 2
  832.       POINT (sub_pos2)
  833.    ef t1_cat = 3
  834.       POINT (sub_pos3)
  835.    ef t1_cat = 4
  836.       POINT (sub_pos4)
  837.    ef t1_cat = 5
  838.       POINT (sub_pos5)
  839.    else
  840.       POINT (sub_pos6)
  841.    endif
  842.  
  843. GQ_read:
  844.    finput t1_valid
  845.    finput t1_value
  846.    finput t1_author
  847.    finput t1_quest1
  848.    finput t1_quest2
  849.    finput t1_answer1
  850.    finput t1_answer2
  851.    finput t1_answer3
  852.    finput instr
  853.  
  854.    t1_valid = copy (t1_valid, 9,99)
  855.    if t1_valid = 'N' then
  856.       goto GQ_read
  857.    endif
  858.    NOTE (t1_note)
  859.    close
  860.  
  861.    t1_value  = copy (t1_value, 9,99)
  862.    t1_quest1 = copy (t1_quest1,9,99)
  863.    t1_quest2 = copy (t1_quest2,9,99)
  864.    t1_answer1= copy (t1_answer1,9,99)
  865.    t1_answer2= copy (t1_answer2,9,99)
  866.    t1_answer3= copy (t1_answer3,9,99)
  867.    t1_author = copy (t1_author,9,99)
  868.  
  869.    if t1_value > 10 then
  870.       t1_value = 9
  871.    endif
  872.  
  873. return
  874. ;  ------------------------------------------------------------
  875. ;  we hit end-of-file on the read, so go back to start of file.
  876. ;  ------------------------------------------------------------
  877. EOF:
  878.    lockout = lockout + 1
  879.    if lockout > 2
  880.       t1_value = 0
  881.       t1_quest1 = 'Empty'
  882.       t1_quest2 = ''
  883.       t1_answer1= ''
  884.       t1_answer2= ''
  885.       t1_answer3= ''
  886.       t1_author = ''
  887.       close
  888.       RETURN
  889.    endif
  890.  
  891.    if t1_cat = 1
  892.       sub_pos1 = 0
  893.    ef t1_cat = 2
  894.       sub_pos2 = 0
  895.    ef t1_cat = 3
  896.       sub_pos3 = 0
  897.    ef t1_cat = 4
  898.       sub_pos4 = 0
  899.    ef t1_cat = 5
  900.       sub_pos5 = 0
  901.    else
  902.       sub_pos6 = 0
  903.    endif
  904.    POINT 0
  905.    goto GQ_read
  906.  
  907. Show_category:
  908.    cat_name = ''
  909.  
  910. ;************************************************************************
  911. ;************************************************************************
  912.                                                                     ;****
  913.    if category = 1                                                   ;**
  914.       cat_name = 'Geography'                                         ;**
  915.    ef category = 2                                                   ;**
  916.       cat_name = 'Entertainment'      ;***************************    **
  917.    ef category = 3                    ;* Rename if you decide to *
  918.       cat_name = 'History'            ;* change categories.      *
  919.    ef category = 4                    ;***************************
  920.       cat_name = 'Arts and Literature'
  921.    ef category = 5
  922.       cat_name = 'Science and Nature'
  923.    else                                                              ;**
  924.       cat_name = 'Sports and Leisure'                                ;**
  925.    endif                                                             ;**
  926. return                                                               ;**
  927.                                                                     ;****
  928. ;************************************************************************
  929. ;************************************************************************
  930.  
  931. Get_Positions:
  932.    if file_exists ('[pathname]trstart.dat')
  933.       open ('[pathname]trstart.dat', input)
  934.       finput sub_pos1
  935.       finput sub_pos2
  936.       finput sub_pos3
  937.       finput sub_pos4
  938.       finput sub_pos5
  939.       finput sub_pos6
  940.       close
  941.    else
  942.       sub_pos1 = 0
  943.       sub_pos2 = 0
  944.       sub_pos3 = 0
  945.       sub_pos4 = 0
  946.       sub_pos5 = 0
  947.       sub_pos6 = 0
  948.    endif
  949. return
  950.  
  951. Write_Positions:
  952.    if category = 1
  953.       sub_pos1 = perm_note
  954.    ef category = 2
  955.       sub_pos2 = perm_note
  956.    ef category = 3
  957.       sub_pos3 = perm_note
  958.    ef category = 4
  959.       sub_pos4 = perm_note
  960.    ef category = 5
  961.       sub_pos5 = perm_note
  962.    else
  963.       sub_pos6 = perm_note
  964.    endif
  965.         
  966.    if category = 1                 
  967.       goto test1
  968.    ef category = 2
  969.       goto test2
  970.    ef category = 3
  971.       goto test3
  972.    ef category = 4
  973.       goto test4
  974.    ef category = 5
  975.       goto test5
  976.    else
  977.       goto test6
  978.    endif
  979.  
  980. Test1:
  981.    if flag1 = 'STOP' then
  982.       goto cont
  983.    else
  984.       flag1 = 'ON'
  985.       goto cont
  986.    endif
  987. Test2:
  988.    if flag2 = 'STOP' then
  989.       goto cont
  990.    else
  991.       flag2 = 'ON'
  992.       goto cont
  993.    endif
  994. Test3:
  995.    if flag3 = 'STOP' then
  996.       goto cont
  997.    else
  998.       flag3 = 'ON'
  999.       goto cont
  1000.    endif
  1001. Test4:
  1002.    if flag4 = 'STOP' then
  1003.       goto cont
  1004.    else
  1005.       flag4 = 'ON'
  1006.       goto cont
  1007.    endif
  1008. Test5:
  1009.    if flag5 = 'STOP' then
  1010.       goto cont
  1011.    else
  1012.       flag5 = 'ON'
  1013.       goto cont
  1014.    endif
  1015. Test6:
  1016.    if flag6 = 'STOP' then
  1017.       goto cont
  1018.    else
  1019.       flag6 = 'ON'
  1020.       goto cont
  1021.    endif
  1022.  
  1023. Cont:
  1024.    if sub_pos1 # stpt1 then
  1025.       goto n1
  1026.    endif
  1027.    if flag1 = 'ON' then
  1028.       flag1 = 'STOP'
  1029.       goto cont1
  1030.    endif
  1031. N1:
  1032.    if sub_pos2 # stpt2 then
  1033.       goto n2
  1034.    endif
  1035.    if flag2 = 'ON' then
  1036.       flag2 = 'STOP'
  1037.       goto cont1
  1038.    endif
  1039. N2:
  1040.    if sub_pos3 # stpt3 then
  1041.       goto n3
  1042.    endif
  1043.    if flag3 = 'ON' then
  1044.       flag3 = 'STOP'
  1045.       goto cont1
  1046.    endif
  1047. N3:
  1048.    if sub_pos4 # stpt4 then
  1049.       goto n4
  1050.    endif
  1051.    if flag4 = 'ON' then
  1052.       flag4 = 'STOP'
  1053.       goto cont1
  1054.    endif
  1055. N4:
  1056.    if sub_pos5 # stpt5 then
  1057.       goto n5
  1058.    endif
  1059.    if flag5 = 'ON' then
  1060.       flag5 = 'STOP'
  1061.       goto cont1
  1062.    endif
  1063. N5:
  1064.    if sub_pos6 # stpt6 then
  1065.       goto cont1
  1066.    endif
  1067.    if flag6 = 'ON' then
  1068.       flag6 = 'STOP'
  1069.       goto cont1
  1070.    endif
  1071.  
  1072. Cont1:
  1073.    open ('[pathname]trstart.dat', append)
  1074.    point 0
  1075.    fprinte '[sub_pos1]'
  1076.    fprinte '[sub_pos2]'
  1077.    fprinte '[sub_pos3]'
  1078.    fprinte '[sub_pos4]'
  1079.    fprinte '[sub_pos5]'
  1080.    fprinte '[sub_pos6]'
  1081.    close
  1082. ret