The Wiki for Tale 4 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 "User:Cegaiel/Macros/PotteryWheel/Code"
From A Tale in the Desert
< User:Cegaiel | Macros | PotteryWheel
Jump to navigationJump to search(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
;The AHK icon in system tray will turn red while paused. | ;The AHK icon in system tray will turn red while paused. | ||
;Ctrl+R to reload script | ;Ctrl+R to reload script | ||
− | ;Date | + | ;Date 6/22/2010 |
+ | ;Author: Cegaiel | ||
+ | |||
+ | |||
+ | ;Last Update: 1/14/2012 | ||
+ | |||
− | |||
− | |||
− | |||
;Explanation of Seconds variable below: | ;Explanation of Seconds variable below: | ||
Line 22: | Line 24: | ||
;About 69s for 1 wheel | ;About 69s for 1 wheel | ||
− | ;About | + | ;About 49s for 36 wheels |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | Seconds = 67 | ||
Line 50: | Line 37: | ||
− | |||
− | |||
− | |||
Gui, +AlwaysOnTop +ToolWindow | Gui, +AlwaysOnTop +ToolWindow | ||
Gui, Font, bold | Gui, Font, bold | ||
Line 71: | Line 55: | ||
Gui, Add, Button, default gMineSetLoops, OK | Gui, Add, Button, default gMineSetLoops, OK | ||
− | Gui, Show | + | Gui, Show, x0 y25 |
MineNum = 0 | MineNum = 0 | ||
Line 113: | Line 97: | ||
Gui, +AlwaysOnTop +ToolWindow | Gui, +AlwaysOnTop +ToolWindow | ||
Gui, Font, bold | Gui, Font, bold | ||
− | Gui, Add, Text, vMineCycleText, | + | Gui, Add, Text, vMineCycleText, Starting in 2 seconds .................. |
Gui, Font, norm | Gui, Font, norm | ||
− | Gui, Show | + | Gui, Show, x0 y25 |
− | GuiControl, Text, MineCycleText, | + | GuiControl, Text, MineCycleText, Starting in 2 seconds ............. |
+ | |||
+ | Delay = 2 | ||
− | |||
− | |||
Loop, %Delay% | Loop, %Delay% | ||
{ | { | ||
− | GuiControl, Text, MineCycleText, %Delay%s | + | GuiControl, Text, MineCycleText, Starting in %Delay%s seconds ..... |
Delay -- | Delay -- | ||
Sleep 1000 | Sleep 1000 | ||
Line 137: | Line 121: | ||
− | + | MineNum = 1 | |
− | + | MouseGetPos, OldMX, OldMY | |
+ | |||
+ | |||
+ | ImageSearch, PopX, PopY, 458, 459, 667, 621, *50 OK.PNG | ||
+ | |||
+ | |||
+ | if ErrorLevel = 0 | ||
+ | { | ||
+ | Click, %PopX%, %PopY% | ||
+ | Sleep 1000 | ||
+ | } | ||
+ | |||
Line 152: | Line 147: | ||
;BlockInput, MouseMove | ;BlockInput, MouseMove | ||
− | GuiControl, Text, MineCycleText, Making Jugs - Wheel: %MineNum% | + | GuiControl, Text, MineCycleText, Making Jugs - Wheel: %MineNum%/%TotalRacks% |
MinePosX := MineX%MineNum% | MinePosX := MineX%MineNum% | ||
MinePosY := MineY%MineNum% | MinePosY := MineY%MineNum% | ||
MouseMove, %MinePosX%, %MinePosY%, 0 | MouseMove, %MinePosX%, %MinePosY%, 0 | ||
− | Sleep | + | Key = J |
− | Send { | + | Sleep 200 |
+ | Send {%Key%} | ||
+ | Sleep 300 | ||
Gosub, SearchPopupBox | Gosub, SearchPopupBox | ||
MineNum++ | MineNum++ | ||
Line 193: | Line 190: | ||
MinePosY := MineY%MineNum% | MinePosY := MineY%MineNum% | ||
MouseMove, %MinePosX%, %MinePosY%, 0 | MouseMove, %MinePosX%, %MinePosY%, 0 | ||
− | Sleep | + | Key = T |
− | Send { | + | Sleep 200 |
+ | Send {%Key%} | ||
+ | Sleep 300 | ||
Gosub, SearchPopupBox | Gosub, SearchPopupBox | ||
MineNum++ | MineNum++ | ||
Line 219: | Line 218: | ||
;This searches for a poup box which I occassionally would get (Pottery wheel busy) and closes it immediately. | ;This searches for a poup box which I occassionally would get (Pottery wheel busy) and closes it immediately. | ||
− | + | ImageSearch, PopX, PopY, 458, 459, 667, 621, *50 OK.PNG | |
− | |||
− | |||
− | Sleep | + | if ErrorLevel = 0 |
+ | { | ||
+ | NewX := PopX + 3 | ||
+ | NewY := PopY + 3 | ||
+ | ;BlockInput, MouseMove | ||
+ | Click %NewX%, %NewY% | ||
+ | Sleep 250 | ||
+ | ;BlockInput, MouseMoveOff | ||
+ | |||
+ | MineNum-- | ||
+ | MouseMove, %MinePosX%, %MinePosY%, 0 | ||
+ | Send {%Key%} | ||
+ | |||
+ | ;If popup is detected, then go back and keep checking until it is closed for sure, in case lag | ||
+ | |||
+ | interfered with it closing properly | ||
+ | |||
+ | Gosub, SearchPopupBox | ||
+ | ;Send %Key% ;Resend the key from Patternset sub, after closing popup box (sometimes doesn't | ||
+ | |||
+ | work as desired, commenting out... | ||
+ | } | ||
+ | |||
return | return | ||
+ | |||
+ | |||
+ | |||
+ | ^r::reload | ||
+ | ^p::Pause | ||
</pre> | </pre> |
Latest revision as of 04:28, 20 January 2012
;Ctrl+P to pause script and Ctrl+P again to resume ;The AHK icon in system tray will turn red while paused. ;Ctrl+R to reload script ;Date 6/22/2010 ;Author: Cegaiel ;Last Update: 1/14/2012 ;Explanation of Seconds variable below: ;If you find the jugs are getting done slightly late: ;(ie it begins making more jugs before they are done), then add 1 second at a time, below ;If you find the jugs are forming before the timer is done, ;(ie there is 1 or more seconds remaining on timer when jugs get done) then decrease 1 second at a time ;It takes about 33 seconds for the jugs to form, but the time it takes from when the first wheel is loaded ;until the time the last one is loaded is the reason that time varies ;About 69s for 1 wheel ;About 49s for 36 wheels Seconds = 67 IfWinExist eGenesis Client { WinActivate Gui, +AlwaysOnTop +ToolWindow Gui, Font, bold Gui, Add, Text, vMineNumText, Set Pottery Wheel locations Gui, Font, norm Gui, Add, Text,, ( LTrim Hover and middle-click (Click mouse-wheel) on each pottery wheel, one by one, until you've clicked on all the wheels you want to use. Then click the OK button. (Drag this box out of the way if any wheels are hidden) Make sure you chat is minimized and that your screen is locked (Alt+L) AFTER setting pottery wheel locations, Press OK... ) Gui, Add, Button, default gMineSetLoops, OK Gui, Show, x0 y25 MineNum = 0 WinGet, GameWinHandle, ID, eGenesis Client loop { WinActivate CoordMode, Mouse, Relative KeyWait, MButton, D KeyWait, MButton MouseGetPos, TestX, TestY, WinHandle if (WinHandle = GameWinHandle) { Gosub, MineRecord } else { Gui, Destroy break } } return MineRecord: MineNum++ MouseGetPos, MineX%MineNum%, MineY%MineNum% GuiControl, Text, MineNumText, %MineNum% pottery wheel captured TotalRacks := MineNum return MineSetLoops: Gui, Submit Gui, Destroy Gui, +AlwaysOnTop +ToolWindow Gui, Font, bold Gui, Add, Text, vMineCycleText, Starting in 2 seconds .................. Gui, Font, norm Gui, Show, x0 y25 GuiControl, Text, MineCycleText, Starting in 2 seconds ............. Delay = 2 Loop, %Delay% { GuiControl, Text, MineCycleText, Starting in %Delay%s seconds ..... Delay -- Sleep 1000 } SetDefaultMouseSpeed, 0 loop { MineNum = 1 MouseGetPos, OldMX, OldMY ImageSearch, PopX, PopY, 458, 459, 667, 621, *50 OK.PNG if ErrorLevel = 0 { Click, %PopX%, %PopY% Sleep 1000 } ;Make Jugs Loop loop, %TotalRacks% { WinActivate, eGenesis Client ;BlockInput, MouseMove GuiControl, Text, MineCycleText, Making Jugs - Wheel: %MineNum%/%TotalRacks% MinePosX := MineX%MineNum% MinePosY := MineY%MineNum% MouseMove, %MinePosX%, %MinePosY%, 0 Key = J Sleep 200 Send {%Key%} Sleep 300 Gosub, SearchPopupBox MineNum++ } MouseMove, %OldMX%, %OldMY%, 0 SecondsCountDown := Seconds loop, %Seconds% { GuiControl, Text, MineCycleText, Waiting %SecondsCountdown%s for Jugs to complete SecondsCountdown -- sleep 1000 } MineNum = 1 ;Take Jugs loop, %TotalRacks% { WinActivate, eGenesis Client GuiControl, Text, MineCycleText, Taking Jugs - Wheel: %MineNum% MinePosX := MineX%MineNum% MinePosY := MineY%MineNum% MouseMove, %MinePosX%, %MinePosY%, 0 Key = T Sleep 200 Send {%Key%} Sleep 300 Gosub, SearchPopupBox MineNum++ } GuiControl, Text, MineCycleText, 2s Pause, Hit Ctrl+P to STOP MAKING Sleep 2000 } Gui, Destroy Gui, Add, Text,, Middle-click on this window to end the script. Gui, Show return } SearchPopupBox: ;This searches for a poup box which I occassionally would get (Pottery wheel busy) and closes it immediately. ImageSearch, PopX, PopY, 458, 459, 667, 621, *50 OK.PNG if ErrorLevel = 0 { NewX := PopX + 3 NewY := PopY + 3 ;BlockInput, MouseMove Click %NewX%, %NewY% Sleep 250 ;BlockInput, MouseMoveOff MineNum-- MouseMove, %MinePosX%, %MinePosY%, 0 Send {%Key%} ;If popup is detected, then go back and keep checking until it is closed for sure, in case lag interfered with it closing properly Gosub, SearchPopupBox ;Send %Key% ;Resend the key from Patternset sub, after closing popup box (sometimes doesn't work as desired, commenting out... } return ^r::reload ^p::Pause