Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

Cursorposition abfragen

  • #1, by constantin 8 years ago Zitieren
    Ich weiß, dass es dazu bereits Infos gibt, aber auch die Beispiele, die hier (https://wiki.visionaire-tracker.net/wiki/GetCursorPos) angegeben sind, scheinen nicht zu funktionieren. 
    Bitte: Wie kann ich die Cursorposition abfragen? 
  • #2, by afrlme 8 years ago Zitieren
    Cursor position of the current viewport or cursor position in the entire scene?
  • #3, by constantin 8 years ago Zitieren
    of the entire screen.
  • #4, by afrlme 8 years ago Zitieren
    getCursorPos() contains an X & a Y table, so you have to return those, it also only returns the position on the current viewport (scrollposition), which means if you want to check if the cursor is in a certain position in the entire scene that you need to include the current scrollposition value too.

    local pos = { x = (game.ScrollPosition.x + getCursorPos().x), y = (game.ScrollPosition.y + getCursorPos().y) }
    
    if pos.x == 500 and pos.y == 700 then
     -- do something
    end

    Maybe something along the lines of that.
  • #5, by constantin 8 years ago Zitieren
    thank you so far. is there a way to store the positions in a variable?
    i tried 

    Values["cursorx"] = pos.x 

    but it doesnt work.
  • #6, by sebastian 8 years ago Zitieren
    thank you so far. is there a way to store the positions in a variable?
    i tried 

    Values["cursorx"] = pos.x 

    but it doesnt work.
    A Value has more fields than you might see at first place: https://www.visionaire-studio.com/luadocs/#values-20

    Use Values["cursorx"].Int = pos.x 
  • #7, by constantin 8 years ago Zitieren
    Oh no. Sorry. I am still new to lua. Thanks for the help.