
-----------------------------------
msimard8
Mon Oct 10, 2005 5:07 pm

fast score counter
-----------------------------------
var mx, my,mc:int:=0
var score:=10

loop
mousewhere (mx,my,mc)

drawfillbox (200,200,400,500,red)

if mx > 200 and mx < 400 and my > 200 and my  200 and mx < 400 and my > 200 and my < 500 and mc = 1 and Time.Elapsed - lastClickTime > clickLength then
        score += 10
        lastClickTime := Time.Elapsed
    end if
    locate (1, 1)
    put score ..
end loop

-----------------------------------
Tony
Mon Oct 10, 2005 6:42 pm


-----------------------------------
the mouse button could still be held down and the score would count after every interval.

you should monitor for mouse release instead. User presses mouse down -- mc = 1. User releases the mouse -- mc = 0. That's when the score counts.

-----------------------------------
Token
Mon Oct 10, 2005 8:09 pm


-----------------------------------
TADA!
var mx, my, mc : int := 0
var score := 10

loop
    mousewhere (mx, my, mc)

    drawfillbox (200, 200, 400, 500, red)

    if mx > 200 and mx < 400 and my > 200 and my < 500 and mc = 1 then

        score += 10
    end if

    loop
        mousewhere (mx, my, mc)
        exit when mc = 0
        locate (1, 1)
        put score
    end loop

    locate (1, 1)
    put score

end loop

probibly not the most efficient way to do it, but it works. and it gives you an idea

-----------------------------------
[Gandalf]
Mon Oct 10, 2005 8:36 pm


-----------------------------------
No... that wouldn't work at all...  That loop messes up a lot, and limits you from doing a lot - efficiency has little to do with it.

setscreen ("offscreenonly")
var mx, my, mc : int := 0
var score := 10
var mouseDown : boolean := false

loop
    cls
    mousewhere (mx, my, mc)
    drawfillbox (200, 200, 400, 500, red)
    if mx > 200 and mx < 400 and my > 200 and my < 500 and mc = 1 and mouseDown = false then
        mouseDown := true
        score += 10
    elsif mc < 1 then
        mouseDown := false
    end if
    put score
    View.Update
end loop

-----------------------------------
TokenHerbz
Mon Oct 10, 2005 11:28 pm


-----------------------------------
If you want it to be able to click and hold, for the score to go sky hi,

Modify "Gandalfs" code 


elsif mc < 1 then


and put in...


else


*******
I just mentioned that cause you said somthing about a *fast* counter...??

-----------------------------------
[Gandalf]
Mon Oct 10, 2005 11:30 pm


-----------------------------------
Then you would also have to keep in mind that that 'else' would include if the right or middle mouse button are pressed, so that would be a way of "cheating".

-----------------------------------
TokenHerbz
Mon Oct 10, 2005 11:45 pm


-----------------------------------
eh, really??

button = 1 is left click,
0 = no click

whats right, and middle click?

-----------------------------------
Tony
Tue Oct 11, 2005 7:30 am


-----------------------------------
whats right, and middle click?
middle = 10
right = 100

but you have to

Mouse.ButtonChoose ("multibutton")

