Skip to content

Commit

Permalink
Fixed script didn't enter correct info when some accounts were unactive.
Browse files Browse the repository at this point in the history
  • Loading branch information
DetroitApps committed Nov 4, 2019
1 parent 9ebc08d commit b49136d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 19 deletions.
15 changes: 10 additions & 5 deletions Scenarios/ConnectPlayersOnServer.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@ Main:
API.GuiUpdateProgressBar(0)

section := A_ScreenWidth . "x" . A_ScreenHeight
Loop, % API.GetNbWindows() {
i := 1
Loop, % API.GetTotalAccounts() {
;Skip unactive accounts
If !ArrayAccounts[A_Index].IsActive
Continue

;Get value for server slot
inputX := Scenario.GetValueFromIni(section, "x" ArrayAccounts[A_Index].ServerSlot)
inputY := Scenario.GetValueFromIni(section, "y" ArrayAccounts[A_Index].ServerSlot)
If (inputX = -1 || inputY = -1)
If (!inputX || !inputY)
{
API.LogWrite("Couldn't load account input position from INI, stopping current scenario.", 2)
return
}

window := API.GetWindow(A_Index)
window := API.GetWindow(i)
window.Activate()
window.WaitActive()

Expand All @@ -43,10 +47,11 @@ Main:
;Connect player
Sleep 50 * Settings.Speed
Click, 2
API.GuiUpdateProgressBar(A_Index, API.GetNbWindows())
API.GuiUpdateProgressBar(i, API.GetNbWindows())
i++
Sleep 500
}

API.LogWrite("Successfully connected " API.GetNbWindows() " characters.")
API.LogWrite("Successfully connected " i " characters.")
API.GuiUpdateProgressBar(100)
return
13 changes: 9 additions & 4 deletions Scenarios/LoginAccounts.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ Main:
section := A_ScreenWidth . "x" . A_ScreenHeight
inputX := Scenario.GetValueFromIni(section, "x")
inputY := Scenario.GetValueFromIni(section, "y")
If (inputX = -1 || inputY = -1)
If (!inputX || !inputY)
{
API.LogWrite("Couldn't load account input position from INI, stopping current scenario.", 2)
return
}
Loop, % API.GetNbWindows() {
i := 1
Loop, % API.GetTotalAccounts() {
;Skip unactive accounts
If !ArrayAccounts[A_Index].IsActive
Continue
If (Settings.WaitForAnkamaShield = True)
MsgBox, % Translate("UnlockShield", API.GetUsername(A_Index))
window := API.GetWindow(A_Index)
window := API.GetWindow(i)
window.Activate()
window.WaitActive()
window.Maximize()
Expand All @@ -35,7 +39,8 @@ Main:
Send, {Tab}
Sleep, 50 * Settings.Speed
Send {Enter}
API.GuiUpdateProgressBar(A_Index, API.GetNbWindows())
API.GuiUpdateProgressBar(i, API.GetNbWindows())
i++
SleepHandler(0) ;handle sleep based on speed settings (parameter is for added sleep)
}
API.GuiUpdateProgressBar(100)
Expand Down
28 changes: 19 additions & 9 deletions Scenarios/Out/MergedScenarios.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,22 @@ ConnectPlayersOnServer:
API.GuiUpdateProgressBar(0)

section := A_ScreenWidth . "x" . A_ScreenHeight
Loop, % API.GetNbWindows() {
i := 1
Loop, % API.GetTotalAccounts() {
;Skip unactive accounts
If !ArrayAccounts[A_Index].IsActive
Continue

;Get value for server slot
inputX := Scenario.GetValueFromIni(section, "x" ArrayAccounts[A_Index].ServerSlot)
inputY := Scenario.GetValueFromIni(section, "y" ArrayAccounts[A_Index].ServerSlot)
If (inputX = -1 || inputY = -1)
If (!inputX || !inputY)
{
API.LogWrite("Couldn't load account input position from INI, stopping current scenario.", 2)
return
}

window := API.GetWindow(A_Index)
window := API.GetWindow(i)
window.Activate()
window.WaitActive()

Expand All @@ -76,11 +80,12 @@ ConnectPlayersOnServer:
;Connect player
Sleep 50 * Settings.Speed
Click, 2
API.GuiUpdateProgressBar(A_Index, API.GetNbWindows())
API.GuiUpdateProgressBar(i, API.GetNbWindows())
i++
Sleep 500
}

API.LogWrite("Successfully connected " API.GetNbWindows() " characters.")
API.LogWrite("Successfully connected " i " characters.")
API.GuiUpdateProgressBar(100)
return

Expand Down Expand Up @@ -133,15 +138,19 @@ LoginAccounts:
section := A_ScreenWidth . "x" . A_ScreenHeight
inputX := Scenario.GetValueFromIni(section, "x")
inputY := Scenario.GetValueFromIni(section, "y")
If (inputX = -1 || inputY = -1)
If (!inputX || !inputY)
{
API.LogWrite("Couldn't load account input position from INI, stopping current scenario.", 2)
return
}
Loop, % API.GetNbWindows() {
i := 1
Loop, % API.GetTotalAccounts() {
;Skip unactive accounts
If !ArrayAccounts[A_Index].IsActive
Continue
If (Settings.WaitForAnkamaShield = True)
MsgBox, % Translate("UnlockShield", API.GetUsername(A_Index))
window := API.GetWindow(A_Index)
window := API.GetWindow(i)
window.Activate()
window.WaitActive()
window.Maximize()
Expand All @@ -158,7 +167,8 @@ LoginAccounts:
Send, {Tab}
Sleep, 50 * Settings.Speed
Send {Enter}
API.GuiUpdateProgressBar(A_Index, API.GetNbWindows())
API.GuiUpdateProgressBar(i, API.GetNbWindows())
i++
SleepHandler(0) ;handle sleep based on speed settings (parameter is for added sleep)
}
API.GuiUpdateProgressBar(100)
Expand Down
2 changes: 1 addition & 1 deletion settings_default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ F8=ActivateWindow8
F9=OpenDofusInstances
F10=LoginAccounts
F11=ConnectPlayersOnServer
F12=ExitApp
F12=CloseDofusInstances

0 comments on commit b49136d

Please sign in to comment.