Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. #WinActivateForce
  2.  
  3. Numpad3::
  4. WinGet, PID, PID, A
  5. WinGet, HWND, ID, A
  6. Break := 0
  7.  
  8. Loop
  9. {
  10. ControlSend, , {c down}, ahk_pid %PID%
  11. Sleep, 86
  12. ControlSend, , {c up}, ahk_pid %PID%
  13. Random, SleepTime, 3000, 6000
  14. Sleep, %SleepTime%
  15. If (Break = 1)
  16. {
  17. break
  18. }
  19. else
  20. {
  21. Sleep, 30
  22. }
  23. }
  24. return
  25.  
  26. Numpad6::
  27. WinGet, PID, PID, A
  28. WinGet, HWND, ID, A
  29.  
  30. Address := 0x00961904
  31. Base := getProcessBaseAddress(HWND)
  32. WaterAddress := GetAddressWater(PID, Base, Address)
  33. LavaAddress := GetAddressLava(PID, Base, Address)
  34. ChocoAddress := GetAddressChoco(PID, Base, Address)
  35.  
  36. Break := 0
  37.  
  38. Loop
  39. {
  40. If (Break = 1)
  41. {
  42. Break
  43. }
  44. else
  45. {
  46. Sleep, 30
  47. }
  48. ControlSend, , {c down}, ahk_pid %pid%
  49. Sleep, 86
  50. ControlSend, , {c up}, ahk_pid %pid%
  51. Sleep, 1000
  52. ControlSend, , {f down}, ahk_pid %pid%
  53. Sleep, 86
  54. ControlSend, , {f up}, ahk_pid %pid%
  55. Timer := 0
  56. While Timer = 0
  57. {
  58. Loop
  59. {
  60. CaughtWater := ReadMemory(PID, WaterAddress)
  61. CaughtLava := ReadMemory(PID, LavaAddress)
  62. CaughtChoco := ReadMemory(PID, ChocoAddress)
  63. If (CaughtWater = 1 or CaughtLava = 1 or CaughtChoco = 1)
  64. {
  65. Break
  66. }
  67. if Timer = 40
  68. {
  69. Break
  70. }
  71. Sleep, 1000
  72. Timer := Timer + 1
  73. }
  74. }
  75. Timer := 0
  76. ControlSend, , {f down}, ahk_pid %pid%
  77. Sleep, 86
  78. ControlSend, , {f up}, ahk_pid %pid%
  79. Sleep, 2000
  80. }
  81. return
  82.  
  83. Numpad9::
  84. Break := 1
  85. return
  86.  
  87. Numpad7::
  88. ExitApp
  89.  
  90. GetAddressWater(PID, Base, Address)
  91. {
  92. pointerBase := base + Address
  93. y1 := ReadMemory(PID, pointerBase)
  94. y2 := ReadMemory(PID, y1 + 0x144)
  95. y3 := ReadMemory(PID, y2 + 0xe4)
  96. Return WaterAddress := (y3 + 0x70)
  97. }
  98.  
  99. GetAddressLava(PID, Base, Address)
  100. {
  101. pointerBase := base + Address
  102. y1 := ReadMemory(PID, pointerBase)
  103. y2 := ReadMemory(PID, y1 + 0x144)
  104. y3 := ReadMemory(PID, y2 + 0xe4)
  105. Return LavaAddress := (y3 + 0x514)
  106. }
  107.  
  108. GetAddressChoco(PID, Base, Address)
  109. {
  110. pointerBase := base + Address
  111. y1 := ReadMemory(PID, pointerBase)
  112. y2 := ReadMemory(PID, y1 + 0x144)
  113. y3 := ReadMemory(PID, y2 + 0xe4)
  114. Return ChocoAddress := (y3 + 0x2c0)
  115. }
  116.  
  117. getProcessBaseAddress(HWND)
  118. {
  119. return DllCall( A_PtrSize = 4
  120. ? "GetWindowLong"
  121. : "GetWindowLongPtr"
  122. , "Ptr", HWND
  123. , "Int", -6
  124. , "Int64") ; Use Int64 to prevent negative overflow when AHK is 32 bit and target process is 64bit
  125. ; If DLL call fails, returned value will = 0
  126. }
  127.  
  128. ReadMemory(PID, MADDRESS)
  129. {
  130. VarSetCapacity(MVALUE,4,0)
  131. ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", PID, "UInt")
  132. ;DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)
  133. DllCall("ReadProcessMemory", "UInt", ProcessHandle, "Ptr", MADDRESS, "Ptr", &MVALUE, "Uint",4)
  134. Loop 4
  135. result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
  136. return, result
  137. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement