Rem ************************************ 
Rem *                                  * 
Rem * Wots its name                    * 
Rem *                                  * 
Rem * From Genetix Efx                 * 
Rem *                                  * 
Rem * February 1992                    * 
Rem *                                  * 
Rem ************************************ 
Rem
Rem
Rem **** WARNING *** 
Rem  
Rem This ascii file won't run if you merge it into AMOS for two reasons
Rem
Rem 1) The Qbank procedures are locked to stop you cheating!!! 
Rem
Rem 2) I've used Ctext whose libraries are NOT public domain and 
Rem    are therefore not included on this disk.  
Rem
Rem This file is for you to have a look at how I programmed the game     
Rem I should point out that I'm still learning so it isn't the best
Rem example of how to program in AMOS......But it works ok!! 
Rem I've tried to make it as easy to understand as I can for those 
Rem of you who are learning like me. To the experienced AMOS programmers 
Rem I can only offer my apologies! 
'
'
'
Set Buffer 70
'
Rem Fellow compilers please note: I you don't open a screen after you've
Rem set the buffer size then the compiled program won't run....Don't ask
Rem me why but Len Tucker helped me out with this...Thanks Len
'
Screen Open 0,320,256,32,Lowres
A#=0.0
Limit Mouse 125,40 To 450,300
Rem Define variables 
'
Dim CLUE$(50,20),ANSWER$(50),TYPE$(50),PLACE(4),POSITIONX(68),POSITIONY(68)
Dim CARD(50),Q(20),NUMBX(20),NUMBY(20)
Global PLYERS,QUESTIONS,CLUE$(),ANSWER$(),TYPE$(),PLACE(),POSITIONX()
Global POSITIONY(),PLYER,MVES,WINNER,CARD(),Q(),CL,CD,TYPE,COUNT,ANS,NUMBX()
Global NUMBY(),SAME,SND
SETUP
'
Rem Main Program Loop
'
Do 
PICK:
CD=Rnd(49)+1 : If CARD(CD)<>0 Then Goto PICK
USED=USED+1 : If USED>48 Then RESET : Goto PICK
CARD(CD)=1
If TYPE$(CD)="PERSON" Then TYPE=1 : YY=33 : XX=127
If TYPE$(CD)="PLACE" Then TYPE=2 : YY=33 : XX=185
If TYPE$(CD)="THING" Then TYPE=3 : YY=48 : XX=127
If TYPE$(CD)="YEAR" Then TYPE=4 : YY=48 : XX=185
Bob 5,XX,YY,TYPE
CONT:
Bob PLYER,POSITIONX(PLACE(PLYER)),POSITIONY(PLACE(PLYER)),PLYER+4
COUNT=COUNT+1 : If COUNT>20 Then ALLDONE : Wait 50 : Goto PICK
BLANK
Ctext 130,245,"Player"+Str$(PLYER)
QUEST
GOTIT
BLANK
Ink 21,0,0 : Bar 22,216 To 289,225
PLYER=PLYER+1 : If PLYER>PLYERS Then PLYER=1
If ANS=1 Then ANS=0 : COUNT=0 : Goto PICK
Goto CONT
Loop 
'
'
'
Procedure SETUP
Rem Load banks, screens, fonts etc. Set variables to zero. 
'
'Load "WIN:sprites/WIN.abk"  
Get Sprite Palette 
Screen Open 0,320,256,32,Lowres : Flash Off 
'Load Iff "WIN:Iff/WIN-Board.iff",0  
'Spack 0 To 5
Unpack 5 To 0
PLYER=1 : WINNER=0 : Randomize Timer : COUNT=0
For I=1 To 50 : CARD(I)=0 : Next I
For I=1 To 20 : Q(I)=0 : Next I
F$="WIN:fonts/Win.abk" : Rem Load F$
Get Icon Palette : Make Icon Mask 
Bank Swap 2,10
Bload F$+".cfnt",Font Data
Font Size 0,0
'Load "WIN:Sound/Win-Effects.abk",6
Sam Bank 6
'
Rem Get number of players and question bank  
'
PLYRS
QUESTBNK
On QUESTIONS Proc QBNK1,QBNK2,QBNK3,QBNK4
'
Rem Set zones for Numbers (1-20) 
'
SETZNES
'
Rem Put board positions into memory
'
POSITIONS
'
Rem Put Number positions into memory 
'
NUMBERS
'
Rem Set start positions of counters
'
For I=1 To PLYERS
PLACE(I)=1
Next I
End Proc
'
'
'
Procedure SETZNES
'
Rem This procedure sets up the zones for the numbers 1 - 20 and Pass icon
Rem Also set Zones for Quit and Sound On/Off (V1.2)
Rem The program then knows what number has been clicked on 
'
Reserve Zone 21
X1=25 : X2=39 : Y1=60 : Y2=74
For I=1 To 5
   Set Zone I,X1,Y1 To X2,Y2
   Y1=Y1+19 : Y2=Y2+19
