Advertisement
recca062

M.A.C.R.O.ahk

Sep 15th, 2016
5,743
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Nam: Ragnarok Onlin Smart Cast ( Self-Cast / Macro / Chain Macro )
  2. ; AutoHotkey Version:  Autohotkey_L
  3. ; Platform:       Windows Only
  4. ; Author:        Recca
  5. ; Description: A self-cast script  with smart macro for Ragnarok Online
  6. ; /camera to turn off CAMERA SMOOTH for more accurate Self-Cast
  7. ; SEE "http://ragindex.blogspot.com" FOR MORE INFORMATION
  8. #NoEnv
  9. SendMode Input
  10. SetWorkingDir %A_ScriptDir%
  11. #Persistent
  12. #SingleInstance force
  13. SetBatchLines -1
  14. Coordmode, Pixel, Screen
  15. CoordMode, Mouse, SCreen
  16.  
  17. ; Run As Admin - because latest clients only work w/ Run as Admin
  18. if not A_IsAdmin
  19. {
  20.    Run *RunAs "%A_ScriptFullPath%"
  21.    ExitApp
  22. }
  23.  
  24. configName = M.A.C.R.O.ini
  25.  
  26. IfNotExist, %configName%
  27. {
  28.     MsgBox There is no '%configName%' within this folder, app will exit now.
  29.     ExitApp
  30. }
  31. ToolTip, SPAM ON
  32. Sleep 1000
  33. x := 0
  34. x1 := 0
  35. s := 0
  36.  
  37. IniRead, lagrate, %configName%, Setting, SkillDelay
  38. IniRead, lagrate1, %configName%, Setting, UsableDelay
  39. IniRead, Suspend1, %configName%, Setting, PauseHotkey
  40. IniRead, Exit1, %configName%, Setting,ExitHotkey
  41. Hotkey, %Suspend1%, Suspend1
  42. Hotkey, %Exit1%, Exit1
  43.  
  44. Loop, read, %configName%
  45. {
  46.     IfInString, A_Loopreadline, ----- M.A.C.R.O -----
  47.     {
  48.         start := true
  49.         continue
  50.     }
  51.     if start = 1
  52.     {
  53.         IfInString, A_Loopreadline, //
  54.         {
  55.             StringSplit, fix_, A_Loopreadline, //
  56.             fix := fix_1
  57.             StringReplace, fix, fix, %A_Tab%,,all
  58.             StringReplace, fix, fix, %A_Space%,,all
  59.         }
  60.         else
  61.         {
  62.             fix := A_LoopReadLine
  63.             StringReplace, fix, fix, %A_Tab%,,all
  64.             StringReplace, fix, fix, %A_Space%,,all
  65.         }
  66.         if fix =
  67.             continue
  68.         IfInString, fix, ->
  69.         {
  70.             StringReplace, fix, fix, ->, #
  71.             StringSplit, Hotk_, fix, #
  72.             %Hotk_1%sequence = %Hotk_2%
  73.             Hotkey, %Hotk_1%, sequenceStart
  74.             Hotkey, %Hotk_1% Up, sequenceStop
  75.         }
  76.         else  IfInString, fix, ,u
  77.         {
  78.             StringTrimRight, nowHotk, fix, 2
  79.             Hotkey, %nowHotk%, start1
  80.             Hotkey, %nowHotk% Up, stop1
  81.         }
  82.         else  IfInString, fix, #
  83.         {
  84.             StringSplit, fix_, fix,#
  85.             StringSplit, temp_, fix_2,|
  86.             coor%temp_1% :=  temp_2
  87.             Hotkey, %fix_1%, Quickslot%temp_1%
  88.         }
  89.         else IfInString, fix, ,s
  90.         {
  91.             StringTrimRight, nowHotk1, fix, 2
  92.             Hotkey, %nowHotk1%, selfCast
  93.             Hotkey, %nowHotk1% Up, selfCast1
  94.         }
  95.         else
  96.         {
  97.             Hotkey, %fix%, start
  98.             Hotkey, %fix% Up, stop
  99.         }
  100.     }
  101. }
  102. ToolTip
  103. return
  104.  
  105. ; DONE
  106. QuickSlot1:
  107. QuickSlot2:
  108. StringRight, currSlot , A_ThisLabel, 1
  109. tempASD := coor%currSlot%
  110. StringSplit, slotTemp_, tempASD, `,
  111. BlockInput, On
  112. MouseGetPos, oldX, oldY
  113. MouseMove, slotTemp_1,slotTemp_2
  114. Sleep 20
  115. Send {LButton Down}
  116. Sleep 30
  117. Send {LButton Up}
  118. Sleep 20
  119. Send {LButton Down}
  120. Sleep 30
  121. Send {LButton Up}
  122. ;MouseMove, slotTemp_1,slotTemp_2
  123. MouseMove, oldX, oldY
  124. Sleep 50
  125. BlockInput, off
  126. return
  127.  
  128. selfCast1:
  129. return
  130. selfCast:
  131. Send {%A_Thishotkey%}
  132. if (A_Priorkey = A_ThisHotkey)
  133. {
  134.     if A_TimeSincePriorHotkey < 220
  135.     {
  136.         WinGetActiveTitle, ATitle
  137.         WinGetPos, winX, winY, winW, winH, %ATitle%
  138.         MouseGetPos, oriX, oriY
  139.         x := (winW/2)+5
  140.         y := (winH/2)+15
  141.         offSetX := (A_ScreenWidth-(A_ScreenWidth - winX))+x
  142.         offSetY := (A_ScreenHeight-(A_ScreenHeight - winY))+y
  143.             DllCall("SetCursorPos", int, offSetX, int, offSetY)
  144.             Send {%A_ThisHotkey%}
  145.             Sleep 10
  146.            DllCall("mouse_event", "UInt", 0x02)
  147.            Sleep 20
  148.             DllCall("mouse_event", "UInt", 0x04)
  149.             Sleep 30
  150.             DllCall("SetCursorPos", int, oriX, int, oriY)
  151.     }
  152. }
  153. return
  154.  
  155. sequenceStart:
  156. StringSplit, sequence_, %A_ThisHotkey%sequence, |
  157. s := 1
  158. while s = 1
  159. {
  160.     Loop %sequence_0%
  161.     {
  162.         temp := sequence_%A_Index%
  163.         StringSplit, temp_, temp, `,
  164.         if temp_0 = 3
  165.         {
  166.             Send {%temp_1%}
  167.             Sleep %temp_2%
  168.         }
  169.         else
  170.         {
  171.             Send {%temp_1%}
  172.             Sleep %temp_2%
  173.             Send {LButton Down}
  174.             Sleep 55
  175.             Send {Lbutton Up}
  176.             Sleep %temp_2%
  177.         }
  178.     }
  179.     if s = 0
  180.         break
  181. }
  182. return
  183.  
  184. sequenceStop:
  185. s := 0
  186. return
  187.  
  188. start:
  189. x := 1
  190. while x = 1
  191. {
  192.     Send {%A_ThisHotkey%}
  193.     Sleep %lagrate%
  194.     Click
  195.     Sleep %lagrate%
  196.     If x = 0
  197.         Break
  198. }
  199. return
  200.  
  201. stop:
  202. x := 0
  203. return
  204.  
  205. start1:
  206. x1 := 1
  207. while x1 = 1
  208. {
  209.     Send {%A_ThisHotkey%}
  210.     Sleep %lagrate1%
  211.     If x1 = 0
  212.         Break
  213. }
  214. return
  215.  
  216. stop1:
  217. x1 := 0
  218. return
  219.  
  220. Exit1:
  221. ExitApp
  222. return
  223.  
  224. Suspend1:
  225. Suspend
  226. toggle := !toggle
  227. if toggle = 1
  228. {
  229. ToolTip, HOTKEY PAUSED
  230. Sleep 1000
  231. ToolTip
  232. }
  233. else
  234. {
  235. ToolTip, SCRIPT STARTED
  236. Sleep 1000
  237. ToolTip
  238. }
  239. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement