home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 2 / FFMCD02.bin / new / amigalibdisks / disk950 / bbdoors / bbdoors65.lha / rexxDoors / Hollywood_Squares.rexx < prev    next >
OS/2 REXX Batch file  |  1993-08-07  |  21KB  |  577 lines

  1. /*********************************************************
  2. *                                                         *
  3. *    Hollywood Squares 2.1 (C) 1991 Barry Christiansen    *
  4. *                A trivia game for SKYLINE                *
  5. *                                                         *
  6. *    This ARexx script is freely ditributable but not     *
  7. *   in the Public Domain.  You may use this script for    *
  8. *  any purpose you see fit other than that of generating  *
  9. *                        a profit.                        *
  10. *                                                         *
  11. *   Disclaimer: I hearby proclaim I am NOT responsible    *
  12. *  accountable, ammenable, answerable or liable for any   *
  13. *  damage this software may cause you and your children   *
  14. *              or you children's children.                *
  15. *                                                         *
  16. *                      Call THE HOST                      *
  17. *                     (605) 697-5653                      *
  18. *                                                         *
  19. *  Rewritten for BBBBS by Richard Lee Stockton 14-Apr-91  *
  20. *                                                         *
  21. *          ANSI ENHANCED VERSION BY Rick Lembrée          *
  22. *                                                         *
  23. *  ANSI version adapted to BBBBS by Matt English 1-13-93  *
  24. *                                                         *
  25. **********************************************************/
  26.  
  27. CR='0D'x
  28. CALL TIME('R')
  29. SIGNAL ON SYNTAX
  30. SIGNAL ON BREAK_C
  31. SIGNAL ON BREAK_E
  32.  
  33. PARSE ARG UserName . . colorflag secs .
  34. IF secs='' THEN secs=3600
  35. bbspath=GETCLIP('BBS_path')
  36.  
  37. bbsname =     'the BBS'                   /* The name of your BBS                */
  38. sysopname =   '+ AMIGA +'                 /* The name the Sysop goes by          */
  39. HSData = bbspath'rexxDoors/Data/HS.Users' /* location of user data               */
  40. HSQuestions = bbspath'rexxDoors/Data/'    /* location of questions file          */
  41. Qfiles=       4                           /* Number of questions files available */
  42. TotalPlays =  5                           /* How many plays per day              */
  43.  
  44.  
  45. if ~show('L','rexxsupport.library') then do
  46.   addlib('rexxsupport.library',0,-30,0)
  47. end
  48.  
  49. if colorflag = 1 then do
  50.  
  51. say' Colors on!'cr
  52.  
  53.   RED = '';  GRN = '';  YEL = '';  BLU = '';  MAG = '';  CYA = '';  BLK = '';  BAK = '';  OFF = '' ;  BSLF = 'DB'
  54.   P7='H3H';P8='9H';P9='5H';P4='3H';P5='9H';P6='5H';P1='33H';P2='39H';P3='45H'
  55.   CLS = 'H';bak1 = ''
  56.   P11='1H';P12='H';CLEOL=''
  57.   BIGX = ''YEL'   'BSLF' X 'BSLF'   '; BIGO = ''MAG'   'BSLF' O 'BSLF'   '
  58. end
  59. else do
  60.   RED = '';  GRN = '';  YEL = '';  BLU = '';  MAG = '';  CYA = '';  BAK = '';  BLK = '';  OFF = '';  CLS = CR''CR
  61.   P11 = CR; P12 = CR;CLEOL='';bak1= ''
  62.   BIGX = '    X    '; BIGO = '    O    '
  63. end
  64.  
  65. UserName2 = center(UserName,26) 
  66. UserWins = 0; OtherWins = 0; UserLoses = 0; OtherLoses = 0
  67. RePlay = 0; i = random(1,999,time('S')) /* initalize random number generator */
  68. call Intro
  69. CALL delay(100)
  70. OPTIONS PROMPT CR'                        Do You Need Instructions (Y/N)? '
  71. call Hotkey
  72. if answer = 'Y'  then call Instructions
  73. OPTIONS PROMPT CR'            Do You Want To See Hollywood Squares User Stats (Y/N)? '
  74. call Hotkey
  75. if answer = 'Y' then call ShowList
  76.  
  77.   
  78.   /* Main program body follows */
  79.   
  80. MAIN:
  81. say''cls''cr
  82. CALL TRANSMIT CR''GRN'Getting questions ready, Hold on...'
  83. filenum = random(1,Qfiles)
  84. address command 'copy 'hsquestions||'Questions'||filenum' RAM:Questions'
  85. CALL OPEN('Qdata','Ram:Questions','R')
  86. i = 0
  87. do until eof('Qdata')
  88.   do j = 1 to 6
  89.     line = readln('Qdata')
  90.   end
  91.   i = i+1
  92. end
  93. CALL CLOSE('Qdata')
  94. TQuestions = i-1
  95. over = 0
  96. call OpenThings
  97. do i = 1 to 9
  98.   SQ.i = ''
  99. end
  100. call Refresh
  101. do forever
  102.   CALL checkBBS()
  103.   /* select a square and check if valid */
  104.   
  105.   validsquare = 0
  106.   do while validsquare = 0
  107.     squarec = '' 
  108.     do while squarec < '1' | answer > '9'
  109.  
  110.       say''P12'                    '
  111.  
  112.       OPTIONS PROMPT ''BLU''P12' Select A Square: 'GRN
  113.  
  114.       call Hotkey; squarec = answer
  115.       if squarec = 'R' then call Refresh
  116.     end
  117.     squaren = value(squarec)
  118.     if SQ.squaren = '' then validsquare = 1
  119.     if validsquare = 0 then do
  120.       CALL TRANSMIT ''RED'Invalid square!               '
  121.       CALL delay(50)
  122.     end
  123.   end
  124.  
  125.   /* Select a random question */
  126.   
  127.   CALL TRANSMIT YEL''P11'Loading question.....'
  128.   RanQ = RANDOM(1,TQuestions)
  129.   CALL OPEN('Qdata','Ram:Questions','R')
  130.   Qcount = 1
  131.   do until eof('Qdata')
  132.     if RanQ = Qcount then do
  133.       Question = readln('Qdata')
  134.       do i = 1 to 4
  135.         answer.i = readln('Qdata')
  136.       end
  137.       line = readln('Qdata')
  138.       leave
  139.     end
  140.     else do i = 1 to 6
  141.       line = readln('Qdata')
  142.     end
  143.   Qcount = Qcount + 1
  144.   end
  145.   CALL CLOSE('Qdata')
  146.   
  147.   /* Display the Question and randomize the answers */
  148.   
  149.   CALL TRANSMIT ''P11''Question''OFF''
  150.   firsttime = 0
  151.   do i = 4 to 1 by -1
  152.     j = random(1,i)
  153.     Pick.i = answer.j
  154.     if j = 1 & firsttime = 0 then do
  155.       CorrectAnswer = i
  156.       firsttime = 1
  157.     end
  158.     if j < i then do x = j to i-1
  159.       xx = x + 1
  160.       answer.x = answer.xx
  161.     end
  162.   end
  163.   CALL TRANSMIT ' '
  164.   do i = 1 to 4
  165.     CALL TRANSMIT ''BLU'['i'] - 'Pick.i
  166.   end
  167.   Guess = '';rfrsh = 0
  168.   do while Guess < '1' | Guess > '4'
  169.     say''P12'                    '
  170.     OPTIONS PROMPT YEL''P12'Enter Your Guess: 'BLU
  171.     call Hotkey
  172.     Guess = answer
  173.     if Guess = 'R' then do
  174.       call Refresh
  175.       CALL TRANSMIT CYA''P11''Question
  176.       CALL TRANSMIT ' '
  177.       do i = 1 to 4
  178.         CALL TRANSMIT YEL'['i'] - 'BLU''Pick.i
  179.       end
  180.     end
  181.   end
  182.   XO = BIGO; who = MAG'O'
  183.   SQ.squaren = XO
  184.   whostring = P11''GRN'Correct!  'who''BLU'  Gets the Square!'CLEOL
  185.   if Guess ~= CorrectAnswer then do
  186.     XO = BIGX; who = YEL'X'
  187.     SQ.squaren = XO
  188.     whostring = P11''RED'Incorrect!  'who''BLU'  Gets the Square!   'CYA'The correct answer was 'YEL''CorrectAnswer''CLEOL''
  189.     call check
  190.     if win = 'yes' then do
  191.       whostring = P11''RED'Incorrect!  'GRN'The Square remains open!  'CYA'The correct answer was 'YEL''CorrectAnswer''CLEOL''
  192.       SQ.squaren = ''; XO = 'null'
  193.     end
  194.   end
  195.   CALL TRANSMIT whostring||CR
  196.   CALL delay(100)
  197.   if colorflag = 1 then do
  198.     do i = 1 to 5
  199.       CALL TRANSMIT CLEOL
  200.     end
  201.   end
  202.   call clear11
  203.   if colorflag = 1 then CALL TRANSMIT P7''SQ.7''P8''SQ.8''P9''SQ.9''P4''SQ.4''P5''SQ.5''P6''SQ.6''P1''SQ.1''P2''SQ.2''P3''SQ.3
  204.   else call VanillaDisplay
  205.   call Check
  206.   if win = 'yes' then call won
  207.   if win = 'tie' then call tie
  208.   if Over = 1 then leave
  209.  
  210.  
  211.   validsquare = 0
  212.   do while validsquare = 0
  213.     rannum = RANDOM(1,9)
  214.     if SQ.rannum  = '' then validsquare = 1
  215.   end
  216.   Both = BIGO
  217.   call BestBet
  218.   Both = BIGX
  219.   call BestBet
  220.   squaren = rannum
  221.   Correct = RANDOM(1,2)
  222.   if Correct = 1 then do
  223.     XO = BIGX; who = YEL'X'
  224.     whostring = P11''who''BLU'  Gets the Square!'CLEOL
  225.     SQ.squaren = XO
  226.     CALL TRANSMIT P11''CYA''subword(OtherName,1,1)' Goes For #'squaren' and answers his question'GRN' CORRECTLY!'
  227.  
  228.     CALL delay(100)
  229.   end
  230.   else do
  231.     XO = BIGO; who = MAG'O'
  232.     whostring = P11''who''BLU'  Gets the Square!'CLEOL
  233.     SQ.squaren = XO
  234.     CALL TRANSMIT P11''CYA''subword(OtherName,1,1)' Goes For #'squaren' and answers his question'RED' INCORRECTLY!'
  235.     CALL delay(100)
  236.     call check
  237.     if win = 'yes' then do
  238.       whostring = P11''GRN'The Square remains open!'CLEOL
  239.       SQ.squaren = ''; XO = 'null'
  240.     end
  241.   end
  242.   CALL TRANSMIT whostring
  243.   CALL delay(100)
  244.  
  245.   call clear11
  246.   if colorflag = 1 then CALL TRANSMIT P7''SQ.7''P8''SQ.8''P9''SQ.9''P4''SQ.4''P5''SQ.5''P6''SQ.6''P1''SQ.1''P2''SQ.2''P3''SQ.3
  247.   else call VanillaDisplay
  248.   call Check
  249.   if win = 'yes' then call won
  250.   if win = 'tie' then call tie
  251.   if Over = 1 then leave
  252.  end
  253.  
  254. RePlay = RePlay + 1
  255. if RePlay = TotalPlays then do
  256.   CALL TRANSMIT RED''P11'You Have Used All Your Turns For This Session!'
  257.   CALL delay(50)
  258.   signal BYE
  259.  end
  260. OPTIONS PROMPT BLU''P11'Do You Want To Play Again (Y/N)? 'GRN
  261. call Hotkey
  262. if answer = 'Y' then signal MAIN:
  263. signal BYE
  264.  
  265. Refresh:
  266.  
  267. if colorflag =