Next I
X1=45 : X2=59 : Y1=60 : Y2=74
For I=6 To 10
   Set Zone I,X1,Y1 To X2,Y2
   Y1=Y1+19 : Y2=Y2+19
Next I
X1=252 : X2=266 : Y1=60 : Y2=74
For I=11 To 15
   Set Zone I,X1,Y1 To X2,Y2
   Y1=Y1+19 : Y2=Y2+19
Next I
X1=272 : X2=286 : Y1=60 : Y2=74
For I=16 To 20
   Set Zone I,X1,Y1 To X2,Y2
   Y1=Y1+19 : Y2=Y2+19
Next I
Rem PASS Zone
Set Zone 21,136,171 To 175,186
Rem QUIT Zone
Ste Zone 22,84,171 To 123,186
Rem Sound Zone
Set Zone 23,188,170 To 227,187
End Proc
'
'
'
Procedure PLYRS
'
Rem This gets the number of players
'
Ctext 75,245,"How many Players ( 2 - 4 ) ?"
AGAIN1:
X$=Inkey$ : If Val(X$)<2 or Val(X$)>4 Then Goto AGAIN1
PLYERS=Val(X$)
End Proc
'
'
'
Procedure QUESTBNK
'
Rem this finds which question bank to load and goes to appropriate Proc. 
'
BLANK
Ctext 68,245,"Which Question Bank ( 1 - 4 ) ?"
AGAIN2:
X$=Inkey$ : If Val(X$)<1 or Val(X$)>4 Then Goto AGAIN2
QUESTIONS=Val(X$)
BLANK
Ctext 20,245,"Please Wait.....Setting game up (Approx 30 secs)"
End Proc
'
'
'
Rem The next procedures load in the relevant question bank and decodes 
Rem the data. They also contain the Answers and Type (which is why 
Rem they are locked.....You don't want to cheat now do you???) 
'
Procedure QBNK1
Procedure QBNK2
Procedure QBNK3
Procedure QBNK4
'
'
'
Procedure POSITIONS
'
Rem This procedure loads all the positions on the board into the variables 
Rem POSITIONX() and POSITIONY() so that the program can move the 
Rem counters around the board
'
For I=1 To 68
   Read POSITIONX(I),POSITIONY(I)
Next I
Data 133,196,118,196,103,196,88,196,73,196,58,196,43,196,28,196,28,181
Data 28,166,43,166,58,166,73,166,73,151,73,136,73,121,73,106,73,91
Data 73,76,73,61,73,46,58,46,43,46,28,46,28,31,28,16,43,16,58,16,73,16
Data 88,16,103,16,118,16,133,16,148,16,163,16,178,16,193,16,208,16,223,16
Data 238,16,253,16,268,16,283,16,283,31,283,46,268,46,253,46,238,46,238,61
Data 238,76,238,91,238,106,238,121,238,136,238,151,238,166,253,166,268,166
Data 283,166,283,181,283,196,268,196,253,196,238,196,223,196,208,196
Data 193,196,178,196,
End Proc
'
'
'
Procedure NUMBERS
'
Rem This procedure loads the positions of the numbers 1 - 20 so that 
Rem the program knows where to put the 'used' BOB  on the numbers
Rem that have been picked
'
For I=1 To 20
   Read NUMBX(I),NUMBY(I)
Next I
Data 33,67,33,86,33,105,33,124,33,143,53,67,53,86,53,105,53,124,53,143
Data 258,66,258,85,258,104,258,123,258,142,278,66,278,85,278,104
Data 278,123,278,142
End Proc
'
'
'
Procedure QUEST
'
Rem Check to see if the left mouse button has been clicked and if so 
Rem is it on a used or unused number. If it's an unused number then  
Rem put a flag (1) into the relevant variable Q. If it's a used
Rem number then make a sound and try again 
Rem also check to see if QUIT,PASS or SOUND Zones have been clicked on
'
AGAIN:
Z=Mouse Click
If Z<>1 Then Goto AGAIN
CL=Mouse Zone
If CL=22 Then QUIT : Goto AGAIN
If CL=23 Then EFX : Goto AGAIN
If CL=21 or CL=0 Then Shoot : Goto AGAIN
If Q(CL)<>0 Then Shoot : Goto AGAIN
Q(CL)=1
'
Rem if player has chosen valid number remove the Bob that shows
Rem whose go it is (Bob 26)
'
Bob Off 26
'
Rem having found an unused number and set the flag, put the 'used' BOB 
Rem on the right spot
'
Bob 5+CL,NUMBX(CL),NUMBY(CL),9
'
Rem print the relevant clue
'
Ink 21,0,0 : Bar 22,216 To 289,225
Ctext 23,224,CLUE$(CD,CL)
End Proc
'
'
'
Procedure GOTIT
'
Rem this procedure deals with the answers. First it checks to see
Rem if the clue gives a bonus move by searching for the word 'go'
Rem if 'go' exists it jumps to the BONUS procedure 
'
X$=""
If Left$(CLUE$(CD,CL),2)="go" Then BONUS : Pop Proc
BLANK
'
Rem No bonus move so ask for an answer 
'
Ctext 23,245,"Answer?  "
BX1=22 : BX2=23 : BY1=205 : BY2=211 : Rem start position of timer
'
Rem This loop does the following: 1) Make the timer bar a bit wider  
Rem 2) Make a noise. 3) check to see if the time has run out 
Rem 4) check for a key press. 5) check if the Player has 'passed'  
Rem if any of these conditions are met then go to the relevant label 
Rem otherwise repeat the loop
Rem also added (V1.2) a check to see if sound effects are on or off
Rem SND = 1 if on or 0 if off (see EFX procedure)
'
Do 
If SND=1 Then Volume 30 Else Volume 0
Ink 0
Bar BX1,BY1 To BX2,BY2
BX2=BX2+2 : Wait 5 : Sam Play 5 : If BX2>289 Goto OUTTIM
KK$=Inkey$
Z=Mouse Click : Z=Z+Mouse Zone : If Z=22 Then NOANSWER
KK$=Inkey$
If KK$<>"" and Asc(KK$)<>13 Then Exit
Loop 
'
Rem This routine prints the characters corresponding to the keys pressed 
Rem It repeats until the return key is pressed. Also added (V1.2) routine
Rem to see if backspace key is pressed. If so it will delete characters
Rem upto but NOT including first character. Also if non-ascii key is
Rem pressed i.e. Fkeys, Delete, Help etc. it will ignore them
Rem (BAD bug from V1.0)
'
If SND=1 Then Volume 63 Else Volume 0
'
Ctext 70,245,KK$ : Rem print 1st letter which can't be deleted
'

