zoomed coords

  • babay
    9th Aug 2012 Member 0 Permalink

    afaik there is no way to get proper coordinates of cursor wlite it's inside zoom box, am i right?

  • boxmein
    9th Aug 2012 Former Staff 0 Permalink
    @babay (View Post)
    Right.
    On the IRC there lingered a "brushx & brushy" suggestion, but that one is gone.
    [](/colgate "Obligatory brushie: youtube.com/watch?v=fk8VdtjNsE8")
  • babay
    9th Aug 2012 Member 0 Permalink

    ok, then i think i haven't been wasting my time for last hour :p

  • jacob1
    9th Aug 2012 Developer 0 Permalink
    There actually is a way. Cracker's multiplayer lua script can get the zoomed mouse coords correctly. It has to keep track of which zoom buttons you press, and uses the exact same code that tpt does to get them. Look at the script to see how it works.
  • Pilihp64
    9th Aug 2012 Developer 0 Permalink

    You can simulate zoom coords by watching z key and scrolls, which I did for my multiplayer script, you can look in there (it's a bit messy, so you may need to ask me).  I will make this a separate script if you want.  It is actually very simple.

    EDIT: Here is a script that adjusts mouse by zoom window only, you can do whatever you want with it.

    http://pastebin.com/Q7rB1BCs

  • babay
    9th Aug 2012 Member 0 Permalink

    @cracker64 (View Post)

     

    i did some tests and it seemed to me that mouse state is transferred to mouseclick listeners only when lmb or rmb is pressed :/ trying your script now...

     

    edit: well, yeah, it works like it should. and i found the reason of this ^. i accidentaly put a wheel state updater in "if event == 1 or event == 3" block

  • Pilihp64
    9th Aug 2012 Developer 0 Permalink

    @babay (View Post)

    Yea, mouse hooks are only called when something happens (clicks,holds,release, and wheel)

    So if you wanted something with mouseover.. yea you can't do that.

    EDIT: fixed a small bug in the key_hook, it was supposed to ignore releases before bracket changes size.

  • babay
    9th Aug 2012 Member 0 Permalink

    i think you should fix another one. tpt can ignore mouse clicks if listener functions return "false".

     


            if(bc && bq){
                if(!luacon_mouseevent(x, y, bc, LUACON_MPRESS, sdl_wheel)){
                    b = 0;
                }
            }
            else if(bc && !bq){
                if(!luacon_mouseevent(x, y, bc, LUACON_MDOWN, sdl_wheel)){
                    b = 0;
                }
            }
            else if(!bc && bq){
                if(!luacon_mouseevent(x, y, bq, LUACON_MUP, sdl_wheel)){
                    b = 0;
                }
            }
            else if (sdl_wheel){
                luacon_mouseevent(x, y, bq, 0, sdl_wheel);
            }

     

     

    but it can't ignore wheel-only events

  • Pilihp64
    9th Aug 2012 Developer 0 Permalink

    @babay (View Post)

    Yea I know, All the mouse wheel checks are done before the lua hooks are ever called, so changing it there would do nothing.

    I believe this is fixed in TPT++ though, which should be coming 'soon'.  But it has other issues, zoom window is slightly different so this script doesn't work very well.

  • babay
    9th Aug 2012 Member 0 Permalink

    oh, yes, wheel checks are 50 lines before.

    maybe it'll be okay if tpt.mousex/y will represent mouse coords considering zoom window