My way of doing this would be:
Only count a mouseclick down if the mouse was up before clicking
Code: (Select All)
Sub domousestuff
Dim x, y, mb
STATIC OldMouse
While _MouseInput: Wend ' there we've polled the mouse we don't need to remain inside the loop unless we need mouse wheel
mb = _MouseButton(1)
If mb AND NOT OldMouse Then
x = Fix(_MouseX \ Fix(maxx \ 16))
y = Fix(_MouseY \ Fix(maxy \ 16))
grid(x, y) = 1 - grid(x, y)
End If
OldMouse = mb
End Sub
Only count a mouseclick down if the mouse was up before clicking