Do
X$=X$+KK$ : L=Len(X$)
If L>36 Then X$=Left$(X$,36) : Rem restrict answer to 36 letters
KK$=Inkey$
'
If Asc(KK$)=0 : Then KK$="" : Rem Non-Ascii ignore it
If Asc(KK$)=13 : Then Exit : Rem Return key pressed lets get outta here!
If Scancode=65 Then FLAG=1 : Rem Backspace pressed, set a flag
'
Rem If the flag is set and there's more than 1 letter in the answer
Rem the delete last letter and blank the line (so it don't overwrite itself)
'
If FLAG=1 and L>1 Then X$=Left$(X$,L-1) : KK$="" : Ink 0 : Bar 70,230 To 310,254
'
FLAG=0 : Rem reset flag
Ctext 70,245,X$
Loop
'
Ink 6
Bar 22,205 To 289,211
A$=Upper$(X$)
BLANK
'
Rem Check to see if the answer is right, if so go to RIGHT procedure 
'
If A$=ANSWER$(CD) Then Ctext 120,245,"That's Right" : Sam Play 4 : RIGHT : Pop Proc
'
Rem The player has passed so print a message, add a sound and return 
'
NOANSWER:
If SND=1 Then Volume 63 Else Volume 0
Sam Play 2
BLANK
Ink 6
Bar 22,205 To 289,211
If A$="" Then Ctext 90,245,"Better luck next time" : Wait 50 : BLANK : Pop Proc
'
Rem Wrong answer! print message etc and return 
'
Ctext 100,245,"Sorry, That's Wrong" : Sam Play 6 : Wait 80 : BLANK : Pop Proc
'
Rem Run out of time. As well as a message I decided to flash the timer 
Rem bar for effect 
'
OUTTIM:
If SND=1 Then Volume 63 Else Volume 0
Sam Play 3
BLANK
Ctext 90,245,"You ran out of time"
Ink 3 : Bar 22,205 To 289,211
Wait 50
Ink 6 : Bar 22,205 To 289,211
Ink 21,0,0 : Bar 22,216 To 289,225
End Proc
'
'
'
Procedure MVEPLYER
'
Rem This procedure moves the player and adds a sound effect. it probably 
Rem looks more complicated than it is, so I'll try and explain 
Rem PLACE(PLYER)is the variable that holds the positions of the players
Rem so I can check whether they've won or not. It holds a number between 
Rem 1 and 68. POSTIONX() and POSITIONY() hold the X and Y coords of
Rem the counters. Therefore POSITIONX(PLACE(PLYER)) holds the X coord
Rem of the counter for player number PLYER. Hope that hasn't confused
Rem you any more!!!!!!!! 
'
For I=1 To MVES
   Sam Play 1
   PLACE(PLYER)=PLACE(PLYER)+1
   If PLACE(PLYER)>68 Then WINNER=1 : Goto AWINNER
   Wait Vbl 
   Bob PLYER,POSITIONX(PLACE(PLYER)),POSITIONY(PLACE(PLYER)),PLYER+4
   Wait 25
Next I
'
Rem If the players position is more than 68 it means he's won!!! 
'
AWINNER:
If WINNER=1 Then WIN
End Proc
'
'
'
Procedure WIN
BLANK
'
Rem Somebody's won I'd better tell them !! 
'
Rem How about playing a silly tune, but first make sure the sound is on
Volume 63
Load "Win:Sound/Winner.abk"
Music 1
'
Ctext 23,240,"Player"+Str$(PLYER)+" WINS!!"
Wait 50
Ctext 23,250,"Press Left mouse button to Start Again"
Do
If Mouse Key =1 Then Exit
Loop
Music Off
BLANK
'
Rem The next bit just resets the variables and restarts the game 
'
WINNER=0 : Randomize Timer : COUNT=0
PLYRS
For I=1 To 20 : Q(I)=0 : Next I
SAME=QUESTIONS
QUESTBNK
'
Rem I added this as an afterthought. If you start the game again and 
Rem use the same question bank it doesn't reload them, thereby saving a
Rem bit of time setting up. It's funny how the little things escape your
Rem notice isn't it? Thanks to SCAMPZ for pointing this out!!
'
If QUESTIONS=SAME Then Goto STRT
For I=1 To 50 : CARD(I)=0 : Next I
On QUESTIONS Proc QBNK1,QBNK2,QBNK3,QBNK4
STRT:
ANS=1
For I=1 To PLYERS
PLACE(I)=1
Bob I,POSITIONX(PLACE(I)),POSITIONY(PLACE(I)),I+4
Next I
End Proc
'
'
'
Procedure RESET
'
Rem This procedure runs when all of the questions in the bank have been
Rem used. It resets the variables and loads another bank at random. I
Rem considered about asking the player which one to load but decided 
Rem that it would speed up the game a bit if I got the program to
Rem do it at random
'
For I=1 To 50 : CARD(I)=0 : Next I
For I=1 To 20 : Q(I)=0 : Next I
BLANK
Ctext 75,245,"Loading new Question bank"
GO:
ZZ=Rnd(3)+1 : If ZZ=QUESTIONS Then Goto GO
On ZZ Proc QBNK1,QBNK2,QBNK3,QBNK4
End Proc
'
'
'
Procedure RIGHT
'
Rem This procedure is for the correct answer. It tells how many moves
Rem are due and resets the variables 
'
Wait 50
BLANK
MVES=20-COUNT
Ctext 65,245,"Moving Player"+Str$(PLYER)+" ("+Str$(MVES)+" Spaces )"
MVEPLYER
For I=1 To 20 : Q(I)=0 : Next I
ANS=1
Wait 50 : BLANK
'
Rem Remove the 'used' BOBS from the screen 
'
For I=6 To 26
   Bob Off I
Next I
Ink 21,0,0 : Bar 22,216 To 289,225
Wait 50
End Proc
'
'
'
Procedure BONUS
'
Rem This procedure searches for either 'go back' or 'go forward' if it 
Rem finds 'go back' it jumps to the label BACKWARDS  
'
BLANK
If Left$(CLUE$(CD,CL),7)="go back" Then Goto BACKWARDS
Ctext 130,245,"Bonus Move"
Wait 50
'
Rem D = the 'value' of the 12th character because 'go forwards ' including 
Rem spaces is 11 characters. Therefore the next char will say how many 
Rem moves to make. Having found the value of D it then moves the counter 
Rem it also checks to see if the player has won
'
D=Val(Mid$(CLUE$(CD,CL),12,1))
PLACE(PLYER)=PLACE(PLYER)+D
If PLACE(PLYER)>68 Then PLACE(PLYER)=68 : WINNER=1
For I=1 To D : Bell : Wait 5 : Next I : Goto MVEIT
If WINNER=1 Then WIN
'
Rem This is the same as above but moves the player backwards as far
Rem as possible. 
'
BACKWARDS:
BLANK
Ctext 130,245,"Bad luck !!"
Boom 
Wait 50
D=Val(Mid$(CLUE$(CD,CL),9,1))
PLACE(PLYER)=PLACE(PLYER)-D
If PLACE(PLYER)<1 Then PLACE(PLYER)=1
'
Rem This is the actual routine that moves the player. For the sake of
Rem convenience (or laziness!!) it jumps the counter to the right
Rem position 
'
MVEIT:
Bob PLYER,POSITIONX(PLACE(PLYER)),POSITIONY(PLACE(PLYER)),PLYER+4
Wait 50
Ink 21,0,0 : Bar 22,216 To 289,225
End Proc
'
'
'
Procedure ALLDONE
'
Rem If no one gets the answer after all of the clues have been given 
Rem this procedure prints the answer, resets the clue variables and
Rem removes the 'used' BOBS
'
BLANK
Ctext 23,245,"The answer was...  "+ANSWER$(CD)
For I=1 To 20 : Q(I)=0 : Next I : COUNT=0
For I=6 To 25 : Bob Off I : Next I
Wait 60
BLANK
End Proc
'
'
'
Procedure BLANK
'
Rem Just a short routine to clear the message area.  
'
Ink 0
Bar 10,230 To 310,254
End Proc
'
'
'
Procedure QUIT
Rem added to V1.2 after it was suggested by Pete Wright
BLANK
Ctext 23,245,"Quit the Game (Y/N)" : Rem better make sure !
Do
   While K$=""
     K$=Inkey$
   Wend
K$=Upper$(K$)
If K$="Y" Then BLANK : Ctext 23,245,"BYE! BYE!" : Wait 50 : End
If K$="N" Then BLANK : Ctext 23,245,"OOPS!" : Wait 50 : Exit
K$=""
Loop
BLANK
Ctext 130,245,"Player"+Str$(PLYER) : Bob 26,200,240,PLYER+4
End Proc
'
'
'
Procedure EFX
Rem Suggested by Steve Howard and added to V1.2
Rem Toggles the Volume between 0 and 63 and Toggles Bob 27 on/off
Rem also sets flag SND to 1 if sound on or 0 if sound off
If SND=1 Then Bob 27,182,184,10 : SND=0 : Volume 0 : Pop Proc
If SND=0 Then Bob Off 27 : Volume 63 : SND=1
End Proc