/* $VER: TA-Trivia v1.6 (10/26/95) for TransAmiga by John Kratz Fidonet 1:260/322.0, Internet jkratz@erc.cat.syr.edu */ options results signal on syntax signal on error signal on ioerr /*************************************************************************/ /* Sysop Configurable variables */ oneright=0 /* Number of minutes to add for 1 right answers */ tworight=0 /* Number of minutes to add for 2 right answers */ threeright=0 /* Number of minutes to add for 3 right answers */ fourright=5 /* Number of minutes to add for 4 right answers */ fiveright=5 /* Number of minutes to add for 5 right answers */ sixright=5 /* Number of minutes to add for 6 right answers */ sevenright=5 /* Number of minutes to add for 7 right answers */ eightright=10 /* Number of minutes to add for 8 right answers */ nineright=20 /* Number of minutes to add for 9 right answers */ tenright=30 /* Number of minutes to add for 10 right answers */ /* Make sure this matches the # question files */ total=304 /* total number of question files available */ /*************************************************************************/ ui=userinfo;tr=transmit;gc=getchar;ss=sendstring;si=systeminfo ui a;handle=result ui a;name=result ui o;access=result si m;timeallowed=(result-3) bbsidentify 'name';bbsname=result ver="TA Trivia v1.6" bbsidentify 'sysop';sysopname=result userinfo x ; ansi=result CSI = '1b'x||'[' CRLF = '0d'x||'0a'x FF = '0c'x if ansi='ON' then do OFF = CSI'0m' ; BO = CSI'1m' ; UL = CSI'4m' ; IT = CSI'3m' RED = CSI'31m' ; GREEN = CSI'32m' ; YELLOW = CSI'33m' ; BLUE = CSI'34m' PURPLE = CSI'35m' ; CYAN = CSI'36m' ; WHITE = CSI'37m' YELLOWBACK = CSI'43m' end else do OFF = '' ; BO = '' ; UL = '' ; IT = '' RED = '' ; GREEN = '' ; YELLOW = '' ; BLUE = '' PURPLE = '' ; CYAN = '' ; WHITE = '' YELLOWBACK = '' end Highscores="BBS:Extras/TATRIVIA/Highscores.txt" LastHighscores="BBS:Extras/TATRIVIA/Highscores.old" c=0 setnodelocation "Playing the Trivia game!" sysoplog name 'played the Trivia Game!' path='BBS:Extras/TaTrivia/' upath=path"users/" qpath=path"Questions/" quest="Questions" quests=qpath||quest high= path"HighScores.txt" index=1 check=1 used.1=0 START: INST: cls ss GREEN tr GREEN||BO'TransAmiga Trivia Quizzer by' CYAN'John Kratz.'GREEN tr '' tr 'The program will choose randomly among the' YELLOW||total|| RED 'trivia quizzes.' tr '' tr CYAN'Use the numbers 1,2,3 and 4 to select your answer.' tr '' tr 'You may quit at any time by typing Q.' tr '' address command 'WAIT 2 secs' TITLESCREEN: cls tr '' tr '________________________ ______________________' tr ' ////' tr ' ////' tr ' /__________________//________________/' tr '/ // /' tr '/ // /' tr '/ // /' tr '/ / ___/ / ________ ___ __ ___ ___ ___' tr '/ / / |/ / / _ / / / | | / / / / / |' tr '/ / / |/ / / // / / / | | / / / / / |' tr '/ / / | |/ / / // / / / | |/ / / / / | |' tr '/ / / /| |/ / /_/ / / | | / / / / /| |' tr ' / / / __ |/ / / / | / /| / / / / __ |' tr ' / / / / | |/ / / /| | / /| / / / / / | |' tr ' /____/ /__/ |__|/____/ /___/ |__| /__/|__/ /__/ /__/ |__|' tr 'By John Kratz of Amiga Time BBS!' tr 'Internet: jkratz@erc.cat.syr.edu' tr 'Fidonet: 1:260/322.0' tr 'Version: 'ver'' bufferflush tr '' MAIN: tr '[V]iew High Scores [P]lay TA Trivia' if access > 200 then tr '[R]eset HighScores' tr '[Q]uit [I]nstructions - How to Play' ss 'Your Choice? 'CYAN'[ ]'YELLOW ; gc ; ans=upper(ans) ; call GCCHECK ; tr ''ans if ans='P' then do cls call STARTOVER end if ans='V' then do cls call SHOWHIGHS continue call TITLESCREEN end if ans='I' then do cls sendfile 'BBS:Extras/TATrivia/TATRIVIA.DOC' continue end if access >= 200 & ans='R' then do cls call RESET end if ans='T' then do cls systeminfo m ; timeleft = Result systeminfo q ; daily = Result userinfo u ; onlinetime = Result tr BO YELLOW'Your total online time per day is 'CYAN daily YELLOW' minutes!' tr ' You have been online 'RED onlinetime YELLOW' minutes so far today!' tr ' You have 'GREEN timeleft YELLOW' minutes left for today!'OFF continue call TITLESCREEN end if ans='Q' then signal QUIT if ans='RESULT' then cls ; signal TITLESCREEN STARTOVER: num=1;count=1 score=0 timenumb=0 listnum=random(1,total,66) GETQUESTIONS: listnum=random(1,total,time('s')) do i=1 to check if used.i=listnum then signal GETQUESTIONS end used.index=listnum check=index index=index+1 if index=276 then do do i=1 to check used.i=0 end index=1 check=1 end if open('file',qpath||quest||listnum,'R') then do do until EOF('file') quest.num=readln('file') do i=1 to 4 quest.num.i=readln('file') end num=num+1 end call close('file') end else do tr "There has been a problem loading the question file" exit 10 end SHOW: cls if count=num-1 then signal SHUTDOWN tr "" tr "" ss ''YELLOWBACK BLUE bbsname"'s "RED"Trivia Quiz "OFF tr " " tr " " if access >= 200 then do ss ''BO GREEN"Question File number:"RED listnum end tr GREEN" Question number:"RED count tr " " tr CYAN quest.count YELLOW tr "" do i=1 to 4 parse var quest.count.i isans 2 answer if isans="!" then theans=i if isans~="-" then transmit '' i'' answer end bufferflush tr '' tr RED" You have "CYAN score RED" right." tr '' ss BO GREEN"Your Choice -> "CYAN"[ ]"YELLOW; gc ASKIT: guess=upper(result) tr ''guess if guess="1" then signal CONTINUE if guess="2" then signal CONTINUE if guess="3" & if isans~="-" then signal CONTINUE if guess="4" & if isans~="-" then signal CONTINUE if guess="Q" then signal SHUTDOWN if guess="RESULT" then SIGNAL MAIN2 if guess="q" then do guess=upper(guess) signal SHUTDOWN end if guess~= "1" or guess ~= "2" or guess ~= "3" or guess ~= "4" or guess ~= "RESULT" then SIGNAL MAIN2 if guess="###PANIC" then signal exit 10 if guess="###panic" then signal exit 10 signal ASKIT MAIN2: Query GREEN"Your Choice -> "CYAN"[ ]"YELLOW signal ASKIT CONTINUE: if guess=theans then do score=score+1 tr CYAN" Correct." end else tr RED" Sorry, that's wrong." address command 'WAIT 1 secs' count=count+1 if count > num then do if guess=theans then do tr CYAN"Correct." end else tr RED"Sorry, that's wrong." address command 'WAIT 1 secs' signal SHUTDOWN end signal SHOW GCCHECK: ans=result if ans ='###PANIC' then do ; bufferflush ; exit 10 ; end return SHOWHIGHS: call READHIGH tr 'ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»' tr 'º [C]urrent High Scores [L]ast Month High Scores º' tr 'º [Q]uit to the Main Menu º' tr 'ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ' ss 'Your Choice -> 'CYAN' [ ]'YELLOW; getchar; guess=upper(result) tr ''YELLOW||guess if guess="C" then do; call READHIGH; call SHOWFIVE; end if guess="L" then do; call READLASTHIGH; call SHOWLASTFIVE ;end if guess="RESULT" then SIGNAL TITLESCREEN if guess="Q" then signal TITLESCREEN if guess~= "C" or guess ~= "L" or guess ~= "Q" then SIGNAL SHOWHIGHS if guess="###PANIC" then signal exit 10 if guess="###panic" then signal exit 10 return CHECKHI: call READHIGH x=0 ; gp=c ; if gp <= 0 then signal L288 L276: x=x+1 ; if x > 10 then signal L288 z=10 ; if zp.x.2=0 then signal L283 if gp < zp.x.2 then signal L276 L283: z1=z-1 do y=1 to 3 zp.z.y=zp.z1.y end y z=z-1 ; if z~ < x then signal L283 zp.x.1=handle ; zp.x.2=gp ;zp.x.3=date() tr "Congratulations! You Are One Of The Top 10 Players!" call open(f1,HIGHSCORES,'w') do x=1 to 10 do y=1 to 3 call writeln(f1,zp.x.y) end y end x ; call close(f1) if gs=0 then cls ; call SHOWHIGHS bufferflush ; Address command 'Wait 2 secs' return L288: timenumb=0 c=0 tr CYAN center("Sorry, You did not make it into the "GREEN"Top Ten"CYAN". Try Again Next Time.",100) if count > 9 & score = 0 then signal ZERO SIGNAL ANOTHER return READHIGH: if ~exists(HighScores) then do call open(f1,HighScores,'w') do x=1 to 10 call writeln(f1,"Nobody Yet!") ; call writeln(f1,"0") ; call writeln(f1,"None Yet!!!") end x ; call close(f1) end call open(f1,HighScores,'r') do x=1 to 10 do y=1 to 3 zp.x.y=readln(f1) end y end x ; call close(f1) return READLASTHIGH: if ~exists(LastHighScores) then do call open(f1,LastHighScores,'w') do x=1 to 10 call writeln(f1,"Nobody Yet!") ; call writeln(f1,"0") ; call writeln(f1,"None Yet!!!") end x ; call close(f1) end call open(f1,LastHighScores,'r') do x=1 to 10 do y=1 to 3 zp.x.y=readln(f1) end y end x ; call close(f1) return ZERO: newtime = ontime - 15 settime newtime tr 'ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»' tr 'º ÜÜÜÜÜÜÜ ÜÜÜÜÜÜÜ ÜÜÜÜÜÜÜ ÜÜÜÜÜÜÜÜ º' tr 'º / Û Û Ý Û Û º' tr 'º / Û Û Ý Û Û º' tr 'º / ÛÜÜÜÜ ÛÜÜÜÜÜÜÝ Û Û º' tr 'º / Û Û \ Û Û º' tr 'º / Û Û \ Û Û º' tr 'º / Û Û \ Û Û º' tr 'º ßßßßßßß ßßßßßßß ß \ ßßßßßßßß º' tr 'º º' tr 'º ÜÜÜÜÜÜÜ ÜÜÜÜÜ ÜÜÜÜÜÜÜÜ Ü Ü ÜÜÜÜÜÜÜÜ º' tr 'º Û Ý Û Û Û Û Û º' tr 'º Û Ý Û Û Û Û Û º' tr 'º ÛÜÜÜÜÜÜÝ Û Û ÛÜÜÜÜÜÜÛ Û º' tr 'º Û \ Û Û ÜÜÜÜÜÜ Û Û Û º' tr 'º Û \ Û Û Û Û Û Û º' tr 'º Û \ Û Û Û Û Û Û º' tr 'º ß \ ßßßßß ßßßßßßßß ß ß ß º' tr 'ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹' tr 'ºYou lose 15 minutes for not getting atleast 1 right!º' tr 'ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ' address command 'WAIT 2 secs' return SHOWFIVE: cls tr ' ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»' tr ' º TA Trivia High Scores! º' tr ' º Current Top Ten TA Trivia Champs:º' tr ' ºº' tr ' º NAMETOTAL SCORE!DATEº' tr ' ºº' do x=1 to 10 tr ' º'right('<'||x||'>',4)'  '||left(zp.x.1' ',20)''right(zp.x.2,2)' 'right(zp.x.3,11)' º' end x tr ' ºº' tr ' ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ' continue return SHOWLASTFIVE: cls tr ' ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»' tr ' º TA Trivia High Scores! º' tr ' º for last month TA Trivia Champs:º' tr ' ºº' tr ' º NAMETOTAL SCORE!DATEº' tr ' ºº' do x=1 to 10 tr ' º'right('<'||x||'>',4)'  '||left(zp.x.1' ',20)''right(zp.x.2,2)' 'right(zp.x.3,11)' º' end x tr ' ºº' tr ' ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ' continue return SHUTDOWN: give=0 si m ; ontime=result si q ; maxtime=result if count > 9 & score < 3 then SIGNAL L288 if count > 9 & score > 3 then do if score=4 then do newtime = ontime + fourright settime newtime timenumb=fourright c=4 end if score=5 then do newtime = ontime + fiveright settime newtime timenumb=fiveright c=5 end if score=6 then do newtime = ontime + sixright settime newtime timenumb=sixright c=6 end if score=7 then do newtime = ontime + sevenright settime newtime timenumb=sevenright c=7 end if score=8 then do newtime = ontime + eightright settime newtime timenumb=eightright c=8 end if score=9 then do newtime = ontime + nineright settime newtime timenumb=nineright c=9 end if score=10 then do newtime = ontime + tenright settime newtime timenumb=tenright c=10 end end if count > 9 & score > 3 then tr GREEN"You have been given "timenumb" extra minutes online for your "score" correct answers." if timenumb > 0 then do si m ; ontime=result si q ; maxtime=result setnewtime = ontime + timenumb tr 'Your OLD time remaining is:' ontime 'minutes' tr 'Your New time remaining is:' setnewtime 'minutes' if setnewtime > maxtime then do setnewtime = maxtime tr 'Sorry, you can only have 'maxtime 'minutes/day total' end continue settime setnewtime end give=1 SIGNAL CHECKHI if give=0 then ss ANOTHER: ss YELLOW"Would you like to try another quiz? "CYAN"("GREEN"y"CYAN"/"RED"N"CYAN") "GREEN;gc;again=upper(result) if again="Y" then do; tr "Yes"; signal STARTOVER ; end tr "" tr GREEN"Returning you to "bbsname"." cls exit 10 RESET: if exists(lasthighscores) then do; queryY 'There is already a Last Month HighScores file. Do you want to overwrite? ' ans=upper(result) if ans='Y' then do address command 'delete BBS:Extras/TATRIVIA/Highscores.old' address command 'rename BBS:Extras/TATRIVIA/Highscores.txt BBS:Extras/TATRIVIA/Highscores.old' tr 'Current HighScores have been renamed to Last Month High Scores' end continue end else address command 'rename BBS:Extras/TATRIVIA/Highscores.txt BBS:Extras/TATRIVIA/Highscores.old' Call TITLESCREEN end QUIT: cls Tr 'Thank you' name 'for playing TA Trivia!' bufferflush ; exit 10 IOERR: tr '' tr '*BOOM* Got an IO error. Please notify 'sysop'!' SYSOPLOG '*BOOM* Got an IO error in TA Trivia.' SYSOPLOG '---> Line: ' SIGL BUFFERFLUSH EXIT 10 ERROR: tr '' tr '*BOOM* Got an error. Please notify 'sysop'!' tr 'line: ' SIGL ' Severity: ' RC SYSOPLOG '*BOOM* Got an error in TA Trivia..' SYSOPLOG '---> Line: ' SIGL ' Severity: ' RC BUFFERFLUSH EXIT 10 SYNTAX: tr 'Error in 'ver'. Line: 'SIGL tr 'Error: 'RCALL errortext(RC) tr 'Please notify 'sysopname'!' tr 'Returning to 'BBSname'...' SYSOPLOG 'Error in 'ver'. Line: 'SIGL SYSOPLOG 'Error: 'RCALL errortext(RC) BUFFERFLUSH EXIT 10 prompt 3 NORMAL 'What question file do you want to edit (i.e. 264)? '; numb=result open(edit, quests.numb,'r') prompt 2 NORMAL 'What question do you want to edit? '; numb1=result =readln(edit)