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/Fishing"

From A Tale in the Desert
Jump to navigationJump to search
Line 12: Line 12:
 
{
 
{
 
WinActivate
 
WinActivate
 +
 +
 +
WinGetActiveStats, Title, Width, Height, X, Y
 +
 +
 +
;Use this if you want it to click NO (to mount, record catches)
 +
ClickX := Width - 482
 +
ClickY := Height - 315
 +
 +
 +
;Use this if you want it to click YES (to mount, record catches)
 +
;ClickX := Width - 569
 +
;ClickY := Height - 315
 +
  
 
InputBox, NumPulls, Fishing, Step 1: Enter how many times do you want to cast?
 
InputBox, NumPulls, Fishing, Step 1: Enter how many times do you want to cast?
Line 30: Line 44:
 
{
 
{
  
WinActivate
+
WinActivate, eGenesis Client
 
CoordMode, Mouse, Relative
 
CoordMode, Mouse, Relative
 
KeyWait, MButton, D
 
KeyWait, MButton, D
Line 87: Line 101:
 
LocPosY := LocY%Location%
 
LocPosY := LocY%Location%
 
MouseGetPos, OldMX, OldMY
 
MouseGetPos, OldMX, OldMY
MouseMove, %LocPosX%, %LocPosY%, 0
 
 
Click, %LocPosX%, %LocPosY%
 
Click, %LocPosX%, %LocPosY%
 +
MouseMove, %OldMX%, %OldMY%, 0
 
Cycle++
 
Cycle++
 
GuiControl, Text, LocationText, Casting: %Cycle% of %NumPulls%
 
GuiControl, Text, LocationText, Casting: %Cycle% of %NumPulls%
  
 +
 +
Sleep 17000
 +
 +
WinActivate, eGenesis Client
 +
PixelSearch, Px, Py, %ClickX%, %ClickY%, %ClickX%, %ClickY%, 0xA7CAD8, 10, Fast
 +
 +
if ErrorLevel = 0
 +
{
 +
Click, %ClickX%, %ClickY%
 +
Sleep 250
 
MouseMove, %OldMX%, %OldMY%, 0
 
MouseMove, %OldMX%, %OldMY%, 0
 +
}
 +
  
 
if Cycle = %NumPulls%
 
if Cycle = %NumPulls%
Line 113: Line 139:
 
}
 
}
  
;Click the fishing icon every 15 seconds, you can adjust this if you need to...
 
Sleep 15000
 
  
  

Revision as of 01:35, 9 January 2010

;Ctrl+Alt+F to start macro.
;Ctrl+P to pause script (ie to click Water icon) and Ctrl+P again to resume
;The AHK icon in system tray will turn red while paused.

^p::Pause
^!f::



IfWinExist eGenesis Client
{
	WinActivate


WinGetActiveStats, Title, Width, Height, X, Y 


;Use this if you want it to click NO (to mount, record catches)
ClickX := Width - 482
ClickY := Height - 315


;Use this if you want it to click YES (to mount, record catches)
;ClickX := Width - 569
;ClickY := Height - 315


	InputBox, NumPulls, Fishing, Step 1: Enter how many times do you want to cast?
	Location = 1
	Cycle = 0


	Gui, +AlwaysOnTop +ToolWindow
	Gui, Font, bold
	Gui, Add, Text, vLocationText, Step 2: Record the location of fishing icon...
	Gui, Font, norm
	Gui, Add, Text,, Hover and middle-click (Click mouse-wheel) on the fishing icon
	Gui, Show


	WinGet, GameWinHandle, ID, eGenesis Client
	loop
	{

		WinActivate, eGenesis Client
		CoordMode, Mouse, Relative
		KeyWait, MButton, D
		KeyWait, MButton
		MouseGetPos, TestX, TestY, WinHandle
		if (WinHandle = GameWinHandle)
		{
			Gosub, RecordIcon
		}
		else
		{
			Gui, Destroy
			break
		}
	}
	return

	RecordIcon:
	MouseGetPos, LocX%Location%, LocY%Location%
	Gui, Destroy
	Gui, +AlwaysOnTop +ToolWindow
	Gui, Font, bold
	Gui, Add, Text, LocationText, Fishing icon captured, now click OK!
	Gui, Font, norm
	Gui, Add, Text,, 
	( LTrim
	Note:
	You can pause fishing at anytime by clicking Ctrl+P
	Resume, after pausing, with Ctrl+P again.

	)

	Gui, Add, Button, default gSetLoops, OK
	Gui, Show
	return


	SetLoops:
	Gui, Submit
	Gui, Destroy
	Gui, +AlwaysOnTop +ToolWindow
	Gui, Font, bold
	Gui, Add, Text, vLocationText, Ready to fish, Good Luck!
	Gui, Show

Sleep 2000



	loop, %NumPulls%
	{

			WinActivate, eGenesis Client

			LocPosX := LocX%Location%
			LocPosY := LocY%Location%
			MouseGetPos, OldMX, OldMY
			Click, %LocPosX%, %LocPosY%
			MouseMove, %OldMX%, %OldMY%, 0			
			Cycle++
			GuiControl, Text, LocationText, Casting: %Cycle% of %NumPulls%


Sleep 17000

			WinActivate, eGenesis Client
			PixelSearch, Px, Py, %ClickX%, %ClickY%, %ClickX%, %ClickY%, 0xA7CAD8, 10, Fast

			if ErrorLevel = 0
			{
			Click, %ClickX%, %ClickY%
			Sleep 250
			MouseMove, %OldMX%, %OldMY%, 0			
			}


if Cycle = %NumPulls%
{
	Gui, Destroy
	Gui, Font, bold
	Gui, Add, Text, LocationText, Casting: %Cycle% of %NumPulls%
	Gui, Font, norm
	Gui, Add, Text,,
	( LTrim
	All Done!

	Hope you caught lots of fish!

	Middle-click on this window to end the script.
	)
	Gui, Show

Exit
}



	}
	Gui, Destroy
	Gui, Add, Text,, Middle-click on this window to end the script.
	Gui, Show
	return
}