
-----------------------------------
Ktomislav
Fri Sep 12, 2008 9:56 am

Help with Mouse.ButtonWait
-----------------------------------
Hi, I'm new here.
I have a little problem. How can i stop the program form saving all my clicks with mouse.
The problem is that program saves all my clicks even if it is in delay command.
Here is an example. If i click fast at this box the program will write "Help" more times than
 it should.


Draw.Box(1, 1, 100, 100, black)
var x, y, button, buttonupdown : int;

loop
    Mouse.ButtonWait("down", x, y, button, buttonupdown)
    if (button = 1) then
        put "Help"
        delay(1000)
    end if
end loop


-----------------------------------
Tony
Fri Sep 12, 2008 10:32 am

RE:Help with Mouse.ButtonWait
-----------------------------------
You should check the documentation to make sure that's the case, but it sounds like Mouse.ButtonWait will write (or rather read I guess) events from a buffer (same effect as typing on a keyboard really fast, and then using getch).

Try using edit: Mouse.Where to get the state at that instance.

-----------------------------------
Ktomislav
Fri Sep 12, 2008 11:01 am

Re: Help with Mouse.ButtonWait
-----------------------------------
Thanks, Tony.

-----------------------------------
Warchamp7
Fri Sep 12, 2008 12:17 pm

RE:Help with Mouse.ButtonWait
-----------------------------------
In my game, I use Mouse.Where (x, y, Button State : int) to get the position of the mouse and its state. 

Then I check if the mouse's x and y coordinates are inside those of my game's buttons. If it's inside that box and button = 1 (A button is down) then it registers it as clicked.

I have the code below but with this method, you can hold the mouse button down and it will keep firing.

Draw.Box(1, 1, 100, 100, black) 
var x, y, button, buttonupdown : int; 

loop 
    Mouse.Where (x, y, button)

    if x = 1 and y = and button = 1 then 
        put "Help" 
        delay(1000) 
    end if 

end loop

-----------------------------------
Tony
Fri Sep 12, 2008 12:30 pm

Re: RE:Help with Mouse.ButtonWait
-----------------------------------
In my game, I use Mouse.Where
Thx. I think that's what I meant to say.
