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 search
Line 1: Line 1:
 
<pre>
 
<pre>
IfWinExist eGenesis Client
+
;Ctrl+R to reload
{
+
;Ctrl+P to pause
WinGet, GameWinHandle, ID, eGenesis Client
+
 
} else {
 
Msgbox, eGenesis client not running, exiting...
 
Exit
 
}
 
 
;~ Info
 
;~ Info
;~ Ask for config
 
 
WinActivate, eGenesis Client
 
WinActivate, eGenesis Client
 
WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos
 
WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos
Line 14: Line 9:
 
StartYGUI := win_Ypos+35
 
StartYGUI := win_Ypos+35
 
Gui, +AlwaysOnTop +ToolWindow -Border +Background  
 
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 y10,Crematory Macro Running
Gui, Add, Text, x10 y55, Rows:
+
Gui, Add, Text,x10 y25,CTRL+R - Restart macro
Gui, Add, Edit,xp+35 yp-4 vnumRows, 5
+
Gui, Add, Text,x10 y40,CTRL+P - Pause macro
Gui, Add, Text,xp+20 y55, Columns:
+
Gui, Add, Text,x10 y55 vMyText,CTRL+A - Turn ON Auto mode
Gui, Add, Edit,xp+45 yp-4 vnumColumns, 5
+
Gui, Add, Text,x10 y75,Keep the crematory window away from popups.
Gui, Add, Button, x10 y70 gNext, Next »
 
 
Gui, Add, Button, x200 y5 gClose, Close  
 
Gui, Add, Button, x200 y5 gClose, Close  
 
Gui, Show, X%StartXGUI% Y%StartYGUI% w240 h100, New GUI Window
 
Gui, Show, X%StartXGUI% Y%StartYGUI% w240 h100, New GUI Window
Return
 
  
Next:
+
gosub, Setup
Gui, submit
+
 
Gui, Destroy
+
WinActivate, eGenesis Client
;Get Top Left
+
lastTimeSlidersMoved := A_Now
Gui, +AlwaysOnTop +ToolWindow -Border +Background
+
autoMode := false
Gui, Add, Text,,Using F8F8 camera view make `nsure you can see all kettles.
+
Loop
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
+
If (autoMode=true)
KeyWait, F2, D
 
KeyWait, F2
 
MouseGetPos, FirstX, FirstY, WinHandle
 
if (WinHandle = GameWinHandle)
 
 
{
 
{
Gosub, GotTopLeft
+
;~ check if completed
}
+
ImageSearch, BarX,BarY,ProgressSX,ProgressSY,ProgressEX,ProgressEY,*40 BitRed.png
 +
if ErrorLevel=1
 +
{
 +
;~ Knobs not moving - Finished
 +
gosub, unload
 +
gosub, load
 +
} else {
 +
currentTime := A_Now
 +
tempLast := LastTimeSlidersMoved
 +
EnvSub, tempLast,,Seconds
 +
If (tempLast<-300)
 +
{
 +
gosub, unload
 +
gosub, load
 +
}
 +
}
 +
}
 +
;~ Check to make sure the window wasn't moved
 +
WindowMoved := false
 +
ImageSearch, NewLimeX,NewLimeY,0,0,Xmax,Ymax,*40 Lime.png
 +
If ErrorLevel<1
 +
{
 +
If (NewLimeX<>LimeX)
 +
{
 +
WindowMoved := true
 +
} else {
 +
If (NewLimeY<>LimeY)
 +
{
 +
WindowMoved := True
 +
}
 +
}
 +
If WindowMoved=True
 +
{
 +
gosub, Setup
 +
}
 +
} else {
 +
gosub, Setup
 +
}
 +
 +
 +
ImageSearch, KnobX,KnobY1,SliderSearchSX1,SliderSearchSY,SliderSearchEX1,SliderSearchEY,*40 SliderKnob.png
 +
ImageSearch, KnobX,KnobY2,SliderSearchSX2,SliderSearchSY,SliderSearchEX2,SliderSearchEY,*40 SliderKnob.png
 +
ImageSearch, KnobX,KnobY3,SliderSearchSX3,SliderSearchSY,SliderSearchEX3,SliderSearchEY,*40 SliderKnob.png
 +
ImageSearch, KnobX,KnobY4,SliderSearchSX4,SliderSearchSY,SliderSearchEX4,SliderSearchEY,*40 SliderKnob.png
 +
ImageSearch, KnobX,KnobY5,SliderSearchSX5,SliderSearchSY,SliderSearchEX5,SliderSearchEY,*40 SliderKnob.png
 +
ImageSearch, KnobX,KnobY6,SliderSearchSX6,SliderSearchSY,SliderSearchEX6,SliderSearchEY,*40 SliderKnob.png
 +
ImageSearch, KnobX,KnobY7,SliderSearchSX7,SliderSearchSY,SliderSearchEX7,SliderSearchEY,*40 SliderKnob.png
 +
Knob1 := SliderM-KnobY1-1
 +
Knob2 := SliderM-KnobY2-1
 +
Knob3 := SliderM-KnobY3-1
 +
Knob4 := SliderM-KnobY4-1
 +
Knob5 := SliderM-KnobY5-1
 +
Knob6 := SliderM-KnobY6-1
 +
Knob7 := SliderM-KnobY7-1
 +
 
 +
NoKnobsMoved := True
 +
;~ Reverse Direction Sliders
 +
If (Knob3<>oldKnob3) ;knob moved
 +
{
 +
NoKnobsMoved := False
 +
If (Knob3>oldKnob3) ;knob rose
 +
{
 +
If (Knob3>Knob7) ;Knob3 is above knob7, knobs are spreading out
 +
{
 +
MouseClick,Left,ButtonX2,ButtonY
 +
}
 +
} else {
 +
If (Knob3<Knob7) ;Knob3 is bellow knob7, knobs are spreading out
 +
{
 +
MouseClick,Left,ButtonX2,ButtonY
 +
}
 +
}
 +
oldKnob3 := Knob3
 +
oldKnob7 := Knob7
 +
}
 +
 
 +
;~ Reverse Direction Sliders
 +
If (Knob5<>oldKnob5) ;knob moved
 +
{
 +
NoKnobsMoved := False
 +
If (Knob5>oldKnob5) ;knob rose
 +
{
 +
If (Knob5>Knob6) ;Knob5 is above Knob6, knobs are spreading out
 +
{
 +
MouseClick,Left,ButtonX5,ButtonY
 +
}
 +
} else {
 +
If (Knob5<Knob6) ;Knob5 is bellow Knob6, knobs are spreading out
 +
{
 +
MouseClick,Left,ButtonX5,ButtonY
 +
}
 +
}
 +
oldKnob5 := Knob5
 +
oldKnob6 := Knob6
 +
}
 +
 
 +
 
 +
 
 +
;~ ********************
 +
;~ COMMENTED SECTION, USE THIS FOR DOUBLE SLIDERS THAT TRAVEL IN THE SAME DIRECTION
 +
;~ ********************
 +
;~ Same Direction Sliders
 +
;~ If (Knob4<>oldKnob4) ;knob moved
 +
;~ {
 +
;~ NoKnobsMoved := False
 +
;~ averagePos := floor((Knob4+Knob6)/2)
 +
;~ If (Knob4>oldKnob4) ;knobs are going up
 +
;~ {
 +
;~ If averagePos>0 ;averageposition is above center
 +
;~ {
 +
;~ MouseClick,Left,ButtonX4,ButtonY
 +
;~ }
 +
;~ } else { ;knobs are going down
 +
;~ If averagePos<0 ;averageposition is bellow center
 +
;~ {
 +
;~ MouseClick,Left,ButtonX4,ButtonY
 +
;~ }
 +
;~ }
 +
;~ oldKnob4 := Knob4
 +
;~ oldKnob6 := Knob6
 +
;~ }
 +
 
 +
 
 +
 
 +
NumAbove := 0
 +
NumBellow := 0
 +
If Knob3<0
 +
{
 +
NumBellow++
 +
} Else {
 +
NumAbove++
 +
}
 +
If Knob7<0
 +
{
 +
NumBellow++
 +
} Else {
 +
NumAbove++
 +
}
 +
If Knob5<0
 +
{
 +
NumBellow++
 +
} Else {
 +
NumAbove++
 +
}
 +
If Knob6<0
 +
{
 +
NumBellow++
 +
} Else {
 +
NumAbove++
 +
}
 +
 
 +
Axis4 := 0
 +
Axis2 := 0
 +
If NumAbove=1
 +
{
 +
Axis4 := 5
 +
} else {
 +
If NumAbove=0
 +
{
 +
Axis4 := 5
 +
Axis2 := 5
 +
} else {
 +
If NumBellow=1
 +
{
 +
Axis4 := -5
 +
} else {
 +
If NumBellow=0
 +
{
 +
Axis4 := -5
 +
Axis2 := -5
 +
}
 +
}
 +
}
 +
}
 +
 +
 
 +
 
 +
;~ First Single Slider
 +
If (Knob4>oldKnob4) ;knob Rose
 +
{
 +
NoKnobsMoved := False
 +
oldKnob4 := Knob4
 +
If (Knob4>Axis4) ;knob Over Line
 +
{
 +
MouseClick,Left,ButtonX1,ButtonY
 +
}
 +
} else {
 +
If (Knob4<oldKnob4) ;knob Fell
 +
{
 +
NoKnobsMoved := False
 +
oldKnob4 := Knob4
 +
If (Knob4<Axis4) ;knob Bellow Line
 +
{
 +
MouseClick,Left,ButtonX1,ButtonY
 +
}
 +
}
 +
}
 +
 
 +
;~ Second Single Slider
 +
If (Knob2>oldKnob2) ;knob Rose
 +
{
 +
NoKnobsMoved := False
 +
oldKnob2 := Knob2
 +
If Knob2>0 ;knob Over Line
 +
{
 +
MouseClick,Left,ButtonX3,ButtonY
 +
}
 +
} else {
 +
If (Knob2<oldKnob2) ;knob Fell
 +
{
 +
NoKnobsMoved := False
 +
oldKnob2 := Knob2
 +
If Knob2<0 ;knob Bellow Line
 +
{
 +
MouseClick,Left,ButtonX3,ButtonY
 +
}
 +
}
 +
}
 +
 
 +
;~ Third Single Slider
 +
If (Knob1>oldKnob1) ;knob Rose
 +
{
 +
NoKnobsMoved := False
 +
oldKnob1 := Knob1
 +
If Knob1>0 ;knob Over Line
 +
{
 +
MouseClick,Left,ButtonX4,ButtonY
 +
}
 +
} else {
 +
If (Knob1<oldKnob1) ;knob Fell
 +
{
 +
NoKnobsMoved := False
 +
oldKnob1 := Knob1
 +
If Knob1 < 0 ;knob Bellow Line
 +
{
 +
MouseClick,Left,ButtonX4,ButtonY
 +
}
 +
}
 +
}
 +
 
 +
 
 +
 +
}
 +
 
 +
Setup:
 +
IfWinExist eGenesis Client
 +
{
 +
WinGet, GameWinHandle, ID, eGenesis Client
 +
} else {
 +
Msgbox, eGenesis client not running, exiting...
 +
Exit
 
}
 
}
return
 
  
GotTopLeft:
+
;~ Base
Gui, Destroy
+
OriX := 625
;Get Bottom Right
+
OriY := 342
Gui, +AlwaysOnTop +ToolWindow -Border +Background
+
 
Gui, Add, Text,,Position your mouse over `nthe bottom right wheel `nand press the F2 key.
+
;~ Offsets
Gui, Add, Button, x200 y5 gClose, Close
+
offRedLineStartX := OriX-625
Gui, Show, X%StartXGUI% Y%StartYGUI% w240 h100, New GUI Window
+
offRedLineStartY := OriY-333
 +
offSliderT := OriY-364
 +
offSliderM := OriY-424
 +
offSliderB := OriY-483
 +
offSliderX1 := OriX-618
 +
offSliderX2 := OriX-654
 +
offSliderX3 := OriX-690
 +
offSliderX4 := OriX-726
 +
offSliderX5 := OriX-762
 +
offSliderX6 := OriX-798
 +
offSliderX7 := OriX-834
 +
offButtonY := OriY-503
 +
offButtonX1 := OriX-647
 +
offButtonX2 := OriX-688
 +
offButtonX3 := OriX-729
 +
offButtonX4 := OriX-769
 +
offButtonX5 := OriX-809
 +
 
  
loop
+
;~ Locate Word Lime
 +
WinActivate eGenesis Client
 +
ImageSearch, LimeX,LimeY,0,0,Xmax,Ymax,*40 Lime.png
 +
If ErrorLevel=2
 
{
 
{
WinActivate eGenesis Client
+
MsgBox,,,Couldn't Find Lime.png
KeyWait, F2, D
+
}
KeyWait, F2
+
If ErrorLevel<1
MouseGetPos, LastX, LastY, WinHandle
+
{
if (WinHandle = GameWinHandle)
+
GuiControl, Text, Label, Found Crematory Window
 +
} else {
 +
If ErrorLevel<2
 
{
 
{
Gosub, GotBottomRight
+
;Didn't find the Word Lime
 +
MsgBox,,Crematory Macro,Crematory Window not Found, closing macro
 +
ExitApp
 
}
 
}
 
}
 
}
 +
 +
RedLineStartX := LimeX-offRedLineStartX
 +
RedLineStartY := LimeY-offRedLineStartY
 +
SliderX1 := LimeX-offSliderX1
 +
SliderX2 := LimeX-offSliderX2
 +
SliderX3 := LimeX-offSliderX3
 +
SliderX4 := LimeX-offSliderX4
 +
SliderX5 := LimeX-offSliderX5
 +
SliderX6 := LimeX-offSliderX6
 +
SliderX7 := LimeX-offSliderX7
 +
SliderT := LimeY-offSliderT
 +
SliderM := LimeY-offSliderM
 +
SliderB := LimeY-offSliderB
 +
ButtonY := LimeY-offButtonY
 +
ButtonX1 := LimeX-offButtonX1
 +
ButtonX2 := LimeX-offButtonX2
 +
ButtonX3 := LimeX-offButtonX3
 +
ButtonX4 := LimeX-offButtonX4
 +
ButtonX5 := LimeX-offButtonX5
 +
ProgressSX := LimeX-2
 +
ProgressSY := LimeY-12
 +
ProgressEX := LimeX+3
 +
ProgressEY := LimeY+5
 +
SliderSearchSX1 := SliderX1-2
 +
SliderSearchSX2 := SliderX2-2
 +
SliderSearchSX3 := SliderX3-2
 +
SliderSearchSX4 := SliderX4-2
 +
SliderSearchSX5 := SliderX5-2
 +
SliderSearchSX6 := SliderX6-2
 +
SliderSearchSX7 := SliderX7-2
 +
SliderSearchEX1 := SliderX1+7
 +
SliderSearchEX2 := SliderX2+7
 +
SliderSearchEX3 := SliderX3+7
 +
SliderSearchEX4 := SliderX4+7
 +
SliderSearchEX5 := SliderX5+7
 +
SliderSearchEX6 := SliderX6+7
 +
SliderSearchEX7 := SliderX7+7
 +
SliderSearchSY := SliderT-10
 +
SliderSearchEY := SliderB+10
 +
oldKnob1 := 100
 +
oldKnob2 := 100
 +
oldKnob3 := 100
 +
oldKnob4 := 100
 +
oldKnob5 := 100
 +
oldKnob6 := 100
 +
oldKnob7 := 100
 
return
 
return
  
GotBottomRight:
+
Unload: ;Unload
Gui, Destroy
+
;~ Knobs not moving - Finished
;~ Open Windows
+
;~ Refresh
;~ Hands off
+
MouseClick,Left,LimeX,LimeY
Gui, +AlwaysOnTop +ToolWindow -Border +Background
+
sleep, 100
Gui, Add, Text,vTimeLeft,Leave your mouse alone, `nstarting jugs in 5 seconds.
+
;~ Find Take
Gui, Add, Button, x200 y5 gClose, Close
+
ImageSearch,LoadX,LoadY,LimeX-29,LimeY-136,LimeX+49,LimeY-40,*40 Take.png
Gui, Show, X%StartXGUI% Y%StartYGUI% w240 h100, New GUI Window
+
If ErrorLevel<1
SmallPause := 5
 
