Page 1 of 2 12 LastLast
Results 1 to 15 of 30
  1. #1
    phj280600's Avatar
    Join Date
    Apr 2017
    Gender
    male
    Posts
    206
    Reputation
    10
    Thanks
    130
    My Mood
    Inspired

    Trove Background Click and ClickDrag Functions For AHK

    I present to you the 2 functions I made for clicking and click-dragging in trove while the window is not focused.
    It's not perfect and I can't guarantee that it will work in all situations but seems to work pretty well for me.

    Enjoy you freeloaders.


    BackgroundClick(x, y, messageDelay, PID) {

    lParam := x | (y << 16)

    SendMessage, 0x006, 00000002, 00000000, , ahk_pid %PID% ;ACTIVE
    PostMessage, 0x200, 00000001, %lParam%, , ahk_pid %PID% ;MOUSEMOVE

    PostMessage, 0x201, 0x00120BD6, 0x01D80041, , ahk_pid %PID% ;LBUTTONDOWN
    Sleep, %messageDelay%
    PostMessage, 0x202, 0x00120BD6, 0x01D80041, , ahk_pid %PID% ;LBUTTONUP

    return
    }

    BackgroundClickDrag(startX, startY, endX, endY, messageDelay, PID) {
    ;MessageDelay is used twice because we are using 3 messages that use the mouse

    lParam := startX | (startY << 16)

    SendMessage, 0x006, 00000002, 00000000, , ahk_pid %PID% ;ACTIVE

    PostMessage, 0x200, 00000001, %lParam%, , ahk_pid %PID% ;MOUSEMOVE

    PostMessage, 0x201, 00000001, %lParam%, , ahk_pid %PID% ;LBUTTONDOWN
    Sleep, %messageDelay%
    lParam := endX | (endY << 16)
    PostMessage, 0x200, 0x0001, %lParam%, , ahk_pid %PID% ;MOUSEMOVE
    Sleep, %messageDelay%
    PostMessage, 0x202, 00000000, 02020001, , ahk_pid %PID% ;LBUTTONUP

    return
    }

  2. The Following 2 Users Say Thank You to phj280600 For This Useful Post:

    bobdylanfrank (05-29-2020),UnderFear (11-10-2020)

  3. #2
    bobdylanfrank's Avatar
    Join Date
    May 2015
    Gender
    male
    Posts
    48
    Reputation
    10
    Thanks
    10
    Could you please tell me how to locate and specify coordinates for the programme? I have a coordinate script but not sure if its the same for this ahk script. The check coordinate script I uses is simple:

    CoordMode, Mouse, Screen
    SetTimer, Check, 20
    return

    Check:
    MouseGetPos, xx, yy
    Tooltip %xx%`, %yy%
    return

    Esc::ExitApp

  4. #3
    phj280600's Avatar
    Join Date
    Apr 2017
    Gender
    male
    Posts
    206
    Reputation
    10
    Thanks
    130
    My Mood
    Inspired
    Quote Originally Posted by bobdylanfrank View Post
    Could you please tell me how to locate and specify coordinates for the programme? I have a coordinate script but not sure if its the same for this ahk script. The check coordinate script I uses is simple:

    CoordMode, Mouse, Screen
    SetTimer, Check, 20
    return

    Check:
    MouseGetPos, xx, yy
    Tooltip %xx%`, %yy%
    return

    Esc::ExitApp
    I use the window spy that comes with ahk and pick the client coords.

  5. The Following User Says Thank You to phj280600 For This Useful Post:

    bobdylanfrank (05-29-2020)

  6. #4
    bobdylanfrank's Avatar
    Join Date
    May 2015
    Gender
    male
    Posts
    48
    Reputation
    10
    Thanks
    10
    To use the funtion, BackgroundClick(x, y, messageDelay, PID). The x and y are coordinates. What is message delay and PID

  7. #5
    phj280600's Avatar
    Join Date
    Apr 2017
    Gender
    male
    Posts
    206
    Reputation
    10
    Thanks
    130
    My Mood
    Inspired
    Quote Originally Posted by bobdylanfrank View Post
    To use the funtion, BackgroundClick(x, y, messageDelay, PID). The x and y are coordinates. What is message delay and PID
    MessageDelay is the milliseconds to sleep between each message in the function it's used once in the click and twice in the drag-click.
    PID = ProcessID. You can get it with WinGet, check the AHK docs for more info on it.

  8. #6
    Tisako's Avatar
    Join Date
    Feb 2013
    Gender
    male
    Posts
    111
    Reputation
    10
    Thanks
    30
    My Mood
    Aggressive
    Quote Originally Posted by phj280600 View Post
    MessageDelay is the milliseconds to sleep between each message in the function it's used once in the click and twice in the drag-click.
    PID = ProcessID. You can get it with WinGet, check the AHK docs for more info on it.
    Do not forget that Send / Post are different, the first sends the message immediately and waits for a response, and the second puts the message in the queue.

  9. #7
    bobdylanfrank's Avatar
    Join Date
    May 2015
    Gender
    male
    Posts
    48
    Reputation
    10
    Thanks
    10
    Wow, I got it working really good. Just 1 last question to clear things up. Using windows spy, I see 3 coordinates for mouse position: screen, window and client. Which one of these things should I be using?
    Last edited by bobdylanfrank; 06-04-2020 at 11:22 PM.

  10. #8
    Tisako's Avatar
    Join Date
    Feb 2013
    Gender
    male
    Posts
    111
    Reputation
    10
    Thanks
    30
    My Mood
    Aggressive
    Quote Originally Posted by bobdylanfrank View Post
    Wow, I got it working really good. Just 1 last question to clear things up. Using windows spy, I see 3 coordinates for mouse position: screen, window and client. Which one of these things should I be using?
    You send a message to the WINDOW (client area), so you must use the coordinates of the WINDOW (client area).

    WM_NCMOUSEMOVE - mouse movement in a non-client area (window title ...)
    WM_MOUSEMOVE - mouse movement in the client area

    You connect Spy ++ to the game window, activate the window (just go into it), and get the coordinates. Just notice, if you change the size of the window, then the coordinates will change.

  11. The Following User Says Thank You to Tisako For This Useful Post:

    bobdylanfrank (06-05-2020)

  12. #9
    phj280600's Avatar
    Join Date
    Apr 2017
    Gender
    male
    Posts
    206
    Reputation
    10
    Thanks
    130
    My Mood
    Inspired
    Quote Originally Posted by Tisako View Post
    You send a message to the WINDOW (client area), so you must use the coordinates of the WINDOW (client area).

    WM_NCMOUSEMOVE - mouse movement in a non-client area (window title ...)
    WM_MOUSEMOVE - mouse movement in the client area

    You connect Spy ++ to the game window, activate the window (just go into it), and get the coordinates. Just notice, if you change the size of the window, then the coordinates will change.
    Well said

  13. #10
    Trollface482's Avatar
    Join Date
    May 2020
    Gender
    male
    Posts
    9
    Reputation
    10
    Thanks
    0
    It doesn't work help

    My code:
    F6::WinGet, pidn, PID, A
    F7::MsgBox, %pidn%
    F10::BackgroundClick(888, 488, 100, %pidn%)

  14. #11
    phj280600's Avatar
    Join Date
    Apr 2017
    Gender
    male
    Posts
    206
    Reputation
    10
    Thanks
    130
    My Mood
    Inspired
    Quote Originally Posted by Trollface482 View Post
    It doesn't work help

    My code:
    F6::WinGet, pidn, PID, A
    F7::MsgBox, %pidn%
    F10::BackgroundClick(888, 488, 100, %pidn%)
    Could you be more specific then "it doesn't work"? Are you sure you have the right coords? are you sure trove was active when you got the PID since you're using A to get it from the current active window?

  15. #12
    Trollface482's Avatar
    Join Date
    May 2020
    Gender
    male
    Posts
    9
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by phj280600 View Post
    Could you be more specific then "it doesn't work"? Are you sure you have the right coords? are you sure trove was active when you got the PID since you're using A to get it from the current active window?
    The coordinates I was looking through Spy++ (Relative). I got the PID by pressing F6 in the active Trove window. I forgot to click the translate button. Sorry
    Last edited by Trollface482; 06-09-2020 at 05:30 AM.

  16. #13
    phj280600's Avatar
    Join Date
    Apr 2017
    Gender
    male
    Posts
    206
    Reputation
    10
    Thanks
    130
    My Mood
    Inspired
    Quote Originally Posted by Trollface482 View Post
    Координаты я смотрел через Spy++ (Relative). PID я получал по нажатию F6 в активном окне Trove.
    I don't speak Russian.

  17. #14
    Trollface482's Avatar
    Join Date
    May 2020
    Gender
    male
    Posts
    9
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by phj280600 View Post
    I don't speak Russian.
    I fixed it

  18. #15
    phj280600's Avatar
    Join Date
    Apr 2017
    Gender
    male
    Posts
    206
    Reputation
    10
    Thanks
    130
    My Mood
    Inspired
    Quote Originally Posted by Trollface482 View Post
    I fixed it
    Idk what the issue is, try checking if the message is sent with Spy++

Page 1 of 2 12 LastLast

Similar Threads

  1. [Request] asking for ahk scripts and a script for mining in fortuna?
    By imanewb149 in forum WarFrame Hacks & Cheats
    Replies: 0
    Last Post: 11-21-2018, 03:30 AM
  2. Twitch background images and other stuff for twitch
    By Darkerx424 in forum Help & Requests
    Replies: 0
    Last Post: 06-03-2013, 12:48 PM
  3. no hacks work for me click and help plz
    By runescaper in forum Combat Arms Help
    Replies: 3
    Last Post: 06-27-2010, 09:26 AM
  4. Word and Proxy lists for C-Force
    By Mexiforce in forum Hack Requests
    Replies: 2
    Last Post: 10-24-2006, 06:22 PM
  5. Replies: 3
    Last Post: 02-09-2006, 03:51 PM