Skip to content

Commit

Permalink
- after spam rod-bag, wait for bag completely opened
Browse files Browse the repository at this point in the history
- after close bag, add inf loop for bag completely closed
  • Loading branch information
Nam Nguyen committed Sep 3, 2021
1 parent 576a56d commit 48e98ce
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
2 changes: 1 addition & 1 deletion const.au3
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$inputPath = './input.ini'
$inputPath = './settings.ini'

$bagCloseButtonColorRed = dec('C33222')
$bagCloseButtonColorWhite = dec('FFFFFF')
Expand Down
2 changes: 1 addition & 1 deletion generateInput.au3
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func generateInput()
GUISetOnEvent($GUI_EVENT_CLOSE, "_Cancel", $Form1)


local const $ButtonGenerate = GUICtrlCreateButton("Generate", 48, 168, 75, 25)
local const $ButtonGenerate = GUICtrlCreateButton("Save settings", 48, 168, 80, 25)
local const $ButtonCancel = GUICtrlCreateButton("Cancel", 144, 168, 75, 25)
GUICtrlSetOnEvent($ButtonGenerate, '_Generate')
GUICtrlSetOnEvent($ButtonCancel, '_Cancel')
Expand Down
4 changes: 4 additions & 0 deletions helper.au3
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,18 @@ endfunc

#region complex select
func doBagStuff()
_log('Doing bag stuff')
while isTabToolNotSelected()
_log('Clicking tab tool')
clickTabTool()
wend

while isBagOpened() and not isOpenBagButtonShown()
if rodCheckMarkExits() then
_log('Clicking close bag')
clickCloseBag()
Else
_log('Clicking select rod')
clickSelectRod()
endif
wend
Expand Down
38 changes: 25 additions & 13 deletions index.au3
Original file line number Diff line number Diff line change
Expand Up @@ -21,54 +21,66 @@ func ExitToggle()
EndFunc

While True

_log('Open bag')
local $startUsedRodTime
While isOpenBagButtonShown()
local $beginLoopTime
local $missedRod

_log('Spam rod-bag')
$beginLoopTime = TimerInit()
While isOpenBagButtonShown() and TimerDiff($beginLoopTime) < 5000
$startUsedRodTime = TimerInit()
clickUseRod()
clickOpenBag()
WEnd

_log('Detecting is bag opened')
local $beginLoopTime = TimerInit()
sleep(200)
$beginLoopTime = TimerInit()
while TimerDiff($beginLoopTime) < 5000
if isBagOpened() then
_log('Doing bag stuff')
doBagStuff()
_log('Wait for bag completely closed')
$beginLoopTime = TimerInit()
While not isOpenBagButtonShown() and TimerDiff($beginLoopTime) < 5000
WEnd
_log('Clicking use rod')
While isOpenBagButtonShown()
$beginLoopTime = TimerInit()
While isOpenBagButtonShown() and TimerDiff($beginLoopTime) < 5000
$startUsedRodTime = TimerInit()
clickUseRod()
WEnd
ExitLoop
endif
wend

$missedRod = false
do ;sleep 13s and detect for is missed rod?
local $currentTimeDiff = TimerDiff($startUsedRodTime)
_log('Sleep 13s: ' & Round($currentTimeDiff/100)/10 & 's')
if isOpenBagButtonShown() Then
alert('Missed rod')
_log('Missed rod')
$missedRod = true
EndIf
until $currentTimeDiff >= 13000
until $currentTimeDiff >= 13000 or $missedRod
if $missedRod then
ContinueLoop
endif

Local $initColor = getCurrentExclaimationColor()
Local $beginLoopTime = TimerInit()
$beginLoopTime = TimerInit()

_log('Detecting exclamimation')
Local $currentColor
local $missedRod = false
$missedRod = false
Do ;detecting exclaimation and detect for is missed rod?
$currentTimeDiff = TimerDiff($beginLoopTime)
_log('Detecting exclamimation ' & String($currentTimeDiff > 50000) & ' ' & Round($currentTimeDiff/100)/10 & 's')
_log('Detecting exclamimation ' & ' ' & Round($currentTimeDiff/100)/10 & 's')
$currentColor = getCurrentExclaimationColor()
if isOpenBagButtonShown() Then
alert('Missed rod')
_log('Missed rod')
$missedRod = true
EndIf
Until ($initColor <> $currentColor Or $currentTimeDiff > 50000) and not $missedRod
Until $initColor <> $currentColor Or $currentTimeDiff > 50000 or $missedRod

if $missedRod then
ContinueLoop
Expand Down

0 comments on commit 48e98ce

Please sign in to comment.