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.

User:Sithid/Macros/AutoIT/Slate

From A Tale in the Desert
< User:Sithid‎ | Macros‎ | AutoIT
Revision as of 05:55, 17 December 2008 by Sithid (talk | contribs) (→‎The Macro)
Jump to navigationJump to search

My basic slate macro, should work without any configuration. After running, switch to atitd, unpause, and follow messagebox instructions.

Note the macro is a bit buggy( delays are off, movement glitches and sometimes skips slate ), I havnt had time to fine tune it but it should work semi ok for you.

The Macro

#cs --------------------------------------------------------------------------------------
	
	AutoIt Version 3.2.12.1
	Author:		Sithid
	Date:		07.12.08
	Version:	0.5
	
	Script Function:
	Slate Collection - Automagical

#ce --------------------------------------------------------------------------------------

#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt( "MustDeclareVars", 1 )

Global $Paused = False
Global $AtitdHandle = 0
Global $SlateCount = 0

Global $SlateHex = "FFFFFF"
Global $SlateLoc[2]

Global $SlateSet = False
Global $ReadyCheck = False

HotKeySet( "{ESC}", "Terminate" )
HotKeySet( "{PAUSE}", "TogglePause" )
HotKeySet( "{F1}", "SetSlate" )
HotKeySet( "{F2}", "SetReady" )

WinWaitActive( "eGenesis Client" );

$AtitdHandle = WinGetHandle( "eGenesis Client" )
	
TogglePause()

While 1
	MsgBox( 0x0, "Slate Icon Position", "Please hover over your slate icon and press F1." )
	
	While Not $SlateSet
		Sleep( 100 )
	WEnd
	
	MsgBox( 0x0, "Ready Check", "Please move to the position you wish to start from and press F2." )
	
	While Not $ReadyCheck
		Sleep( 100 )
	WEnd
	
	Main()
WEnd

Func Main()	
	Do
		PickSlate()
		Move( "RIGHT" )
		
		PickSlate()
		Move( "RIGHT" )

		PickSlate()
		Move( "RIGHT" )	
		
		PickSlate()
		Move( "UP" )

		PickSlate()
		Move( "LEFT" )
		
		PickSlate()
		Move( "LEFT" )
		
		PickSlate()
		Move( "LEFT" )
		
		PickSlate()
		Move( "UP" )
	Until 1 = 2
EndFunc

Func Move( $key )
	Send( "{" & $key & " down}" )
	Sleep( 200 )
	Send( "{" & $key & " up}" )
	Sleep( 1000 )
EndFunc

Func PickSlate()
	If CheckSlate( $SlateLoc, $SlateHex ) Then
		Do 
			MouseClick( "right", $SlateLoc[0], $SlateLoc[1], 1, 5  )
			MouseClick( "left", $SlateLoc[0], $SlateLoc[1], 1, 5 )
			$SlateCount += 1
			Sleep( 3000 )
		Until Not CheckSlate( $SlateLoc, $SlateHex )
	EndIf
EndFunc

Func CheckSlate( $pos, $hex )
	Local $col = Hex( PixelGetColor( $pos[0], $pos[1] ), 6 )
	
	If $col = $hex Then
		Return True
	EndIf
	
	Return False
EndFunc

Func SetSlate()
	If $Paused Then
		Return
	EndIf
	
	$SlateLoc = MouseGetPos()
	$SlateHex = Hex( PixelGetColor( $SlateLoc[0], $SlateLoc[1], $AtitdHandle ), 6 )
	$SlateSet = True
EndFunc

Func SetReady()
	If $Paused Then
		Return
	EndIf

	$ReadyCheck = True
EndFunc

Func TogglePause()
	$Paused = Not $Paused
			
	While $Paused
		Sleep(100 )
	WEnd
EndFunc

Func Terminate()
		Exit
EndFunc

Downloadable version of script and exe will be around shortly, need to figure out how first :P.