License from €75
DE EN FR ES IT CZ

Cursorposition abfragen

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  1. · 9 years ago
    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. Working on a game?

    The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license.

    See licenses Try it for free
  3. · 9 years ago
    Cursor position of the current viewport or cursor position in the entire scene?
  4. · 9 years ago
    of the entire screen.
  5. · 9 years ago
    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.
  6. · 9 years ago
    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.
  7. · 9 years ago
    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 
  8. · 9 years ago
    Oh no. Sorry. I am still new to lua. Thanks for the help.

This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.

New thread

Really delete this post?