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/Glassbench/Code"
From A Tale in the Desert
< User:Cegaiel | Macros | Glassbench
Jump to navigationJump to search (New page: ; Glass Bench ; Date: 5/29/2010 ; Author: Cegaiel ; Ctrl+P (once to Pause, again to resume ; Ctrl+R to reload/reset script ; Note: The timer adds 6 seconds to your project (ie a 60s proj...) |
|||
Line 1: | Line 1: | ||
+ | <pre> | ||
; Glass Bench | ; Glass Bench | ||
; Date: 5/29/2010 | ; Date: 5/29/2010 | ||
Line 232: | Line 233: | ||
^r::reload | ^r::reload | ||
^p::Pause | ^p::Pause | ||
+ | </pre> |
Revision as of 07:56, 2 June 2010
; Glass Bench ; Date: 5/29/2010 ; Author: Cegaiel ; Ctrl+P (once to Pause, again to resume ; Ctrl+R to reload/reset script ; Note: The timer adds 6 seconds to your project (ie a 60s project will take 66s). ; This is to ensure teppy time and lag doesn't make it click too soon. ; If you want to adjust this extra 6 seconds, scroll down, half way down the script and look for: seconds := (seconds + 6) ; Change the + 6 to however many seconds you want to offset the default project timer. ; This is the location of the heat bar (the first bar). Use my GetMouse Position macro to determine the coordinates ; at your resolution if you are changing it. The below 106 and 138 is correct for 1024x768 resolution (pinned uppper left corner). ; You are only configuring the X position, the Y position is gathered while the script runs (it asks you to click the bar to get Y) ; Configuration: ======== curHeatMinX = 106 ; Around 1600-1650 curHeatMaxX = 138 ;Around 2200 degrees ; ======================= Gui, Add, Text,, Choose amount of seconds for your project: Gui, Add, Text,, ( LTrim 60s: Glass Rod 90s: Glass Pipe, Find Glass Pipe, Fine Glass Rod 120s: Glass Blade, Sheet Glass ) Gui, Add, DropDownList, vSeconds Choose1, 60|90|120 Gui, Add, Text,, How many? Gui, Add, Edit, vQty wp number Gui, Add, Button, gSubmit, Next Step Gui, Show return Submit: Gui, Submit if (Qty < 0) { Msgbox, You did not enter a Qty!`n`nTry again... RELOAD PAUSE } Gui, Destroy Gui, +AlwaysOnTop +ToolWindow Gui, Font, normal Gui, Add, Text, vRefresh, ( LTrim Now middle click (click mouse-wheel) a spot on pinup to refresh screen. (Hover over around where it says "This is a/your Glazier's Bench" ) Gui, Show WinGet, GameWinHandle, ID, eGenesis Client WinActivate, eGenesis Client loop { WinActivate, eGenesis Client CoordMode, Mouse, Relative KeyWait, MButton, D KeyWait, MButton MouseGetPos, TestX, TestY, WinHandle if (WinHandle = GameWinHandle) { Gosub, Record } else { Gui, Destroy break } } return ; MineNum1 = Refresh ; MineNum2 = Project Location ; MineNum3 = Temperature Bar Y Position Record: MineNum++ MouseGetPos, MineX%MineNum%, MineY%MineNum% if (MineNum = 1) { GuiControl, Text, Refresh, Step 2: Middle click Glass Project on Menu (ie Make a Glass Jar)`n`n`n return } else if (MineNum = 2) { GuiControl, Text, Refresh, Step 3: Click Y position of the Heat bar`n`nIt is the first bar (above Temperature: 0)`n`nClick anywhere in the bar... return } else { Gui, Destroy } Gui, +AlwaysOnTop +ToolWindow Gui, Add, Text, vMineNumText, Stand by, the macro will begin very shortly...`n`n`n`n`n`n`n Gui, Font, norm Gui, Show seconds := (seconds + 6) gseconds = 0 cseconds = 0 counter = 0 GuiControl, Text, MineNumText, Press F2 when the heat is at operating`ntemperature and has stopped spiking.`n`nThe macro will then take over.`n`nIdea range to hit F2 is 1800-2000. KeyWait, F2, D SetDefaultMouseSpeed, 0 #Persistent SetTimer, MakeGlass, %gseconds% Loop { WinActivate, eGenesis Client ;curHeatMin := FindRed(curHeatMinX, MineY3) curHeatMax := FindRed(curHeatMaxX, MineY3) if (curHeatMax = 1) { MouseGetPos, OldMX, OldMY ImageSearch, OutputX, OutputY, 9, 42, 283, 299, *50 add2cc.PNG OutputX := OutputX +50 OutputY := OutputY + 2 Click, %OutputX%, %OutputY% ;Add 2 cc MouseMove, %OldMX%, %OldMY%, 0 cseconds = 100 Sleep 98000 } else if (curHeatMax = 0) { GuiControl, Text, MineNumText, %gseconds%s remaining for next project`n%cseconds%s until next 2cc add.`n`nMaking %counter% of %qty% glass projects`n`nHeat too high, cooling down! } } FindRed(TX, TY) { PixelSearch, PX, PY, TX, TY, TX+1, TY+1, 0x830605, 55, Fast|RGB return ErrorLevel } MakeGlass: if (gseconds = 0) { WinActivate, eGenesis Client curHeatMin := FindRed(curHeatMinX, MineY3) curHeatMax := FindRed(curHeatMaxX, MineY3) } ;if (gseconds = 0) and (curHeatMin = 0) and (curHeatMax = 1) if (gseconds = 0) and (curHeatMin = 1) and (curHeatMax = 1) { WinActivate, eGenesis Client MouseGetPos, OldMX, OldMY Click, %MineX1%, %MineY1% ;Refresh Sleep 100 Click %MineX2%, %MineY2% ;Make glass project gseconds := seconds MouseMove, %OldMX%, %OldMY%, 0 if (counter = qty) and (cseconds = 0) { Msgbox, All done!`n`nExiting script... EXIT } else { counter ++ } } gseconds -- ;glass timer cseconds -- ;cc timer if (cseconds < 0) cseconds = 0 if (gseconds < 0) gseconds = 0 if (curHeatMin = 0) and (curHeatMax = 1) { GuiControl, Text, MineNumText, %gseconds%s remaining for next project`n%cseconds%s until next 2cc add.`n`nMaking %counter% of %qty% glass projects } else if (curHeatMin = 1) { GuiControl, Text, MineNumText, %gseconds%s remaining for next project`n%cseconds%s until next 2cc add.`n`nMaking %counter% of %qty% glass projects`n`nHeat too low, standby while the temp increases. } sleep 1000 return ^r::reload ^p::Pause