Advertisement
recca062

Ragnarok Online - Auto Potion w/ GUI

Mar 14th, 2016
3,632
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Ragnarok Online - Auto Potion
  2. ; Made by Recca
  3. ; http://ragindex.blogspot.com
  4.  
  5. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  6. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  7. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  8. if not A_IsAdmin
  9. {
  10.    Run *RunAs "%A_ScriptFullPath%"  ; Requires v1.0.92.01+
  11.    ExitApp
  12. }
  13. Coordmode, Pixel, Screen
  14. Coordmode, Mouse, Screen
  15. IniRead, Stop, AutoP Setting.ini, Hotkey, Stop
  16. IniRead, Start, AutoP Setting.ini, Hotkey, Start
  17. IniRead, HealthPot, AutoP Setting.ini, Hotkey, HealthPot
  18. IniRead, ManaPot, AutoP Setting.ini, Hotkey, ManaPot
  19. IniRead, MsgrNah, AutoP Setting.ini, WarningMsg, Value
  20.  
  21. Hotkey, %Stop%, Stop
  22. Hotkey, %Start%, Start
  23.  
  24. Gui, Add, Button, gPickHP, Pick HP coordinate
  25. Gui, Add, Edit, xp+110 yp+2 w70 h20 vHPCoor +Center
  26. Gui, Add, Listview, w20 h20 xp+70 vHPColor
  27. Gui, Add, Text, xp+23 yp+2 vHPp w20,
  28.  
  29. Gui, Add, Button, gPickSP x10 y30, Pick SP coordinate
  30. Gui, Add, Edit, xp+110 yp+2 w70 h20 vSPCoor +Center
  31. Gui, Add, Listview, w20 h20 xp+70 vSPColor
  32. Gui, Add, Text, xp+23 yp+2 vSPp w20,
  33.  
  34. if MsgrNah = 1
  35.     Gui, Add, Checkbox, xp-17 yp+23 Checked w59 h50 vMsgrNah, Warn`ning`nBox
  36. else
  37.     Gui, Add, Checkbox, xp-17 yp+23 w59 h50 vMsgrNah, Warn`ning`nBox
  38.  
  39. Gui, Add, Text, x10 y60 cRed, HP Potion
  40. Gui, Add, Hotkey, xp+80 yp w100 +Center Limit190 vHealthButton, %HealthPot%
  41.  
  42. Gui, Add, Text, x10 y85 cBlue, SP Potion
  43. Gui, Add, Hotkey, xp+80 yp w100 +Center Limit190 vManaButton, %ManaPot%
  44.  
  45. Gui, Add, Groupbox, x10 y110 w210 h65 cBlue,  Hotkeys ( check "AutoP Setting.ini" )
  46. Gui, Add, Text, xp+10 yp+20, START Hotkey
  47. Gui, Add, Text, xp+120 yp, STOP Hotkey
  48. Gui, Add, Hotkey,+Center xp-130 yp+20 w100 h20 vStart Disabled, %Start%
  49. Gui, Add, Hotkey,+Center xp+109 yp w100 h20 vStop Disabled , %Stop%
  50.  
  51. Gui, Add, Button, x10 y185 w100 h25 gSave, Save data
  52. Gui, Add, Button, xp+110 yp w100 h25 gLoad, Load
  53.  
  54. Gui, Add, Text, cBlue x10 y220, By : Recca
  55. Gui, Add, Link, xp+60 yp, <a href="http://ragindex.blogspot.com">http://ragindex.blogspot.com</a>
  56. Gui, Show, w245, Auto Potion
  57. Return
  58.  
  59. GuiClose:
  60. Gui, submit, nohide
  61. IniWrite, %MsgrNah%, AutoP Setting.ini, WarningMsg, Value
  62. ExitApp
  63. return
  64.  
  65. Save:
  66. FileSelectFile, SaveFile, S, %A_ScriptDir%,,*.ini
  67. If Errorlevel
  68.     return
  69. Gui, submit, nohide
  70. IniWrite, %HPCoor%, %SaveFile%.ini, Coordinate, HP
  71. IniWrite, %SPCoor%, %SaveFile%.ini, Coordinate, SP
  72.  
  73. IniWrite, %HealthButton%, %SaveFile%.ini, Hotkey, HP
  74. IniWrite, %ManaButton%, %SaveFile%.ini, Hotkey, SP
  75.  
  76. IniWrite, %HP%, %SaveFile%.ini, Color, HP
  77. IniWrite, %SP%, %SaveFile%.ini, Color, SP
  78. return
  79.  
  80. Load:
  81. FileSelectFile, LoadFile, , %A_ScriptDir%,,*.ini
  82. If Errorlevel
  83.     return
  84. IniRead, output, %LoadFile%, Coordinate, HP
  85. GuiControl,, HPCoor, %output%
  86. StringSplit, temp_, output, `,
  87. pointBetween := temp_1-39
  88. perc :=Round(pointBetween/(130/100),0)
  89. GuiControl,, HPp, %perc%`%
  90.  
  91. IniRead, output, %LoadFile%, Coordinate, SP
  92. GuiControl,, SPCoor, %output%
  93. StringSplit, temp_, output, `,
  94. pointBetween := temp_1-39
  95. perc :=Round(pointBetween/(130/100),0)
  96. GuiControl,, SPp, %perc%`%
  97.  
  98. IniRead, output, %LoadFile%, Hotkey, HP
  99. GuiControl,, HealthButton, %output%
  100. IniRead, output, %LoadFile%, Hotkey, SP
  101. GuiControl,, ManaButton, %output%
  102.  
  103. IniRead, output, %LoadFile%, Color, HP
  104. GuiControl, +Background%output%, HPColor
  105. HP := output
  106.  
  107. IniRead, output, %LoadFile%, Color, SP
  108. GuiControl, +Background%output%, SPColor
  109. SP := output
  110. return
  111.  
  112. PickSP:
  113. Gui, submit, nohide
  114. if MsgrNah = 1
  115. {
  116. MsgBox,49,, After this message box disappear`nthe next location you click will be the coordinate this script moniter`nWhenever the coordinate's color change`, potion will be use`n`nUse ( Alt + Tab ) to switch window and `nI RECOMMEND you to pick coordinate when SP is 100`% FULL
  117. IfMsgBox, Cancel
  118.     return
  119. }
  120. KeyWait LButton, D
  121. Mousegetpos, x, y
  122. PixelGetColor, SP, x, y, RGB
  123. if (SP = 0xFFFFFF or SP = 0xB5B5B5 or SP = 0x5A6BAD)
  124. {
  125.     MsgBox, 48, Hmmm....., Did you miss the HP/SP bar? try again....
  126.     return
  127. }
  128. WinGetActiveTitle, Title
  129. ToolTip, MARKED
  130. SetTimer, RemoveToolTip, 500
  131. if SP = 0x000000
  132. Loop
  133.     {
  134.     x := x+1
  135.     PixelGetColor, SP, x, y, RGB
  136.     if SP = 0x000000
  137.         Continue
  138.     else
  139.         Break
  140.     }
  141. GuiControl,, SPCoor, %x%,%y%
  142. GuiControl, +Background%SP%, SPColor
  143. pointBetween := x-39
  144. perc :=Round(pointBetween/(130/100),0)
  145. ToolTip, %perc%`%
  146. SetTimer, RemoveToolTip, 1000
  147. GuiControl,, SPp, %perc%`%
  148. return
  149.  
  150. PickHP:
  151. Gui, submit, nohide
  152. if MsgrNah = 1
  153. {
  154. MsgBox,49,, After this message box disappear`nthe next location you click will be the coordinate this script moniter`nWhenever the coordinate's color change`, potion will be use`n`nUse ( Alt + Tab ) to switch window and `nI RECOMMEND you to pick coordinate when HP is 100`% FULL
  155. IfMsgBox, Cancel
  156.     return
  157. }
  158. KeyWait LButton, D
  159. Mousegetpos, x, y
  160. PixelGetColor, HP, x, y, RGB
  161. if (HP = 0xFFFFFF or HP = 0xB5B5B5 or HP = 0x5A6BAD)
  162. {
  163.     MsgBox, 48, Hmmm....., Did you miss the HP/SP bar? try again....
  164.     return
  165. }
  166. WinGetActiveTitle, Title
  167. ToolTip, MARKED
  168. SetTimer, RemoveToolTip, 500
  169. if HP = 0x000000
  170. Loop
  171.     {
  172.     x := x+1
  173.     PixelGetColor, HP, x, y, RGB
  174.     if HP = 0x000000
  175.         Continue
  176.     else
  177.         Break
  178.     }
  179. GuiControl,, HPCoor, %x%,%y%
  180. GuiControl, +Background%HP%, HPColor
  181. pointBetween := x-39
  182. perc :=Round(pointBetween/(130/100),0)
  183. ToolTip, %perc%`%
  184. SetTimer, RemoveToolTip, 1000
  185. GuiControl,, HPp, %perc%`%
  186. return
  187.  
  188. Start:
  189. Gui, submit, nohide
  190. IfWinActive, Auto Potion
  191.     return
  192. WinGetActiveTitle, Title
  193. StringSplit, coor1_, HPCoor, `,
  194. StringSplit, coor2_, SPCoor, `,
  195. SetTimer, TimerStart, 100
  196. ToolTip, STARTED
  197. SetTimer, RemoveToolTip, 500
  198. return
  199.  
  200. TimerStart:
  201. IfWinActive, Auto Potion
  202. {
  203. ToolTip, STOPPED
  204. SetTimer, TimerStart, off
  205. SetTimer, RemoveToolTip, 500
  206. }
  207. if HP !=
  208. {
  209. PixelGetColor, HP1, coor1_1, coor1_2, RGB
  210. if (HP != HP1)
  211. {
  212.     ControlSend,, {%HealthButton%},%Title%
  213.     Sleep 20
  214. }
  215. }
  216. if SP !=
  217. {
  218. PixelGetColor, SP1, coor2_1, coor2_2, RGB
  219. if (SP != SP1)
  220. {
  221.     ControlSend,, {%ManaButton%},%Title%
  222.     Sleep 20
  223. }
  224. }
  225. Return
  226.  
  227. Stop:
  228. IfWinActive, Auto Potion
  229.     return
  230. ToolTip, STOPPED
  231. SetTimer, TimerStart, off
  232. SetTimer, RemoveToolTip, 500
  233. mode := 0
  234. Return
  235.  
  236. RemoveToolTip:
  237. ToolTip
  238. SetTimer, RemoveToolTip, Off
  239. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement