DO
x = _MOUSEINPIT
LOOP
DO
x = _MOUSEINPUT
_LIMIT 10
LOOP
DO
WHILE _MOUSEINPUT: _WEND
_LIMIT 10
LOOP
Oh wouldn't that be something! to match users latitude and longitude and time and show them their night sky. :)
Hi romichess,
There is another conniption causing issue with the mouse you might want to be prepared for that TempodiBasic has alluded to.
This involves executing some code when the mouse is clicked.
The _MOUSEBUUTON(1) reading only tells you when the mouse button is being pressed and if you execute a block of code at that time, you are likely to execute it several times if the user is slow to release or the code is slow to read the mouse clear update, _Mousebutton(1) = 0.
I have only recently seen a best solution by Steve to be clear of mouse button down condition before executing a "Mouse Click Event" block of code.
I have only tested this in newly revised cSleep but looks good to me and you know Steve came up with it so it's got to be good (if it is bug free).
A demo of the technique:Code: QB64: [Select]
PRINT "Hello World, press key, click mouse or wait 5 secs for goodbye." cSleep 5 PRINT "goodbye world" 'c for click + SLEEP, this does force you to commit to a max time to wait startTime = TIMER wayt = 1 WHILE wayt _LIMIT 30 'here is steve's with midnight problem but really nice clear of mouse (and keypresses?) _KEYCLEAR 'clear the keyboard buffer so we don't automatically exit the routine _LIMIT 10
The oldMouse variable helps us get clear of the mouse down condition before we execute our mouse click code.