Loop, %SmallPause%
 
 
{
 
{
GuiControl, Text, TimeLeft, Leave your mouse alone, `nstarting jugs in %SmallPause% seconds.
+
MouseClick,Left,LoadX,LoadY
SmallPause --
+
sleep,300
Sleep 1000
+
ImageSearch,EveX,EveY,LoadX,LoadY-50,LoadX+133,LoadY+50,*90 Everything.png
 +
If ErrorLevel<1
 +
{
 +
MouseClick,Left,EveX,EveY
 +
sleep, 300
 +
}
 
}
 
}
GuiControl, Text, TimeLeft, Making Jugs.
+
return
WinActivate eGenesis Client
+
 
  
;~ loop through wheels to make jugs
+
Load:
topNotFound := true
+
;~ Knobs not moving - Finished
Loop,  
+
;~ Refresh
{
+
MouseClick,Left,LimeX,LimeY
Loop, %numColumns%
+
sleep, 100
 +
;~ Find Load
 +
ImageSearch,LoadX,LoadY,LimeX-29,LimeY-136,LimeX+49,LimeY-40,*40 Load.png
 +
If ErrorLevel<1
 
{
 
{
curColumn := A_Index
+
;load Limestone
openPosX := FirstX+(A_Index-1)*floor((LastX-FirstX)/(numColumns-1))
+
sleep,100
Loop, %numRows%
+
MouseClick,Left,LoadX,LoadY
{
+
sleep,100
openPosY := FirstY+(A_Index-1)*floor((LastY-FirstY)/(numRows-1))
+
MouseClick,Left,LoadX+14,LoadY-33
MouseClick,Left,openPosX,openPosY
+
sleep,200
sleep, 100
+
MouseClick,Left,floor(Xmax/2),floor(Ymax/2)+44
MouseClick,Left,openPosX+10,openPosY-3
+
sleep,200
}
+
;load Leeks
}
+
sleep,100
;Wait Until Wheel Stops
+
MouseClick,Left,LoadX,LoadY
checksum := getPicChecksum(FirstX,FirstY)
+
sleep,100
Loop,
+
MouseClick,Left,LoadX+14,LoadY-17
{
+
sleep,200
curCheck := getPicChecksum(FirstX,FirstX)
+
MouseClick,Left,floor(Xmax/2),floor(Ymax/2)+44
if (checksum<>curCheck)
+
sleep,200
{
+
;load Flax
checksum := curCheck
+
sleep,100
} else {
+
MouseClick,Left,LoadX,LoadY
Break
+
sleep,100
}
+
MouseClick,Left,LoadX+14,LoadY
 +
sleep,200
 +
MouseClick,Left,floor(Xmax/2),floor(Ymax/2)+44
 +
sleep,200
 +
;load Papyrus
 +
sleep,100
 +
MouseClick,Left,LoadX,LoadY
 +
sleep,100
 +
MouseClick,Left,LoadX+14,LoadY+17
 +
sleep,200
 +
MouseClick,Left,floor(Xmax/2),floor(Ymax/2)+44
 +
sleep,200
 +
;load Wood
 +
sleep,100
 +
MouseClick,Left,LoadX,LoadY
 +
sleep,100
 +
MouseClick,Left,LoadX+14,LoadY+33
 +
sleep,200
 +
MouseClick,Left,floor(Xmax/2),floor(Ymax/2)+44
 +
sleep,200
 +
;Fire
 +
MouseClick,Left,LoadX,LoadY-17
 
sleep, 100
 
sleep, 100
 
}
 
}
sleep, 100
+
return
}
+
 
 +
Close:
 +
ExitApp
  
getPicChecksum(x,y)
+
^a:: ;automode
 +
if (autoMode=True)
 
{
 
{
Check := 0
+
autoMode := False
Loop, 5
+
GuiControl,,myText,CTRL+A - Auto Mode is OFF
{
+
} else {
xinc := A_Index
+
autoMode := True
Loop, 5
+
GuiControl,,myText,CTRL+A - Auto Mode is ON
{
 
PixelGetColor, p1,% x+(4*xinc)-10,% y+(4*A_Index)-10
 
Check := Check+p1
 
}
 
}
 
return, %Check%
 
 
}
 
}
 +
return
  
Close:
+
^p::pause
ExitApp
 
 
 
 
^r::reload
 
^r::reload
^p::Pause
 
  
 
</pre>
 
</pre>

Revision as of 03:50, 31 October 2010

;Ctrl+R to reload
;Ctrl+P to pause

;~ Info
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,x10 y10,Crematory Macro Running
Gui, Add, Text,x10 y25,CTRL+R - Restart macro
Gui, Add, Text,x10 y40,CTRL+P - Pause macro
Gui, Add, Text,x10 y55 vMyText,CTRL+A - Turn ON Auto mode
Gui, Add, Text,x10 y75,Keep the crematory window away from popups.
Gui, Add, Button, x200 y5 gClose, Close 
Gui, Show, X%StartXGUI% Y%StartYGUI% w240 h100, New GUI Window

gosub, Setup

WinActivate, eGenesis Client
lastTimeSlidersMoved := A_Now 
autoMode := false
Loop
{
	If (autoMode=true)
	{
;~ 		check if completed
		ImageSearch, BarX,BarY,ProgressSX,ProgressSY,ProgressEX,ProgressEY,*40 BitRed.png
		if ErrorLevel=1
		{
			;~ 	Knobs not moving - Finished
			gosub, unload
			gosub, load
		} else {
			currentTime := A_Now
			tempLast := LastTimeSlidersMoved
			EnvSub, tempLast,,Seconds 
			If (tempLast<-300)
			{
				gosub, unload
				gosub, load
			}
		}
	} 
	;~ 	Check to make sure the window wasn't moved
		WindowMoved := false 
		ImageSearch, NewLimeX,NewLimeY,0,0,Xmax,Ymax,*40 Lime.png
		If ErrorLevel<1
		{
			If (NewLimeX<>LimeX)
			{
				WindowMoved := true
			} else {
				If (NewLimeY<>LimeY)
				{
					WindowMoved := True
				}	
			}
			If WindowMoved=True
			{
				gosub, Setup
			}
		} else {
			gosub, Setup
		}	
		
			
		ImageSearch, KnobX,KnobY1,SliderSearchSX1,SliderSearchSY,SliderSearchEX1,SliderSearchEY,*40 SliderKnob.png	
		ImageSearch, KnobX,KnobY2,SliderSearchSX2,SliderSearchSY,SliderSearchEX2,SliderSearchEY,*40 SliderKnob.png
		ImageSearch, KnobX,KnobY3,SliderSearchSX3,SliderSearchSY,SliderSearchEX3,SliderSearchEY,*40 SliderKnob.png
		ImageSearch, KnobX,KnobY4,SliderSearchSX4,SliderSearchSY,SliderSearchEX4,SliderSearchEY,*40 SliderKnob.png
		ImageSearch, KnobX,KnobY5,SliderSearchSX5,SliderSearchSY,SliderSearchEX5,SliderSearchEY,*40 SliderKnob.png
		ImageSearch, KnobX,KnobY6,SliderSearchSX6,SliderSearchSY,SliderSearchEX6,SliderSearchEY,*40 SliderKnob.png
		ImageSearch, KnobX,KnobY7,SliderSearchSX7,SliderSearchSY,SliderSearchEX7,SliderSearchEY,*40 SliderKnob.png
		Knob1 := SliderM-KnobY1-1
		Knob2 := SliderM-KnobY2-1
		Knob3 := SliderM-KnobY3-1
		Knob4 := SliderM-KnobY4-1
		Knob5 := SliderM-KnobY5-1
		Knob6 := SliderM-KnobY6-1
		Knob7 := SliderM-KnobY7-1

		NoKnobsMoved := True
	;~ 	Reverse Direction Sliders
		If (Knob3<>oldKnob3) ;knob moved
		{
			NoKnobsMoved := False 
			If (Knob3>oldKnob3) ;knob rose
			{
				If (Knob3>Knob7) ;Knob3 is above knob7, knobs are spreading out
				{
					MouseClick,Left,ButtonX2,ButtonY
				}
			} else {
				If (Knob3<Knob7) ;Knob3 is bellow knob7, knobs are spreading out
				{
					MouseClick,Left,ButtonX2,ButtonY
				}
			}
			oldKnob3 := Knob3
			oldKnob7 := Knob7
		}

	;~ 	Reverse Direction Sliders
		If (Knob5<>oldKnob5) ;knob moved
		{
			NoKnobsMoved := False 
			If (Knob5>oldKnob5) ;knob rose
			{
				If (Knob5>Knob6) ;Knob5 is above Knob6, knobs are spreading out
				{
					MouseClick,Left,ButtonX5,ButtonY
				}
			} else {
				If (Knob5<Knob6) ;Knob5 is bellow Knob6, knobs are spreading out
				{
					MouseClick,Left,ButtonX5,ButtonY
				}
			}
			oldKnob5 := Knob5
			oldKnob6 := Knob6
		}



;~ ********************
;~ 	COMMENTED SECTION, USE THIS FOR DOUBLE SLIDERS THAT TRAVEL IN THE SAME DIRECTION
;~ ********************
;~ 	Same Direction Sliders 
;~ 		If (Knob4<>oldKnob4) ;knob moved
;~ 		{
;~ 			NoKnobsMoved := False 
;~ 			averagePos := floor((Knob4+Knob6)/2)
;~ 			If (Knob4>oldKnob4) ;knobs are going up
;~ 			{
;~ 				If averagePos>0 ;averageposition is above center
;~ 				{
;~ 					MouseClick,Left,ButtonX4,ButtonY
;~ 				}
;~ 			} else { ;knobs are going down
;~ 				If averagePos<0 ;averageposition is bellow center
;~ 				{
;~ 					MouseClick,Left,ButtonX4,ButtonY
;~ 				}
;~ 			}
;~ 			oldKnob4 := Knob4
;~ 			oldKnob6 := Knob6
;~ 		}



		NumAbove := 0
		NumBellow := 0
		If Knob3<0
		{
			NumBellow++
		} Else {
			NumAbove++
		}
		If Knob7<0
		{
			NumBellow++
		} Else {
			NumAbove++
		}
		If Knob5<0
		{
			NumBellow++
		} Else {
			NumAbove++
		}
		If Knob6<0
		{
			NumBellow++
		} Else {
			NumAbove++
		}

		Axis4 := 0
		Axis2 := 0
		If NumAbove=1
		{
			Axis4 := 5
		} else {
			If NumAbove=0
			{
				Axis4 := 5
				Axis2 := 5
			} else {
				If NumBellow=1
				{
					Axis4 := -5
				} else {
					If NumBellow=0
					{
						Axis4 := -5
						Axis2 := -5
					}
				}
			}
		}
		


	;~ 	First Single Slider
		If (Knob4>oldKnob4) ;knob Rose
		{
			NoKnobsMoved := False 
			oldKnob4 := Knob4
			If (Knob4>Axis4) ;knob Over Line
			{
				MouseClick,Left,ButtonX1,ButtonY
			}
		} else {
			If (Knob4<oldKnob4) ;knob Fell
			{
				NoKnobsMoved := False 
				oldKnob4 := Knob4
				If (Knob4<Axis4) ;knob Bellow Line
				{
					MouseClick,Left,ButtonX1,ButtonY
				}
			}
		}

	;~ 	Second Single Slider
		If (Knob2>oldKnob2) ;knob Rose
		{
			NoKnobsMoved := False 
			oldKnob2 := Knob2
			If Knob2>0 ;knob Over Line
			{
				MouseClick,Left,ButtonX3,ButtonY
			}
		} else {
			If (Knob2<oldKnob2) ;knob Fell
			{
				NoKnobsMoved := False 
				oldKnob2 := Knob2
				If Knob2<0 ;knob Bellow Line
				{
					MouseClick,Left,ButtonX3,ButtonY
				}
			}
		}

	;~ 	Third Single Slider
		If (Knob1>oldKnob1) ;knob Rose
		{
			NoKnobsMoved := False 
			oldKnob1 := Knob1
			If Knob1>0 ;knob Over Line
			{
				MouseClick,Left,ButtonX4,ButtonY
			}
		} else {
			If (Knob1<oldKnob1) ;knob Fell
			{
				NoKnobsMoved := False 
				oldKnob1 := Knob1
				If Knob1 < 0 ;knob Bellow Line
				{
					MouseClick,Left,ButtonX4,ButtonY
				}
			}
		}


	
}

Setup:
IfWinExist eGenesis Client
{
	WinGet, GameWinHandle, ID, eGenesis Client
} else {
	Msgbox, eGenesis client not running, exiting...
Exit
}

;~ Base
OriX := 625
OriY := 342

;~ Offsets
offRedLineStartX := OriX-625
offRedLineStartY := OriY-333
offSliderT := OriY-364
offSliderM := OriY-424
offSliderB := OriY-483
offSliderX1 := OriX-618
offSliderX2 := OriX-654
offSliderX3 := OriX-690
offSliderX4 := OriX-726
offSliderX5 := OriX-762
offSliderX6 := OriX-798
offSliderX7 := OriX-834
offButtonY := OriY-503
offButtonX1 := OriX-647
offButtonX2 := OriX-688
offButtonX3 := OriX-729
offButtonX4 := OriX-769
offButtonX5 := OriX-809


;~ Locate Word Lime
WinActivate eGenesis Client
ImageSearch, LimeX,LimeY,0,0,Xmax,Ymax,*40 Lime.png
If ErrorLevel=2
{
	MsgBox,,,Couldn't Find Lime.png
}
If ErrorLevel<1
{
	GuiControl, Text, Label, Found Crematory Window
} else {
	If ErrorLevel<2
	{
		;Didn't find the Word Lime
		MsgBox,,Crematory Macro,Crematory Window not Found, closing macro
		ExitApp
	}
}

RedLineStartX := LimeX-offRedLineStartX
RedLineStartY := LimeY-offRedLineStartY
SliderX1 := LimeX-offSliderX1
SliderX2 := LimeX-offSliderX2
SliderX3 := LimeX-offSliderX3
SliderX4 := LimeX-offSliderX4
SliderX5 := LimeX-offSliderX5
SliderX6 := LimeX-offSliderX6
SliderX7 := LimeX-offSliderX7
SliderT := LimeY-offSliderT
SliderM := LimeY-offSliderM
SliderB := LimeY-offSliderB
ButtonY := LimeY-offButtonY
ButtonX1 := LimeX-offButtonX1
ButtonX2 := LimeX-offButtonX2
ButtonX3 := LimeX-offButtonX3
ButtonX4 := LimeX-offButtonX4
ButtonX5 := LimeX-offButtonX5
ProgressSX := LimeX-2
ProgressSY := LimeY-12
ProgressEX := LimeX+3
ProgressEY := LimeY+5
SliderSearchSX1 := SliderX1-2
SliderSearchSX2 := SliderX2-2
SliderSearchSX3 := SliderX3-2
SliderSearchSX4 := SliderX4-2
SliderSearchSX5 := SliderX5-2
SliderSearchSX6 := SliderX6-2
SliderSearchSX7 := SliderX7-2
SliderSearchEX1 := SliderX1+7
SliderSearchEX2 := SliderX2+7
SliderSearchEX3 := SliderX3+7
SliderSearchEX4 := SliderX4+7
SliderSearchEX5 := SliderX5+7
SliderSearchEX6 := SliderX6+7
SliderSearchEX7 := SliderX7+7
SliderSearchSY := SliderT-10
SliderSearchEY := SliderB+10
oldKnob1 := 100
oldKnob2 := 100
oldKnob3 := 100
oldKnob4 := 100
oldKnob5 := 100
oldKnob6 := 100
oldKnob7 := 100
return

Unload: ;Unload
;~ 	Knobs not moving - Finished
;~ 	Refresh
	MouseClick,Left,LimeX,LimeY
	sleep, 100
;~ 	Find Take
	ImageSearch,LoadX,LoadY,LimeX-29,LimeY-136,LimeX+49,LimeY-40,*40 Take.png
	If ErrorLevel<1
	{
		MouseClick,Left,LoadX,LoadY
		sleep,300
		ImageSearch,EveX,EveY,LoadX,LoadY-50,LoadX+133,LoadY+50,*90 Everything.png
		If ErrorLevel<1
		{
			MouseClick,Left,EveX,EveY
			sleep, 300
		} 
	}
	return


Load:
;~ 	Knobs not moving - Finished
;~ 	Refresh
	MouseClick,Left,LimeX,LimeY
	sleep, 100
;~ 	Find Load
	ImageSearch,LoadX,LoadY,LimeX-29,LimeY-136,LimeX+49,LimeY-40,*40 Load.png
	If ErrorLevel<1
	{
		;load Limestone
		sleep,100
		MouseClick,Left,LoadX,LoadY
		sleep,100
		MouseClick,Left,LoadX+14,LoadY-33
		sleep,200
		MouseClick,Left,floor(Xmax/2),floor(Ymax/2)+44
		sleep,200
		;load Leeks
		sleep,100
		MouseClick,Left,LoadX,LoadY
		sleep,100
		MouseClick,Left,LoadX+14,LoadY-17
		sleep,200
		MouseClick,Left,floor(Xmax/2),floor(Ymax/2)+44
		sleep,200
		;load Flax
		sleep,100
		MouseClick,Left,LoadX,LoadY
		sleep,100
		MouseClick,Left,LoadX+14,LoadY
		sleep,200
		MouseClick,Left,floor(Xmax/2),floor(Ymax/2)+44
		sleep,200
		;load Papyrus
		sleep,100
		MouseClick,Left,LoadX,LoadY
		sleep,100
		MouseClick,Left,LoadX+14,LoadY+17
		sleep,200
		MouseClick,Left,floor(Xmax/2),floor(Ymax/2)+44
		sleep,200
		;load Wood
		sleep,100
		MouseClick,Left,LoadX,LoadY
		sleep,100
		MouseClick,Left,LoadX+14,LoadY+33
		sleep,200
		MouseClick,Left,floor(Xmax/2),floor(Ymax/2)+44
		sleep,200
		;Fire
		MouseClick,Left,LoadX,LoadY-17
		sleep, 100
	}
	return

Close:
ExitApp

^a:: ;automode
if (autoMode=True)
{
	autoMode := False
	GuiControl,,myText,CTRL+A - Auto Mode is OFF
} else {
	autoMode := True
	GuiControl,,myText,CTRL+A - Auto Mode is ON
}
return

^p::pause
^r::reload