Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Start the script with alt+a. 3 important things to make sure first:
  2. ; Run the game in Windowed mode!
  3. ; Run this script as Admin so it can lock mouse/keyboard input when it needs to click/select things
  4. ; When starting the script, make sure the hand cursor (use numpad 0 and arrow keys, not mouse) is on "Synthesize"
  5.  
  6. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  7. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  8. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  9.  
  10. #IfWinActive FINAL FANTASY XIV
  11.  
  12. ;Global Variables
  13. aSize := 0
  14. statusN := 1
  15. firstTime := 1
  16.  
  17. ;-----------------------------------------------------------------------------------------------------------------------------------
  18.  
  19. !a::    ;Pushing alt+a will start the macro. Change to whatever you want. "^" means ctrl, "+" for shift, "!" for alt or just the key
  20.  
  21. if (firstTime = 0) {
  22.     Gosub, sRepeat          ;Prompt to use the last set of macros and wait times
  23.    
  24. }
  25. while (waitingstate)
  26.         sleep 100  
  27. if (firstTime = 1) {
  28.     firstTime := 0
  29.     Gosub, sMacroNumber     ;Get Number of Macros
  30.  
  31.     loop, %macroN%
  32.     {
  33.         Gosub, sModifier        ;Get Modifier key
  34.         Gosub, sMacroKey        ;Get Macro Key
  35.         Gosub, sWaitTime        ;Get Wait Time after pressing Macro
  36.     }  
  37. }
  38.  
  39. Gosub, sCraftNumber     ;Get How many times to craft
  40. Gosub, sCollectible     ;For Collectibles, as they require an additional key press at the end
  41. while (waitingstate)
  42.     sleep 100
  43.  
  44.  
  45. ;=====BEGIN CRAFTING LOOP=====
  46. loop, %craftN%
  47. {
  48.             BlockInput On
  49.             WinActivate, FINAL FANTASY XIV
  50.  
  51.             SENDINPUT {Numpad0}         ;Selects the window
  52.             Sleep 500                   ;Waits .5 second
  53.             SENDINPUT {Numpad0}         ;Selects the Item to craft
  54.             Sleep 500                   ;Waits .5 second
  55.             SENDINPUT {Numpad0}         ;Selects "Synthesis" button
  56.             BlockInput Off
  57.             Sleep 2000                  ;Waits 2 seconds to crouch down
  58.            
  59.             loop, %macroN%
  60.             {
  61.                 BlockInput On          
  62.                 WinActivate, FINAL FANTASY XIV                             
  63.    
  64.                 if (mod%A_Index% = 3){
  65.                     SENDINPUT {Alt Down}
  66.                 }
  67.                 if (mod%A_Index% = 2){
  68.                     SENDINPUT {Control Down}
  69.                 }
  70.                 if (mod%A_Index% = 1){
  71.                     SENDINPUT {Shift Down}
  72.                 }
  73.        
  74.                 Sleep 300
  75.                 SEND % macro%A_Index%
  76.                 Sleep 300
  77.        
  78.                 SENDINPUT {Control Up}
  79.                 SENDINPUT {Shift Up}   
  80.                 SENDINPUT {Alt Up}
  81.                
  82.                 BlockInput Off
  83.                
  84.                 ;SplashTextOn, 200, 50, Crafting, Crafting %statusN% of %craftN%
  85.                 fProgressBar(macroN, statusN, A_Index)
  86.                 ;SetTimer, Off, % Wait%A_Index% * 1000
  87.                 ;Sleep % Wait%A_Index% * 1000
  88.             }
  89.            
  90.             if (collect = 1){
  91.                 BlockInput On
  92.                 WinActivate, FINAL FANTASY XIV
  93.                 Sleep 500
  94.                 SENDINPUT {Numpad0}
  95.                 Sleep 500
  96.                 BlockInput Off
  97.                 }
  98.    
  99.             statusN := statusN + 1
  100.             Sleep 2000
  101. }
  102.  
  103. MsgBox, Finished!
  104. statusN := 1
  105. return
  106.  
  107. ;-----------------------------------------------------------------------------------------------------------------------------------
  108.  
  109. sRepeat:
  110. {
  111.     Gui 2:-MinimizeBox -MaximizeBox
  112.     Gui, font, s9, Verdana
  113.     Gui, Add, Text, x22 y19 w220 h40 , Would you like to craft more using the same key(s) and wait time(s)?
  114.     Gui, Add, Button, x22 y69 w50 h25 gRepeatYes, &Yes
  115.     Gui, Add, Button, x132 y69 w50 h25 gRepeatNo Default, &No
  116.     waitingstate := true
  117.     Gui, Show,, Repeat?
  118.     Return
  119.    
  120.     RepeatYes:
  121.     {
  122.         Gui, Destroy
  123.         firstTime := 0
  124.         waitingstate := false
  125.     }
  126.     return
  127.        
  128.     RepeatNo:
  129.     {
  130.         Gui, Destroy
  131.         firstTime := 1
  132.         waitingstate := false
  133.     }
  134.     return
  135.    
  136.     2GuiClose:
  137.     Reload 
  138.  
  139. }
  140. ;-----------------------------------------------------------------------------------------------------------------------------------
  141.  
  142. sMacroNumber:
  143. {
  144.     InputBox, macroN, Number of Macros, How many Macros will you be using?, , 200, 180
  145.     if ErrorLevel
  146.     {
  147.         MsgBox, CANCEL was pressed
  148.         Reload
  149.     }
  150. Return
  151. }
  152.  
  153. ;-----------------------------------------------------------------------------------------------------------------------------------
  154.  
  155. sModifier:
  156. {
  157.     InputBox, mod%A_Index%, Use Modifier?, Use a modifier key for macro #%A_Index%? `n0=None `n1=Shift `n2=Control `n3=Alt, ,  300, 200
  158.     if ErrorLevel
  159.     {
  160.         MsgBox, CANCEL was pressed
  161.         Reload
  162.     }
  163.  
  164.     if mod%A_Index% <> 0
  165.     {
  166.             if mod%A_Index% <> 1
  167.             {
  168.                 if mod%A_Index% <> 2
  169.                 {
  170.                     if mod%A_Index% <> 3
  171.                     {
  172.                         MsgBox, Invalid Character Entered
  173.                         Reload
  174.                     }
  175.                 }
  176.             }
  177.     }
  178. Return
  179. }
  180. ;-----------------------------------------------------------------------------------------------------------------------------------
  181.  
  182. sMacroKey:
  183. {
  184.     InputBox, macro%A_Index%, Macro Key #%A_Index%, Enter the key for Macro #%A_Index%, , 200, 180
  185.     if ErrorLevel
  186.     {
  187.         MsgBox, CANCEL was pressed
  188.         Reload
  189.     }
  190. Return
  191. }
  192. ;-----------------------------------------------------------------------------------------------------------------------------------
  193.  
  194. sWaitTime:
  195. {
  196.     InputBox, wait%A_Index%, Wait #%A_Index%, How many seconds to wait after pressing the macro(macro%A_Index%)?, , 200, 180
  197.     if ErrorLevel
  198.     {
  199.         MsgBox, CANCEL was pressed
  200.         Reload
  201.     }
  202.  
  203. aSize = %A_Index%
  204. Return
  205. }
  206. ;-----------------------------------------------------------------------------------------------------------------------------------
  207.  
  208. sCraftNumber:
  209. {
  210.     InputBox, craftN, Craft Amount, How many times do you want to craft?, , 200, 180
  211.     if ErrorLevel
  212.     {
  213.         MsgBox, CANCEL was pressed
  214.         Reload
  215.     }
  216. Return
  217. }
  218. ;-----------------------------------------------------------------------------------------------------------------------------------
  219.  
  220. sCollectible:
  221. {
  222.     Gui 1:-MinimizeBox -MaximizeBox
  223.     Gui, font, s9, Verdana
  224.     Gui, Add, Text, x12 y9 w160 h70 , Is there a Collectible prompt at the end?
  225.     Gui, Add, Button, x12 y109 w55 h26 gCollectYes, &Yes
  226.     Gui, Add, Button, x122 y109 w55 h26 gCollectNo Default, &No
  227.     waitingstate := true
  228.     Gui, Show, h145 w189, Collectible?
  229.     Return
  230.    
  231.     CollectYes:
  232.     {
  233.         Gui, Destroy
  234.         collect = 1
  235.         waitingstate := false
  236.     }
  237.     return
  238.        
  239.     CollectNo:
  240.     {
  241.         Gui, Destroy
  242.         collect = 0
  243.         waitingstate := false
  244.     }
  245.     return
  246.    
  247.     GuiClose:
  248.     Reload
  249.  
  250. Return
  251. }
  252. ;-----------------------------------------------------------------------------------------------------------------------------------
  253.  
  254. fProgressBar(macroN, statusN, MacroC)
  255. {
  256. global
  257. iWaitTime := 0
  258. iWaitTime += Wait%A_Index%
  259. iWaitTime *= 1000
  260. iHundreth := iWaitTime / 100
  261. Gui 3:Default
  262. Gui, 3: +AlwaysOnTop
  263. Gui, Font, s10, Verdana
  264. Gui, Add, Progress, x10 y10 w300 h20 vIndex%macroN% c00C6FF BackgroundBBBBBB
  265. Gui, Add, Text, x10 y10 w300 h20 +0x200 cFFFFFF +Center +BackgroundTrans vFile, Macro %macroC% of %macroN%
  266. Gui, Add, Text, x10 y+2 w300 h20 +0x200 c000000 +Center +BackgroundTrans, Crafting %statusN% of %craftN%
  267. Gui, Show, AutoSize NoActivate , Crafting Progress
  268.  
  269. loop, 100
  270. {
  271.     GuiControl,, Index%macroN%, % A_Index
  272.     GuiControl,, File, Macro %macroC% of %macroN%
  273.     sleep %iHundreth%
  274. }
  275. Gui, Destroy
  276. return
  277. }
  278.  
  279. ;-----------------------------------------------------------------------------------------------------------------------------------
  280.  
  281. Off:
  282. SplashTextOff
  283. Return
  284. ;-----------------------------------------------------------------------------------------------------------------------------------
  285.  
  286. !p::
  287. SENDINPUT {Numpad0}
  288. Return
  289. ;-----------------------------------------------------------------------------------------------------------------------------------
  290.  
  291. !o::
  292. SEND {NumpadEnter}
  293. Return
  294. ;----------------------------------------------------------------------------------------------------------------------------------
  295.  
  296. ^r::
  297. firstTime = TRUE
  298. Reload
  299. Return
  300. ;-----------------------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement