The Wiki for Tale 5 is in read-only mode and is available for archival and reference purposes only. Please visit the current Tale 11 Wiki in the meantime.
If you have any issues with this Wiki, please post in #wiki-editing on Discord or contact Brad in-game.
Difference between revisions of "Takhetu/Code"
From ATITD5
Jump to navigationJump to searchLine 1: | Line 1: | ||
<pre> | <pre> | ||
− | + | IfWinExist eGenesis Client | |
− | + | { | |
− | + | WinGet, GameWinHandle, ID, eGenesis Client | |
− | + | } else { | |
− | + | Msgbox, eGenesis client not running, exiting... | |
− | + | Exit | |
− | return | + | } |
− | + | ;~ Info | |
+ | ;~ Ask for config | ||
+ | WinActivate, eGenesis Client | ||
+ | WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos | ||
+ | StartXGUI := Xmax+win_Xpos-255 | ||
+ | StartYGUI := win_Ypos+35 | ||
+ | Gui, +AlwaysOnTop +ToolWindow -Border +Background | ||
+ | Gui, Add, Text,,Type in how many rows and columns `nof pottery wheels you `nwill be working with: | ||
+ | Gui, Add, Text, x10 y55, Rows: | ||
+ | Gui, Add, Edit,xp+35 yp-4 vnumRows, 5 | ||
+ | Gui, Add, Text,xp+20 y55, Columns: | ||
+ | Gui, Add, Edit,xp+45 yp-4 vnumColumns, 5 | ||
+ | Gui, Add, Button, x10 y70 gNext, Next » | ||
+ | Gui, Add, Button, x200 y5 gClose, Close | ||
+ | Gui, Show, X%StartXGUI% Y%StartYGUI% w240 h100, New GUI Window | ||
+ | Return | ||
+ | |||
+ | Next: | ||
+ | Gui, submit | ||
+ | Gui, Destroy | ||
+ | ;Get Top Left | ||
+ | Gui, +AlwaysOnTop +ToolWindow -Border +Background | ||
+ | Gui, Add, Text,,Using F8F8 camera view make `nsure you can see all kettles. | ||
+ | Gui, Add, Text,,Make sure the wheels have no `njugs when you start. | ||
+ | Gui, Add, Text,,Position your mouse over `nthe topleft wheel and press the F2 key. | ||
+ | Gui, Add, Button, x200 y5 gClose, Close | ||
+ | Gui, Show, X%StartXGUI% Y%StartYGUI% w240 h120, New GUI Window | ||
+ | loop | ||
+ | { | ||
+ | WinActivate eGenesis Client | ||
+ | KeyWait, F2, D | ||
+ | KeyWait, F2 | ||
+ | MouseGetPos, FirstX, FirstY, WinHandle | ||
+ | if (WinHandle = GameWinHandle) | ||
+ | { | ||
+ | Gosub, GotTopLeft | ||
+ | } | ||
+ | } | ||
+ | return | ||
− | + | GotTopLeft: | |
− | + | Gui, Destroy | |
+ | ;Get Bottom Right | ||
+ | Gui, +AlwaysOnTop +ToolWindow -Border +Background | ||
+ | Gui, Add, Text,,Position your mouse over `nthe bottom right wheel `nand press the F2 key. | ||
+ | Gui, Add, Button, x200 y5 gClose, Close | ||
+ | Gui, Show, X%StartXGUI% Y%StartYGUI% w240 h100, New GUI Window | ||
+ | |||
+ | loop | ||
{ | { | ||
− | + | WinActivate eGenesis Client | |
− | + | KeyWait, F2, D | |
− | + | KeyWait, F2 | |
− | + | MouseGetPos, LastX, LastY, WinHandle | |
− | + | if (WinHandle = GameWinHandle) | |
{ | { | ||
− | + | Gosub, GotBottomRight | |
− | + | } | |
− | + | } | |
− | Loop, % | + | return |
+ | |||
+ | GotBottomRight: | ||
+ | Gui, Destroy | ||
+ | ;~ Open Windows | ||
+ | ;~ Hands off | ||
+ | Gui, +AlwaysOnTop +ToolWindow -Border +Background | ||
+ | Gui, Add, Text,vTimeLeft,Leave your mouse alone, `nstarting jugs in 5 seconds. | ||
+ | Gui, Add, Button, x200 y5 gClose, Close | ||
+ | Gui, Show, X%StartXGUI% Y%StartYGUI% w240 h100, New GUI Window | ||
+ | SmallPause := 5 | ||
+ | Loop, %SmallPause% | ||
+ | { | ||
+ | GuiControl, Text, TimeLeft, Leave your mouse alone, `nstarting jugs in %SmallPause% seconds. | ||
+ | SmallPause -- | ||
+ | Sleep 1000 | ||
+ | } | ||
+ | GuiControl, Text, TimeLeft, Making Jugs. | ||
+ | WinActivate eGenesis Client | ||
+ | |||
+ | ;~ loop through wheels to make jugs | ||
+ | topNotFound := true | ||
+ | Loop, | ||
+ | { | ||
+ | Loop, %numColumns% | ||
+ | { | ||
+ | curColumn := A_Index | ||
+ | openPosX := FirstX+(A_Index-1)*floor((LastX-FirstX)/(numColumns-1)) | ||
+ | Loop, %numRows% | ||
+ | { | ||
+ | openPosY := FirstY+(A_Index-1)*floor((LastY-FirstY)/(numRows-1)) | ||
+ | MouseClick,Left,openPosX,openPosY | ||
+ | sleep, 100 | ||
+ | MouseClick,Left,openPosX+10,openPosY-3 | ||
+ | } | ||
+ | } | ||
+ | ;Wait Until Wheel Stops | ||
+ | checksum := getPicChecksum(FirstX,FirstY) | ||
+ | Loop, | ||
+ | { | ||
+ | curCheck := getPicChecksum(FirstX,FirstX) | ||
+ | if (checksum<>curCheck) | ||
+ | { | ||
+ | checksum := curCheck | ||
+ | } else { | ||
+ | Break | ||
+ | } | ||
+ | sleep, 100 | ||
+ | } | ||
+ | sleep, 100 | ||
+ | } | ||
+ | |||
+ | getPicChecksum(x,y) | ||
+ | { | ||
+ | Check := 0 | ||
+ | Loop, 5 | ||
+ | { | ||
+ | xinc := A_Index | ||
+ | Loop, 5 | ||
{ | { | ||
− | + | PixelGetColor, p1,% x+(4*xinc)-10,% y+(4*A_Index)-10 | |
− | + | Check := Check+p1 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
} | } | ||
+ | return, %Check% | ||
} | } | ||
+ | |||
+ | Close: | ||
+ | ExitApp | ||
+ | |||
+ | ^r::reload | ||
+ | ^p::Pause | ||
</pre> | </pre> |
Revision as of 02:33, 29 October 2010
IfWinExist eGenesis Client { WinGet, GameWinHandle, ID, eGenesis Client } else { Msgbox, eGenesis client not running, exiting... Exit } ;~ Info ;~ Ask for config WinActivate, eGenesis Client WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos StartXGUI := Xmax+win_Xpos-255 StartYGUI := win_Ypos+35 Gui, +AlwaysOnTop +ToolWindow -Border +Background Gui, Add, Text,,Type in how many rows and columns `nof pottery wheels you `nwill be working with: Gui, Add, Text, x10 y55, Rows: Gui, Add, Edit,xp+35 yp-4 vnumRows, 5 Gui, Add, Text,xp+20 y55, Columns: Gui, Add, Edit,xp+45 yp-4 vnumColumns, 5 Gui, Add, Button, x10 y70 gNext, Next » Gui, Add, Button, x200 y5 gClose, Close Gui, Show, X%StartXGUI% Y%StartYGUI% w240 h100, New GUI Window Return Next: Gui, submit Gui, Destroy ;Get Top Left Gui, +AlwaysOnTop +ToolWindow -Border +Background Gui, Add, Text,,Using F8F8 camera view make `nsure you can see all kettles. Gui, Add, Text,,Make sure the wheels have no `njugs when you start. Gui, Add, Text,,Position your mouse over `nthe topleft wheel and press the F2 key. Gui, Add, Button, x200 y5 gClose, Close Gui, Show, X%StartXGUI% Y%StartYGUI% w240 h120, New GUI Window loop { WinActivate eGenesis Client KeyWait, F2, D KeyWait, F2 MouseGetPos, FirstX, FirstY, WinHandle if (WinHandle = GameWinHandle) { Gosub, GotTopLeft } } return GotTopLeft: Gui, Destroy ;Get Bottom Right Gui, +AlwaysOnTop +ToolWindow -Border +Background Gui, Add, Text,,Position your mouse over `nthe bottom right wheel `nand press the F2 key. Gui, Add, Button, x200 y5 gClose, Close Gui, Show, X%StartXGUI% Y%StartYGUI% w240 h100, New GUI Window loop { WinActivate eGenesis Client KeyWait, F2, D KeyWait, F2 MouseGetPos, LastX, LastY, WinHandle if (WinHandle = GameWinHandle) { Gosub, GotBottomRight } } return GotBottomRight: Gui, Destroy ;~ Open Windows ;~ Hands off Gui, +AlwaysOnTop +ToolWindow -Border +Background Gui, Add, Text,vTimeLeft,Leave your mouse alone, `nstarting jugs in 5 seconds. Gui, Add, Button, x200 y5 gClose, Close Gui, Show, X%StartXGUI% Y%StartYGUI% w240 h100, New GUI Window SmallPause := 5 Loop, %SmallPause% { GuiControl, Text, TimeLeft, Leave your mouse alone, `nstarting jugs in %SmallPause% seconds. SmallPause -- Sleep 1000 } GuiControl, Text, TimeLeft, Making Jugs. WinActivate eGenesis Client ;~ loop through wheels to make jugs topNotFound := true Loop, { Loop, %numColumns% { curColumn := A_Index openPosX := FirstX+(A_Index-1)*floor((LastX-FirstX)/(numColumns-1)) Loop, %numRows% { openPosY := FirstY+(A_Index-1)*floor((LastY-FirstY)/(numRows-1)) MouseClick,Left,openPosX,openPosY sleep, 100 MouseClick,Left,openPosX+10,openPosY-3 } } ;Wait Until Wheel Stops checksum := getPicChecksum(FirstX,FirstY) Loop, { curCheck := getPicChecksum(FirstX,FirstX) if (checksum<>curCheck) { checksum := curCheck } else { Break } sleep, 100 } sleep, 100 } getPicChecksum(x,y) { Check := 0 Loop, 5 { xinc := A_Index Loop, 5 { PixelGetColor, p1,% x+(4*xinc)-10,% y+(4*A_Index)-10 Check := Check+p1 } } return, %Check% } Close: ExitApp ^r::reload ^p::Pause