Advertisement
Guest User

Ahk code

a guest
Mar 13th, 2017
951
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;If you use this, you have to use absolute screen coordinates.
  2. CoordMode, Mouse, Screen
  3.  
  4. ;Suppose a 100x100 px bounding box for your game inventory.
  5. ;Eg., from (500, 500) to (600, 600)
  6. w::
  7. {
  8.     ;Get current Mouse coords
  9.     MouseGetPos, xCurrent ,yCurrent
  10.  
  11.     ;Calculate future Mouse coords
  12.     xMoved := xCurrent
  13.     yMoved := yCurrent - 35
  14.  
  15.     ;Check if the future mouse postion will be
  16.     ;below the top border of your bounding box,
  17.     ;aka still inside it, after it has moved.
  18.     ;If so, proceed and move the mouse,
  19.     ;otherwise do nothing.
  20. MouseGetPos, CoordXRec, CoordYRec
  21.         MouseMove, xMoved, yMoved
  22.  
  23.  
  24. if(yMoved < 503 && yMoved > 350 && yMoved > 360){
  25. MouseMove 1846, 166
  26. }
  27. if(yMoved < 145){
  28. MouseMove, %CoordXRec%, %CoordYRec%, 0
  29. }
  30. if(yMoved < 718 && yMoved < 720 && yMoved > 680){
  31. MouseMove 1771, 671
  32. }
  33. return 
  34. }
  35. s::
  36. {
  37.     ;Get current Mouse coords
  38.     MouseGetPos, xCurrent ,yCurrent
  39.  
  40.     ;Calculate future Mouse coords
  41.     xMoved := xCurrent
  42.     yMoved := yCurrent +35
  43.  
  44.     ;Check if the future mouse postion will be
  45.     ;below the top border of your bounding box,
  46.     ;aka still inside it, after it has moved.
  47.     ;If so, proceed and move the mouse,
  48.     ;otherwise do nothing.
  49.  
  50.         MouseMove, xMoved, yMoved
  51.  
  52. if(yMoved > 285 && yMoved < 360){
  53. MouseMove 1773, 526
  54. }
  55. if(yMoved > 697 && yMoved < 715){
  56. MouseMove 1772, 736
  57. }
  58. return
  59. }
  60. a::
  61. {
  62.     ;Get current Mouse coords
  63.     MouseGetPos, xCurrent ,yCurrent
  64.  
  65.     ;Calculate future Mouse coords
  66.     xMoved := xCurrent -40
  67.     yMoved := yCurrent
  68.  
  69.     ;Check if the future mouse postion will be
  70.     ;below the top border of your bounding box,
  71.     ;aka still inside it, after it has moved.
  72.     ;If so, proceed and move the mouse,
  73.     ;otherwise do nothing.
  74.     if (xMoved > 1740) {
  75.         MouseMove, xMoved, yMoved
  76.     }
  77. return 
  78. }
  79. d::
  80. {
  81.     ;Get current Mouse coords
  82.     MouseGetPos, xCurrent ,yCurrent
  83.  
  84.     ;Calculate future Mouse coords
  85.     xMoved := xCurrent +40
  86.     yMoved := yCurrent
  87.  
  88.     ;Check if the future mouse postion will be
  89.     ;below the top border of your bounding box,
  90.     ;aka still inside it, after it has moved.
  91.     ;If so, proceed and move the mouse,
  92.     ;otherwise do nothing.
  93.     if (xMoved < 1917) {
  94.         MouseMove, xMoved, yMoved
  95.     }
  96. return 
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement