First of all, someone posted this pic before. This pic may be useful:
http://www.freewebs.com/kabouter/scancodes2.png
scancode() only returns the scancode number of the button being pressed, so it can only check one button at a time. But if you use keystate() and pass a scancode number to it as a parameter, it will check if that scancode is being pressed and return a 1 if it is, and if not it will return a 0. So keystate(17) returns a 1 if the 'w' key is pressed. This way, you could use multiple keystate() functions and use them to flag variables so you can check them later.
sync on
sync rate 0
backdrop on
color backdrop rgb(0,0,255)
do
if keystate(17)=1 then w=1 else w=0
if keystate(31)=1 then s=1 else s=0
if keystate(30)=1 then a=1 else a=0
if keystate(32)=1 then d=1 else d=0
set cursor 1,1
if w=1
print "w key is pressed"
endif
if s=1
print "s key is pressed"
endif
if a=1
print "a key is pressed"
endif
if d=1
print "d key is pressed"
endif
sync
loop
Strangely, my keyboard will only respond up to 3 key simultaneous keypresses. Dunno if other people have the same problem.