|
|
Line 1: |
Line 1: |
− | <pre>
| |
| | | |
− | InitGlobals()
| |
− | Gui, New
| |
− | Gui, +AlwaysOnTop +ToolWindow
| |
− | Gui, Add, Text,, How Many Passes?
| |
− | Gui, Add, Edit, vLoops
| |
− |
| |
− | Gui, Add, Text,, How Many Columns?
| |
− | Gui, Add, Edit, vColumns
| |
− |
| |
− | Gui, Add, Text,, How Many Rows?
| |
− | Gui, Add, Edit, vRows
| |
− |
| |
− | Gui, Add, Button, gStart, Continue
| |
− | Gui, Show
| |
− | return
| |
− |
| |
− | Start:
| |
− | Gui, Submit
| |
− | Gui, Destroy
| |
− |
| |
− | WinActivate, eGenesis Client
| |
− | WinGetActiveStats, Title, ScreenWidth, ScreenHeight, ScreenLeft, ScreenTop
| |
− | SetDefaultMouseSpeed, 9
| |
− |
| |
− | MsgBox, Position Cursor on Top Left Kettle and press Alt-S, then Bottom Right and press Alt-E. Press Alt-B to begin.
| |
− |
| |
− | return
| |
− |
| |
− | !s::
| |
− | MouseGetPos, topleftX, topleftY
| |
− | return
| |
− |
| |
− | !e::
| |
− | MouseGetPos, bottomrightX, bottomrightY
| |
− | return
| |
− |
| |
− | !r::
| |
− | Reload
| |
− | return
| |
− |
| |
− | !p::
| |
− | Pause
| |
− | return
| |
− |
| |
− | !b::
| |
− | global Loops
| |
− | WinActivate, eGenesis Client
| |
− | KettleWidth := Floor((bottomrightX - topleftX) / (Columns-1))
| |
− | KettleHeight := Floor((bottomrightY - topleftY) / (Rows-1))
| |
− |
| |
− | KettleCount := Columns * Rows
| |
− |
| |
− | PinWindows()
| |
− | loop %Loops%
| |
− | {
| |
− | CycleWindows()
| |
− | SelectPotash()
| |
− | CycleWindows()
| |
− | Begin()
| |
− | CycleWindows()
| |
− | Ignite()
| |
− | CycleWindows()
| |
− | Cook()
| |
− | }
| |
− | CloseWindows()
| |
− |
| |
− | return
| |
− |
| |
− | InitGlobals()
| |
− | {
| |
− | global topleftX := 0
| |
− | global topleftY := 0
| |
− | global bottomrightX := 0
| |
− | global bottomrightY := 0
| |
− | global Loops := 1
| |
− | global Columns := 1
| |
− | global Rows := 1
| |
− | global KettleWidth := 0
| |
− | global KettleHeight := 0
| |
− | global ScreenWidth := 0
| |
− | global ScreenHeight := 0
| |
− | global ScreenLeft := 0
| |
− | global ScreenTop := 0
| |
− | global KettleWidth := 0
| |
− | global KettleHeight := 0
| |
− | global KettleCount := 0
| |
− | global Kettles := []
| |
− | global k := 0
| |
− |
| |
− | }
| |
− | CycleWindows()
| |
− | {
| |
− | global Kettles
| |
− | index := Kettles.MaxIndex()
| |
− | loop
| |
− | {
| |
− | r := Kettles[index].r
| |
− | t := Kettles[index].t
| |
− | MouseClick,Left,r,t
| |
− | index := index - 1
| |
− | if index = 0
| |
− | break
| |
− | sleep 300
| |
− | }
| |
− | }
| |
− | SelectPotash()
| |
− | {
| |
− | global Kettles
| |
− |
| |
− | for index, value in Kettles
| |
− | {
| |
− | l := value.l
| |
− | t := value.t
| |
− | r := value.r
| |
− | b := value.b
| |
− | SelectWindow(value)
| |
− | ImageSearch,ButtonLeft, ButtonTop, l, t, r, b, Potash.png
| |
− | MouseClick,Left,ButtonLeft + 5, ButtonTop + 5
| |
− | sleep 200
| |
− | }
| |
− | sleep 300
| |
− | }
| |
− | Begin()
| |
− | {
| |
− | global Kettles
| |
− |
| |
− | for index, value in Kettles
| |
− | {
| |
− | l := value.l
| |
− | t := value.t
| |
− | r := value.r
| |
− | b := value.b
| |
− | SelectWindow(value)
| |
− | ImageSearch,ButtonLeft, ButtonTop, l, t, r, b, Begin.png
| |
− | MouseClick,Left,ButtonLeft + 5, ButtonTop + 5
| |
− | sleep 200
| |
− | }
| |
− | sleep 300
| |
− | }
| |
− | Ignite()
| |
− | {
| |
− | global Kettles
| |
− | global ScreenLeft
| |
− | global ScreenWidth
| |
− | global ScreenTop
| |
− | global ScreenHeight
| |
− |
| |
− | for index, value in Kettles
| |
− | {
| |
− | l := value.l
| |
− | t := value.t
| |
− | r := value.r
| |
− | b := value.b
| |
− | SelectWindow(value)
| |
− | ImageSearch, ButtonLeft, ButtonTop, l, t, r, b, Ignite.png
| |
− | MouseClick,Left,ButtonLeft + 5, ButtonTop + 5
| |
− | sleep 400
| |
− | sx := ScreenLeft + (ScreenWidth / 2)
| |
− | sy := ScreenTop + (ScreenHeight / 2)
| |
− | ex := sx
| |
− | ey := sy
| |
− | ButtonLeft := 0
| |
− | ButtonTop := 0
| |
− | GetWindow(sx, sy, ex, ey)
| |
− | ImageSearch, ButtonLeft, ButtonTop, sx, sy, ex, ey, Max.png
| |
− | MouseClick, Left, ButtonLeft + 5, ButtonTop + 5
| |
− | sleep 200
| |
− | SelectWindow(value)
| |
− | StrokeMax(value)
| |
− | sleep 200
| |
− | }
| |
− | sleep 300
| |
− | }
| |
− | Cook()
| |
− | {
| |
− | global Kettles
| |
− |
| |
− | for index, value in Kettles
| |
− | {
| |
− |
| |
− | SelectWindow(value)
| |
− | Loop
| |
− | {
| |
− | l := value.l
| |
− | t := value.t
| |
− | r := value.r
| |
− | b := value.b
| |
− | if FindImg(l,t,r,b,"wood2.png") = 0 then
| |
− | {
| |
− | StrokeMax(value)
| |
− | break
| |
− | }
| |
− | sleep 1000
| |
− | }
| |
− | }
| |
− | CycleWindows()
| |
− |
| |
− | for index, value in Kettles
| |
− | {
| |
− | SelectWindow(value)
| |
− | Loop
| |
− | {
| |
− | l := value.l
| |
− | t := value.t
| |
− | r := value.r
| |
− | b := value.b
| |
− | if FindImg(l,t,r,b,"water20.png") = 0 then
| |
− | {
| |
− | StrokeMax(value)
| |
− | break
| |
− | }
| |
− | sleep 1000
| |
− | }
| |
− | }
| |
− | CycleWindows()
| |
− |
| |
− | for index, value in Kettles
| |
− | {
| |
− | SelectWindow(value)
| |
− | Loop
| |
− | {
| |
− | l := value.l
| |
− | t := value.t
| |
− | r := value.r
| |
− | b := value.b
| |
− | if FindImg(l,t,r,b,"water15.png") = 0 then
| |
− | {
| |
− | StrokeMax(value)
| |
− | break
| |
− | }
| |
− | sleep 1000
| |
− | }
| |
− | }
| |
− | CycleWindows()
| |
− |
| |
− | for index, value in Kettles
| |
− | {
| |
− | SelectWindow(value)
| |
− | Loop
| |
− | {
| |
− | l := value.l
| |
− | t := value.t
| |
− | r := value.r
| |
− | b := value.b
| |
− | if FindImg(l,t,r,b,"water10.png") = 0 then
| |
− | {
| |
− | StrokeMax(value)
| |
− | break
| |
− | }
| |
− | sleep 1000
| |
− | }
| |
− | }
| |
− | CycleWindows()
| |
− |
| |
− | for index, value in Kettles
| |
− | {
| |
− | SelectWindow(value)
| |
− | Loop
| |
− | {
| |
− | l := value.l
| |
− | t := value.t
| |
− | r := value.r
| |
− | b := value.b
| |
− | if FindImg(l,t,r,b,"water5.png") = 0 then
| |
− | {
| |
− | StrokeMax(value)
| |
− | break
| |
− | }
| |
− | sleep 1000
| |
− | }
| |
− | }
| |
− | CycleWindows()
| |
− |
| |
− | for index, value in Kettles
| |
− | {
| |
− | SelectWindow(value)
| |
− | Loop
| |
− | {
| |
− | l := value.l
| |
− | t := value.t
| |
− | r := value.r
| |
− | b := value.b
| |
− | if FindImg(l,t,r,b,"take.png") = 0 then
| |
− | {
| |
− | Take(value)
| |
− | break
| |
− | }
| |
− | sleep 1000
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | StrokeMax(value)
| |
− | {
| |
− | l := value.l
| |
− | t := value.t
| |
− | r := value.r
| |
− | b := value.b
| |
− | ImageSearch,ButtonLeft, ButtonTop, l, t, r, b, StrokeMax.png
| |
− | MouseClick, Left, ButtonLeft + 5, ButtonTop + 5
| |
− | Sleep 200
| |
− | }
| |
− |
| |
− | FindImg(l,t,r,b,imgname)
| |
− | {
| |
− | ImageSearch, , , l, t, r, b, *20 %imgname%
| |
− | return ErrorLevel
| |
− | }
| |
− | Take(value)
| |
− | {
| |
− | l := value.l
| |
− | t := value.t
| |
− | r := value.r
| |
− | b := value.b
| |
− | ImageSearch,ButtonLeft, ButtonTop, l, t, r, b, Take.png
| |
− | MouseClick,Left,ButtonLeft + 5, ButtonTop + 5
| |
− | sleep 200
| |
− | }
| |
− | CloseWindows()
| |
− | {
| |
− | global Kettles
| |
− |
| |
− | for index, value in Kettles
| |
− | {
| |
− | r := value.r - 18
| |
− | t := value.t + 18
| |
− | MouseClick,Left,r,t
| |
− | sleep 200
| |
− | }
| |
− | }
| |
− | SelectWindow(win)
| |
− | {
| |
− | l := win.l + 1
| |
− | t := win.t
| |
− | r := win.r
| |
− | b := win.b - 1
| |
− | MouseClick,Left,l,b
| |
− | sleep 200
| |
− | }
| |
− | PinWindows()
| |
− | {
| |
− | global Rows
| |
− | global Columns
| |
− | global Kettles
| |
− |
| |
− | i := 0
| |
− | j := 0
| |
− | k := 0
| |
− | Loop % Rows
| |
− | {
| |
− | i := i + 1
| |
− | j := 0
| |
− | Loop % Columns
| |
− | {
| |
− | j := j + 1
| |
− | PinWindow(i,j)
| |
− | k := k + 1
| |
− | }
| |
− | sleep 200
| |
− | }
| |
− | }
| |
− | PinWindow(i, j)
| |
− | {
| |
− | global Kettles
| |
− | global KettleWidth
| |
− | global KettleHeight
| |
− | global topleftX
| |
− | global topleftY
| |
− | global ScreenLeft
| |
− | global ScreenWidth
| |
− | global ScreenTop
| |
− |
| |
− | PinX = 0
| |
− | PinY = 0
| |
− |
| |
− | posX := (topleftX + (KettleWidth * (j - 1)))
| |
− | posY := (topleftY + (KettleHeight * (i - 1)))
| |
− | MouseClick, Left, posX, posY
| |
− | sleep 300
| |
− | sl := posX
| |
− | st := posY - 250
| |
− | sr := posX + 250
| |
− | sb := posY + 250
| |
− | ImageSearch, PinX, PinY, sl, st, sr, sb, *30 pin.png
| |
− | if ErrorLevel = 0
| |
− | {
| |
− | MouseClick, Left, PinX, PinY
| |
− |
| |
− | WindowLeft := PinX
| |
− | WindowTop := PinY
| |
− | WindowRight := PinX
| |
− | WindowBottom := PinY
| |
− |
| |
− | GetWindow(WindowLeft, WindowTop, WindowRight, WindowBottom, 0)
| |
− | ol := WindowLeft
| |
− | ot := WindowTop
| |
− | nl := ((ScreenLeft + ScreenWidth) - ((WindowRight + 1) - WindowLeft) - ((j-1) * 30))
| |
− | nt := (ScreenTop + ((i-1) * 30))
| |
− |
| |
− | MouseClickDrag, Left, ol, ot, nl, nt, 9
| |
− |
| |
− | WindowLeft := nl + 10
| |
− | WindowTop := nt + 10
| |
− | WindowRight := nl + 10
| |
− | WindowBottom := nt + 10
| |
− |
| |
− | GetWindow(WindowLeft, WindowTop, WindowRight, WindowBottom)
| |
− | n := i*j
| |
− |
| |
− | Kettle := {}
| |
− | Kettle.l := WindowLeft
| |
− | Kettle.t := WindowTop
| |
− | Kettle.r := WindowRight
| |
− | Kettle.b := WindowBottom
| |
− | Kettles.Insert(Kettle)
| |
− |
| |
− | sleep 300
| |
− | }
| |
− | else
| |
− | MsgBox Pin Not Found
| |
− | }
| |
− |
| |
− | GetWindow(ByRef left, ByRef top, ByRef right, ByRef bottom, bShowPos=0)
| |
− | {
| |
− | origLeft := left
| |
− | origTop := top
| |
− | right := left
| |
− | bottom := top
| |
− |
| |
− | Loop
| |
− | {
| |
− | PixelGetColor, p, left, origTop, RGB
| |
− | if p = 0x946c46
| |
− | {
| |
− | break
| |
− | }
| |
− | left := left - 1
| |
− | }
| |
− |
| |
− | Loop
| |
− | {
| |
− | PixelGetColor, p, right, origTop, RGB
| |
− | if p = 0x946c46
| |
− | {
| |
− | break
| |
− | }
| |
− | right := right + 1
| |
− | }
| |
− |
| |
− | Loop
| |
− | {
| |
− | PixelGetColor, p, origLeft, top, RGB
| |
− | if p = 0x946c46
| |
− | {
| |
− | break
| |
− | }
| |
− | top := top - 1
| |
− | }
| |
− |
| |
− | Loop
| |
− | {
| |
− | PixelGetColor, p, origLeft, bottom, RGB
| |
− | if p = 0x946c46
| |
− | {
| |
− | break
| |
− | }
| |
− | bottom := bottom + 1
| |
− | }
| |
− |
| |
− | left := left - 2
| |
− | right := right + 2
| |
− | top := top - 2
| |
− | bottom := bottom + 2
| |
− | return
| |
− | }
| |
− |
| |
− | ^!p::
| |
− | Pause
| |
− | return
| |
− |
| |
− |
| |
− | </pre>
| |