KEYSTATE

This command will return an integer value of one if the key specified by the scancode is pressed, otherwise zero will be returned.

  Syntax
Return Integer=KEYSTATE(Scancode)
  Parameters
Scancode
Integer
The scan code number to test

  Returns

A one if the key specified by the scancode is pressed, otherwise zero will be returned

  Description

The scancode value is the raw value assigned to the key of the keyboard device and very often is ordered sequentially from the top left of the keyboard to the bottom right.

  Example Code
cls
do
if upkey()=1 then print "upkey()"
if downkey()=1 then print "downkey()"
if leftkey()=1 then print "leftkey()"
if rightkey()=1 then print "rightkey()"
if keystate(17)=1 then print "W up"
if keystate(31)=1 then print "S down"
if keystate(30)=1 then print "A left"
if keystate(32)=1 then print "D right"
loop
end
  See also

INPUT Commands Menu
Index