I'm back again, and still stuggling... <groan>
I thought I'd had it solved, but it appears not (for the umpteenth time).
This code:
hide mouse
sync on
DO
rem This value will be stored in an array
NoKeys = 1
A = keystate(200)
B = keystate(42)
Keys = A+B
if Nokeys = 1
If Keys = 1
rem Random red lines
if A=1 then ink rgb(255,0,0),0 : line rnd(639),rnd(479),rnd(639),rnd(479)
endif
else
If Keys = 2
If A+B = 2 then ink rgb(255,0,0),0 : line rnd(639),rnd(479),rnd(639),rnd(479)
endif
endif
rem Again, this value will be stored in array
Nokeys = 2
A = keystate(200)
B = keystate(42)
Keys = A+B
if Nokeys = 1
If Keys = 1
rem Random green circles
if A=1 then ink rgb(0,255,0),0 : circle rnd(639),rnd(479), rnd(100)
endif
else
If Keys = 2
If A+B = 2 then ink rgb(0,255,0),0 : circle rnd(639),rnd(479), rnd(100)
endif
endif
sync
LOOP
works. This code:
hide mouse
sync on
Dim keyCom(2, 2)
KeyCom(1, 0) = 1
KeyCom(1, 1) = 200
KeyCom(1, 2) = 1
KeyCom(2, 0) = 2
KeyCom(2, 1) = 200
KeyCom(2, 2) = 42
DO
A = keystate(KeyCom(1, 1))
B = keystate(KeyCom(1, 2))
Keys = A+B
if keycom(1, 0) = 1
If Keys = 1
rem Random red lines
if A=1 then ink rgb(255,0,0),0 : line rnd(639),rnd(479),rnd(639),rnd(479)
endif
else
If Keys = 2
If A+B = 2 then ink rgb(255,0,0),0 : line rnd(639),rnd(479),rnd(639),rnd(479)
endif
endif
A = keystate(KeyCom(2, 1))
B = keystate(KeyCom(2, 2))
Keys = A+B
if KeyCom(2,0) = 1
If Keys = 1
rem Random green circles
if A=1 then ink rgb(0,255,0),0 : circle rnd(639),rnd(479), rnd(100)
endif
else
If Keys = 2
If A+B = 2 then ink rgb(0,255,0),0 : circle rnd(639),rnd(479), rnd(100)
endif
endif
sync
LOOP
doesn't. The only difference is that the keystate values are hardcoded into the first example, and stored in arrays in the second. That's the only difference.
Why won't it work??? This is driving me crazy!

(Now you know how we mad scientists get that way...)
@TDK
I don't think a timer delay would do my program any good.
On our way 'ome, on our way 'ome...