How do you get this to work? (Turing)

Computer builds, hardware and software discussion or troubleshooting, including peripherals. Essentially a general place to talk about desktop computers.
Locked
Anonymous

How do you get this to work? (Turing)

Post by Anonymous »

How do you get say a varible to read the place of where the mouse clicked?

I have this:

Code: Select all

var place, x, y, button : int

place:= Mouse.Where (x, y, button)[code]

But it doesn't work :S I get the error:
[quote] "Where" is a procedure call and hence does not return a value[/quote]

Any idea's? 

[color=#888888][size=85]Archived topic from Iceteks,  old topic ID:4098, old post ID:33608[/size][/color]
Anonymous

How do you get this to work? (Turing)

Post by Anonymous »

I don't know if I understood you right, but try this:

Code: Select all

var x, y, button, positionX, positionY := 0
loop
    Mouse.Where (x, y, button)
    locate (1, 1)
    put "x: ", x, " y: ", y, " clicked: ", positionX, " ", positionY
    if (button = 1) then
        positionX := x
        positionY := y
    end if
end loop
[code]

If you wish for a middle and right click, use this:

[code]
Mouse.ButtonChoose ("multibutton")
var x, y, button, left, middle, right : int

loop
    locate (1, 1)
    Mouse.Where (x, y, button)
    left := button mod 10
    middle := (button - left) mod 100
    right := button - middle - left
    put "X:", x, " Y:", y
    put "Left: ", left, " Middle: ", middle, " Right: ", right
end loop
[code] 

[color=#888888][size=85]Archived topic from Iceteks,  old topic ID:4098, old post ID:35025[/size][/color]
Locked