Hi,
I would like to know if there?s a way I could do something similar to this:
KEYWAIT OR MOUSEWAIT
You know, wait for any input comming from those devices without mattering if it comes from one or other.
Thanks!
This is one way to do it, just include the functions in your code and where you want to wait for any key you just call the wait_for_any_key() function. You can also call the any_key() function in your own game loop if you want to update animations while waiting for a key- or buttonpress.
PRINT "Hello, press any key or mouse-button to quit", 50, 50
SHOWSCREEN
wait_for_anykey()
END
FUNCTION wait_for_anykey:
WHILE any_key() = FALSE
SLEEP 50 // do a little waiting
WEND
ENDFUNCTION
FUNCTION any_key:
LOCAL a$, x, y, b1, b2
a$ = INKEY$()
MOUSESTATE x, y, b1, b2
// If anything pressed then return true
IF a$ <> "" OR b1 <> 0 OR b2 <> 0 THEN RETURN TRUE
// if nothing pressed, return false
RETURN FALSE
ENDFUNCTION
Many thanks Moru for the quick answer!!
Worked like a charm. :good: