Advertisement
JimmyFLASH

RaidClicker GUI v1.2.0

Jun 13th, 2021 (edited)
4,412
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Release (2021-08-11)
  2. AppVer := "RaidClicker v1.2.0"
  3. ;Made by JimmyFLASH
  4. ;jimmyflash(at)seznam.cz
  5. ;Pastebin: https://pastebin.com/7vUps4YP
  6. ;AutoHotkey: https://www.autohotkey.com/
  7. ;
  8. ;This script to be used with AutoHotkey software. Save the script as a "WhatEverName.ahk" file.
  9. ;This script helps in the Raid Shadow Legends game to automatically Replay Battle or Play Next Level Battle.
  10. ;Is possible to set clicking interval, count or duration.
  11.  
  12. #MaxThreadsPerHotkey 2
  13. #SingleInstance Off     ;[ForceIgnorePromptOff]
  14. SetTitleMatchMode, 2
  15.  
  16. ; Initial Variables
  17. Counter := 0
  18. Duration := 0
  19. Stopwatch := new SecondCounter
  20. txtStatus := "Disabled"
  21.  
  22. ; Create GUI
  23. ; Controlls
  24. Gui, Add, Text, x35, F3: Enable/Disable         F8: Exit
  25.  
  26. ; Groups
  27. Gui, Add, GroupBox, x10 w215 h70, Interval
  28. Gui, Add, GroupBox, x10 w215 h115, Duration
  29. Gui, Add, GroupBox, x10 w215 h40, Command
  30.  
  31. ; Interval
  32. Gui, Add, Text, x23 y45, Hour
  33. Gui, Add, Text, xp+50, Min
  34. Gui, Add, Text, xp+50, Sec
  35. Gui, Add, Text, xp+50, mSec
  36.  
  37. Gui, Add, Edit, x20 yp+16 w45
  38. Gui, Add, UpDown, vCtrl_Int_H 0x80 Range0-999, 0  ;set initial Interval (Hour)
  39. Gui, Add, Edit, x+5 w45
  40. Gui, Add, UpDown, vCtrl_Int_M 0x80 Range0-999, 0  ;set initial Interval (Min)
  41. Gui, Add, Edit, x+5 w45
  42. Gui, Add, UpDown, vCtrl_Int_S 0x80 Range0-999, 5 ;set initial Interval (Sec)
  43. Gui, Add, Edit, x+5 w45
  44. Gui, Add, UpDown, vCtrl_Int_mS 0x80 Range0-999, 0 ;set initial Interval (mSec)
  45.  
  46. ; Duration
  47. ; Duration Radio Buttons (move "Checked" for change initial value)
  48. Gui, Add, Radio, Checked x20 y125 vCtrl_Radio1 RadioGroupDuration, Infinite     ;Infinite
  49. Gui, Add, Radio, x+10 vCtrl_Radio2, Counter     ;Counter
  50. Gui, Add, Radio, x20 yp25 vCtrl_Radio3 , Timer     ;Timer
  51.  
  52. ; Counter
  53. Gui, Add, Edit, x140 y122 w75
  54. Gui, Add, UpDown, vCtrl_MaxCount 0x80 Range1-1000000, 100  ;set initial Counter
  55.  
  56. ; Timer
  57. Gui, Add, Text, x23 y170, Hour
  58. Gui, Add, Text, xp+50, Min
  59. Gui, Add, Text, xp+50, Sec
  60. Gui, Add, Text, xp+50, mSec
  61.  
  62. Gui, Add, Edit, x20 yp+16 w45
  63. Gui, Add, UpDown, vCtrl_Dur_H 0x80 Range0-999, 0  ;set initial Duration (Hour)
  64. Gui, Add, Edit, x+5 w45
  65. Gui, Add, UpDown, vCtrl_Dur_M 0x80 Range0-999, 3  ;set initial Duration (Min)
  66. Gui, Add, Edit, x+5 w45
  67. Gui, Add, UpDown, vCtrl_Dur_S 0x80 Range0-999, 30  ;set initial Duration (Sec)
  68. Gui, Add, Edit, x+5 w45
  69. Gui, Add, UpDown, vCtrl_Dur_mS 0x80 Range0-999, 0  ;set initial Duration (mSec)
  70.  
  71. ; Command
  72. ; Command Radio Buttons (move "Checked" for change initial value)
  73. Gui, Add, Radio, Checked x20 y240 vCtrl_Radio_Replay RadioGroupCommand, Replay  ;Replay
  74. Gui, Add, Radio, x+10 vCtrl_Radio_Next, Next  ;Next
  75. Gui, Add, Radio, x+10 vCtrl_Radio_Custom, Next/Replay  ;Custom
  76.  
  77. ; Status Text + Counter
  78. Gui, Add, Text, x15 y+20, RaidClicker status:
  79. Gui, Font, s12 bold,
  80. Gui, Add, Text, cRed x+5 yp-5 w110 vCtrl_Status, %txtStatus%
  81. Gui, Font, s8 norm,
  82. Gui, Add, Text, x15, Counter:
  83. Gui, Add, Text, cRed x+5 w150 vCtrl_Counter, %Counter%
  84.  
  85. ; Progress Bars
  86. Gui, Add, Progress, x10 w215 h5 cBlue vCtrl_ProgressBarInt, 100
  87. Gui, Add, Progress, x10 yp+4 w215 h5 cRed vCtrl_ProgressBarDur, 100
  88.  
  89. ; Status Bar
  90. Gui, Add, StatusBar,, Bar's starting text (omit to start off empty).
  91. SB_SetText("   Made by JimmyFLASH")
  92.  
  93. ; Show GUI
  94. Gui, Show, NoActivate, %AppVer%
  95.  
  96. return
  97.  
  98. Update: ; Update GUI values
  99.     ElapsedTimeInt := A_TickCount - StartTimeInt
  100.     ElapsedTimeDur := A_TickCount - StartTimeDur
  101.     ElapsedTimeDurSec := ElapsedTimeDur // 1000
  102.  
  103.     ; check if the time is up
  104.     GuiControlGet, Ctrl_Dur_H
  105.     GuiControlGet, Ctrl_Dur_M
  106.     GuiControlGet, Ctrl_Dur_S
  107.     GuiControlGet, Ctrl_Dur_mS
  108.     GuiControlGet, Ctrl_Radio3
  109.     DurMax := Ctrl_Dur_mS + Ctrl_Dur_S*1000 + Ctrl_Dur_M*1000*60 + Ctrl_Dur_H*1000*60*60   
  110.     If  Ctrl_Radio3 AND (ElapsedTimeDur >= DurMax)
  111.         {
  112.         gosub StopTimer
  113.         }
  114.    
  115.     GuiControl, Text, Ctrl_Status, %txtStatus%
  116.     GuiControl, Text, Ctrl_Counter, %Counter% ( %ElapsedTimeDurSec% s)
  117.    
  118.     ValueInt := 100 - (ElapsedTimeInt * 100 / Interval)
  119.     ValueDur := 100
  120.     If  Ctrl_Radio2
  121.         {
  122.         ValueDur := 100 - (Counter * 100 / Ctrl_MaxCount)
  123.         }
  124.     If  Ctrl_Radio3
  125.         {
  126.         ValueDur := 100 - (ElapsedTimeDur * 100 / DurMax)
  127.         }
  128.     GuiControl,, Ctrl_ProgressBarInt, %ValueInt%
  129.     GuiControl,, Ctrl_ProgressBarDur, %ValueDur%
  130.  
  131.     ;MouseGetPos , OutputVarX, OutputVarY, , ,
  132.     ;SB_SetText(OutputVarX . " " . OutputVarY)
  133.     ;SB_SetText(Interval . " " . Counter . " " . Ctrl_MaxCount . " " . Toggle)
  134.     ;SB_SetText(Toggle)
  135. return
  136.  
  137. SendKey:  
  138.     StartTimeInt := A_TickCount
  139.     Counter++
  140.     gosub Update
  141.     GuiControlGet, Ctrl_Radio_Replay
  142.     GuiControlGet, Ctrl_Radio_Next
  143.     GuiControlGet, Ctrl_Radio_Custom
  144.  
  145.     ; Trigger the click
  146.     WinGetActiveTitle, Title
  147.     WinActivate, ahk_exe Raid.exe
  148.     If  Ctrl_Radio_Replay
  149.         {
  150.         ControlSend, , r, ahk_exe Raid.exe   ; send "R" key to Raid Window
  151.         }
  152.     If  Ctrl_Radio_Next
  153.         {
  154.         ControlSend, , {Space}, ahk_exe Raid.exe   ; send "SPACE" key to Raid Window
  155.         Sleep 25
  156.         ControlSend, , {Enter}, ahk_exe Raid.exe   ; send "ENTER" key to Raid Window
  157.         }
  158.     If  Ctrl_Radio_Custom                   ; Set custom commands for send to Raid Window
  159.         {
  160.         ControlSend, , {Space}, ahk_exe Raid.exe   ; send "SPACE" key to Raid Window
  161.         Sleep 25
  162.         ControlSend, , {Enter}, ahk_exe Raid.exe   ; send "ENTER" key to Raid Window
  163.         Sleep 1000
  164.         ControlSend, , r, ahk_exe Raid.exe   ; send "ENTER" key to Raid Window
  165.         }
  166.     Sleep 25
  167.     WinActivate, %Title%
  168.    
  169.     ; check if the counter is up
  170.     GuiControlGet, Ctrl_MaxCount
  171.     GuiControlGet, Ctrl_Radio2
  172.     If  Ctrl_Radio2 AND (Counter >= Ctrl_MaxCount)
  173.         {
  174.         gosub StopTimer
  175.         return
  176.         }
  177. return
  178.  
  179. RunTimer:
  180.     Toggle := !Toggle
  181.     txtStatus := "Enabled"
  182.     Counter := 0
  183.     Duration := 0
  184.     StartTimeInt := A_TickCount
  185.     StartTimeDur := A_TickCount
  186.     GuiControlGet, Ctrl_Int_H
  187.     GuiControlGet, Ctrl_Int_M
  188.     GuiControlGet, Ctrl_Int_S
  189.     GuiControlGet, Ctrl_Int_mS
  190.     Interval := Ctrl_Int_mS + Ctrl_Int_S*1000 + Ctrl_Int_M*1000*60 + Ctrl_Int_H*1000*60*60
  191.     SetTimer, SendKey, %Interval%
  192.     SetTimer, Update, 251
  193.     gosub Update
  194.     gosub SendKey
  195.  
  196.     ; check if the counter is up
  197.     GuiControlGet, Ctrl_MaxCount
  198.     GuiControlGet, Ctrl_Radio2
  199.     If  Ctrl_Radio2 AND (Counter >= Ctrl_MaxCount)
  200.         {
  201.         gosub StopTimer
  202.         return
  203.         }
  204. return
  205.  
  206. StopTimer:
  207.     Toggle := !Toggle
  208.     txtStatus := "Disabled"
  209.     Counter := 0
  210.     Duration := 0
  211.     StartTimeInt := A_TickCount
  212.     StartTimeDur := A_TickCount
  213.     SetTimer, SendKey, Off
  214.     SetTimer, Update, Off
  215.     gosub Update
  216. return
  217.  
  218. F3::
  219.     If Toggle
  220.     {
  221.         gosub StopTimer
  222.         return
  223.     }
  224.     gosub RunTimer
  225. return
  226.  
  227. F8::
  228. GuiClose:
  229.     ExitApp
  230. return
  231.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement