Skip to content

Instantly share code, notes, and snippets.

@kuntau
Created November 9, 2016 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuntau/aeab10617977cdfbcaed5896a488a03c to your computer and use it in GitHub Desktop.
Save kuntau/aeab10617977cdfbcaed5896a488a03c to your computer and use it in GitHub Desktop.
TS AutoClick v2.0
#NoEnv
SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Client
SendMode Input
#SingleInstance Force
SetTitleMatchMode 2
#WinActivateForce
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1
; END_ENV
; GLOBAL_VAR
; 10 = 10 minutes, 20 = 20 minutes or 30 minutes when there is no special time
normalDuration := 30
maglevDuration := 15
; Workaround for yellow bar on portal
topNewsEnable := true
topNewsMargin := 7 * 2
topNewsCount := 2
topNewsEachHeight := 22
topNewsHeight := topNewsMargin + (topNewsEachHeight * topNewsCount)
delayActionTime := 500 ; wait time between train click
diffX := 60
diffY := 35
baseCoord := "480,670"
;;; TRAIN SETTINGS ;;;
totalSlot := 57
totalLane := 8
normalLane := 5
maglevLane := 3
; END GLOBAL_VAR
F5::Reload
F2::batchLoop(totalLane)
F3::batchLoop(maglevLane)
F4::batchLoop(normalLane)
Pause::Pause
;;; SET SLEEP DURATION ;;;
setSleepTime(dur) {
if (dur = 10) {
Sleep, 600000 ;10 minutes
}
else if (dur = 20 or dur = 30) {
Sleep, 1800000 ;30 minutes
}
return
}
batchLoop(c) {
global baseCoord
global delayActionTime
global normalDuration
global maglevDuration
global normalLane
global maglevLane
Loop, % c
{
adjuster := c == maglevLane ? A_index + 5 : A_index
Sleep, delayActionTime
clickTrain(baseCoord, adjuster)
Sleep, delayActionTime
clickJourneyTime(adjuster <= normalLane ? normalDuration : maglevDuration)
}
return
}
clickTrain(c, i) {
global diffX
global diffY
global topNewsEnable
global topNewsHeight
StringSplit, r, c, `,
x := r1 + ( diffX * ( i - 1 ) )
y := r2 - ( diffY * ( i - 1 ) )
if (topNewsEnable == true) {
y := y + topNewsHeight
}
clickMouse(x, y, 2)
; MouseMove, x, y
return
}
clickJourneyTime(dur) {
global topNewsEnable
global topNewsHeight
y := 715
if (topNewsEnable == true) {
y := y + topNewsHeight
}
if (dur = 10) {
clickMouse(750, y, 1) ; click 10 minutes
}
else if (dur = 15) {
clickMouse(930, y, 1) ; click 15 minutes
}
else if (dur = 30) {
clickMouse(1100, y, 1) ; click 20/30 minutes
}
}
clickMouse(x, y, c) {
WinActivate, TrainStation - Pixel Federation Games - Google Chrome ahk_class Chrome_WidgetWin_1
Click, %x%, %y%, Left, %c%
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment