Letter | Value | Action |
0 | 1 point | Move the mouse onto the 0 - no clicking required |
L | 1 point | Click the LEFT mouse button on the L once quickly |
R | 1 point | Click the RIGHT mouse button on the R once quickly |
* | 5 points | Click BOTH mouse buttons on the * at the same time |
The program deducts points for any mistakes.
This program demonstrates how to display non-ASCII characters, pause the computer,
play sounds, and read the mouse in text mode. This program
has very few comments and may be a bit difficult for beginners to understand.
But it is useful for teaching mouse skills (especially on older computers like the XT).
DECLARE SUB WelcomeScreen ()
DEFINT A-Z
DEF SEG = 0
' Set up for the mouse calls
DIM MSEG AS INTEGER, MOUSE AS INTEGER
DIM M1 AS INTEGER, M2 AS INTEGER, M3 AS INTEGER, M4 AS INTEGER
MSEG = 256 * PEEK(51 * 4 + 3) + PEEK(51 * 4 + 2)
MOUSE = 256 * PEEK(51 * 4 + 1) + PEEK(51 * 4) + 2
DIM row AS INTEGER, col AS INTEGER, buttons AS INTEGER
DIM lrow AS INTEGER, lcol AS INTEGER, lbuttons AS INTEGER
lrow = -1: lcol = -1: lbuttons = -1
DIM RandVal AS SINGLE
DIM passnum AS INTEGER
passnum = 1
CLS
IF (MSEG OR (MOUSE - 2)) = 0 THEN
PRINT "Mouse Driver Not Found"
END
END IF
DEF SEG = MSEG
IF PEEK(MOUSE - 2) = 207 THEN
PRINT "Mouse Driver Not Found"
END
END IF
M1 = 30: M2 = 0: CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
M1 = 0: CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
M1 = 1: CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
M1 = 2: CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
CALL WelcomeScreen
M1 = 1: CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
RANDOMIZE TIMER
Score = 0
lscore = -1
Done = 0
DO
M1 = 2: CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
CLS
M1 = 1: CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
IF passnum <= 4 THEN
' Pick special targets for practice
SELECT CASE passnum
CASE IS = 1
TargButton = 0: TargRow = 10: TargCol = 18
LOCATE 10, 20: PRINT "<-- Practice: Just move the mouse onto this '0'";
CASE IS = 2
TargButton = 1: TargRow = 17: TargCol = 23
LOCATE 17, 25: PRINT "<-- Practice: Click the Left mouse button on the 'L'";
CASE IS = 3
TargButton = 2: TargRow = 2: TargCol = 2
LOCATE 2, 4: PRINT "<-- Practice: Click the Right mouse button on the 'R'";
CASE IS = 4
TargButton = 3: TargRow = 19: TargCol = 10
LOCATE 19, 12: PRINT "<-- Practice: Click Both mouse button on the '*'";
END SELECT
LOCATE 22, 44: PRINT "Your score will change here "; CHR$(196); CHR$(196); CHR$(196); CHR$(196); CHR$(191);
LOCATE 23, 44: PRINT " "; CHR$(179);
LOCATE 24, 44: PRINT " "; CHR$(179);
passnum = passnum + 1
ELSE
IF passnum = 5 THEN
passnum = passnum + 1
Score = 0
END IF
' Pick a random target row, column, and button number
RandVal = RND
RandVal = RandVal * RandVal
TargRow = 1 + (RandVal * 23)
IF TargRow > 23 THEN
TargRow = 23
END IF
TargCol = 1 + (RND * 79)
'TargButton = RND * 3
TargButton = RND * 100
IF TargButton < 40 THEN
TargButton = 1 'Left
ELSEIF TargButton < 40 + 20 THEN
TargButton = 2 'Right
ELSEIF TargButton < 60 + 30 THEN
TargButton = 0 'None
ELSE
TargButton = 3 'Both
END IF
END IF
LOCATE 25, 1
PRINT "0=None:+1 L=Left:+1 R=Right:+1 *=Both:+5 Miss:-10 Esc=Quit";
LOCATE 25, 69
PRINT "Score="; Score;
LOCATE TargRow, TargCol, 0
IF TargButton = 1 THEN
M1 = 2: CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
PRINT "L";
M1 = 1: CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
ELSEIF TargButton = 2 THEN
M1 = 2: CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
PRINT "R";
M1 = 1: CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
ELSEIF TargButton = 3 THEN
M1 = 2: CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
PRINT "*";
M1 = 1: CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
ELSE
TargButton = 0
M1 = 2: CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
PRINT "0";
M1 = 1: CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
END IF
Hit = 0
DO
M1 = 3: CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
col = 1 + (M3 \ 8)
row = 1 + (M4 \ 8)
buttons = M2
IF (row <> lrow) OR (col <> lcol) OR (buttons <> lbuttons) THEN
REM LOCATE 25, 1
REM PRINT "Row:"; row; " Column:"; col; " Buttons:"; buttons;
lrow = row: lcol = col: lbuttons = buttons
END IF
IF (row = TargRow) AND (col = TargCol) AND (buttons = TargButton) THEN
Hit = 1
PLAY "L50bag"
IF TargButton = 3 THEN
PLAY "L8eg"
Score = Score + 5
ELSE
PLAY "P50"
Score = Score + 1
END IF
ELSEIF (buttons <> 0) AND (TargButton <> 3) THEN
PLAY "L64<
You can use your web browser to copy this program to the clipboard
(Click and Drag to Select, then Copy). Then
paste it into any text editor (like Windows Notepad), and
save it in a file called "mousehit.bas". Then use DOS QBASIC to open the
file and run it.
Click here to view some example screens from the program.