The Wiki for Tale 6 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.

Guilds/Gaia/Autohotkey

From ATITD6
Revision as of 19:54, 15 February 2012 by Karedas (talk | contribs) (→‎Faire pousser du lin)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Karedas

Faire pousser du lin

J'utilise une macro d'Iggys (Macros/Iggys/Flax) que j'ai légèrement modifier pour la rendre utilisable sur une faible résolution en hauteur.

Epinglez le menu planter un lin en haut a gauche de la fenetre, ayez au moins 15 graines et 15 cruches d'eau (si vous faites pousser) et lancez la macro

Mettez vous en camera F8+F8 (vu de haut) zoomée a fond et bloquez le zoom avec ALT+L

Appuyez sur CTRL+ALT+E pour faire des graines Appuyez sur CTRL+ATT+F pour faire pousser le lin

Un fenêtre vous demande le nombre de passages, je vous conseille de pas être trop gourmands, parfois la macro se vautre sur un lin et on se met a se promener au lieu de récolter. Je les lance 1 par 1 ça me permet de surveiller que tout marche bien.

Vous pouvez mettre la macro en pause (si un menu ne s'est pas bien épinglé vous pouvez comme ça le mettre au bon endroit) avec CTRL+ALT+SHIFT+P


Téléchargez ce fichier et décompressez le Flax macro v0.801 Last update

Puis remplacez le code dans Flax_v1.0en par le code qui suit.


SetDefaultMouseSpeed, 2 ; MouseSpeed 2 it's too fast, MouseSpeed 3 too slow.
SetMouseDelay, 21 
; As there is no 2,5 then we need a little pause for the mouse movement.

;Global Constants

;Location of the Flax: ? planting button (assumes far top left of screen, atm.)
plantButtonX:=50
plantButtonY:=44

;Flax Bed Size:
flaxBed:=319

;Flax Popup Box Size
flaxBoxX:=176
flaxBoxY:=100
;Grid Layout
;XY|Xx|Xx|Xx
;Yy|UL|UM|UR
;Yy|ML|MM|MR
;Yy|LL|LM|LR
;Yy|AL|AM|AR
;Yy|BL|BM|BR






;all positions are based off of ULxy
ULx:=4
ULy:=55

UMx:=ULx + flaxBoxX
UMy:=ULy

URx:=UMx + flaxBoxX
URy:=ULy

MLx:=ULx
MLy:=ULy + flaxBoxY

MMx:=MLx + flaxBoxX
MMy:=MLy

MRx:=MMx + flaxBoxX
MRy:=MLy

LLx:=ULx
LLy:=MLy + flaxBoxY

LMx:=LLx + flaxBoxX
LMy:=LLy

LRx:=LMx + flaxBoxX
LRy:=LLy

ALx:=ULx
ALy:=LLy + flaxBoxY

AMx:=ULx + flaxBoxX
AMy:=ALy

ARx:=UMx + flaxBoxX
ARy:=ALy

BLx:=ULx
BLy:=ALy + flaxBoxY

BMx:=ULx + flaxBoxX
BMy:=BLy

BRx:=UMx + flaxBoxX
BRy:=BLy

^!+p::Pause ;Pause Script Ctrl+Alt+Shift+P

;Move the popup menu box to the specified topleft corner by posX,posy
;(assumes the menu was just opend and the mouse hasn't moved)
moveMenu(posX, posY)
{
	Click up
	MouseGetPos , MX, MY
	MXv:=MX+50
	MYv:=MY-35
	MouseMove , MX+50, MY-35
	Click down 
	MXv:=posX+50
	MYv:=posY+15
	MouseMove , posX+50, posY+15
	Click up
	return
}

refreshMenu(TCx,TCy)
{
	;Relative location to click
	Rx:=TCx+95
	Ry:=TCy+30
	click %Rx% , %Ry%
	return
}

;UnPin menu with topleft corner at TCx,TCy
unPinMenu(TCx,TCy)
{
	;offset pin from top left corner
	pinLocX:=TCx+150
	pinLocY:=TCy+17
	
	msgbox , 0 , unpinning menu, "Unpinning Menu at %TCx% _ %TCy% pin at %pinLocX% _ %pinLocY%"
	
	Click %pinLocX% , %pinLocY%
	
	return 1
}

;Process the top left corner of the flax menu at TCx,TCy
processFlax(TCx,TCy)
{
	;Action item Relative Location
	actionX:=TCx+50
	actionY:=TCy+50
	
	;Search Area Adjustment
	SATCx:=TCx+174
	SATCy:=TCy+100

	;Search Area Adjustment for Rip out
	RPTCx:=TCx+174
	RPTCy:=TCy+120
	
	refreshMenu(TCx,TCy)
	sleep 230
	
	;Msgbox , 0 , Searchbox, "Search area is %TCx% _ %TCy% by %SATCx% _ %SATCy%"
	
	ImageSearch, Px, Py, TCx, TCy, SATCx, SATCy, *50 Find_Weed_this.png
	if (ErrorLevel < 1) {
		Click %actionX% , %actionY% ;Click Weed This
		return 1		; found the "weed this"
	}
	ImageSearch, Px, Py, TCx, TCy, SATCx, SATCy, *50 Find_Weed_and.png
	if (ErrorLevel < 1) {
		Click %actionX% , %actionY% ;Click Weed and Water This
		return 1		; found the "weed and"
	}
	ImageSearch, Px, Py, TCx, TCy, SATCx, SATCy, *50 Find_Harvest_this.png
	if (ErrorLevel < 1) {
		Click %actionX% , %actionY% ;Click Harvest This
		;unPinMenu(TCx,TCy)
		;pinLocX:=TCx+155
		;pinLocY:=TCy+17
		;Click %pinLocX% , %pinLocY%
		ImageSearch, Px, Py, TCx, TCy, SATCx, SATCy, *50 Pinned.png
		if (ErrorLevel < 1)
		{
			utilx:=Px+10
			utily:=Py+10
			Click %utilx%, %utily% ; Unpin window
		}
		return 0 ; found the "Harvest this", menu removed
	}
	ImageSearch, Px, Py, TCx, TCy, SATCx, SATCy, *50 Find_Harvest_seeds.png
	if (ErrorLevel < 1) {
		;ripOutFlax(TCx,TCy)
		Click %actionX% , %actionY% ;Click Harvest seeds
		utilX:=TCx+35
		utilY:=TCy+82
		Click %utilX%, %utilY% ;click Utilities
		ImageSearch, Px, Py, TCx, TCy, RPTCx, RPTCy, *50 Find_Rip_out.png
		if (ErrorLevel < 1) 
		{
			utilx:=Px+10
			utily:=Py+10
			Click %utilx%, %utily% ; Click Rip out
		}
		;unPinMenu(TCx,TCy)
		;pinLocX:=TCx+150
		;pinLocY:=TCy+17
		;Click %pinLocX% , %pinLocY%
		ImageSearch, Px, Py, TCx, TCy, SATCx, SATCy, *50 Pinned.png
		if (ErrorLevel < 1)
		{
			utilx:=Px+10
			utily:=Py+10
			Click %utilx%, %utily% ; Unpin window
		}
		return 0 ; found the "harvest seeds", menu removed
	}
	return 1 ; no clicks here
}

;Process the top left corner of the flax menu at TCx,TCy
processFlaxSeeds(TCx,TCy,seedCount)
{
	;Action item Relative Location
	actionX:=TCx+50
	actionY:=TCy+50
	
	;Search Area Adjustment
	SATCx:=TCx+174
	SATCy:=TCy+100
	
	;Search Area Adjustment for Rip out
	RPTCx:=TCx+174
	RPTCy:=TCy+120

	refreshMenu(TCx,TCy)
	sleep 230
	
	ImageSearch, Px, Py, TCx, TCy, SATCx, SATCy, *50 Find_Harvest_seeds.png
	if (ErrorLevel < 1) {
		;ripOutFlax(TCx,TCy)
		Click %actionX% , %actionY% ;Click Harvest seeds
		if (seedCount >= 5) {
			utilX:=TCx+35
			utilY:=TCy+82
			Click %utilX%, %utilY% ;click Utilities
			ImageSearch, Px, Py, TCx, TCy, RPTCx, RPTCy, *50 Find_Rip_out.png
			if (ErrorLevel < 1) 
			{
				utilx:=Px+10
				utily:=Py+10
				Click %utilx%, %utily% ; Click Rip out
			}
			;pinLocX:=TCx+150
			;pinLocY:=TCy+17
			;Click %pinLocX% , %pinLocY%
			ImageSearch, Px, Py, TCx, TCy, SATCx, SATCy, *50 Pinned.png
			if (ErrorLevel < 1)
			{
				utilx:=Px+10
				utily:=Py+10
				Click %utilx%, %utily% ; Unpin window
			}
			return 99
		}
		return 1 ; found the "harvest seeds", menu removed
	}
	return 0 ; no clicks here	
}
	
;Rip out the flax bed of the box with top left corner at TCx,TCy
ripOutFlax(TCx,TCy)
{
	;Utilities menu relative location
	utilX:=TCx+35
	utilY:=TCy+82
	
	Click %utilX%, %utilY% ;click Utilities
	
	;adjust for new popup menu
	MouseGetPos , MX, MY
	ROFx:=MX+50 ;Rip Out Flax button X
	ROFy:=MY-18  ;Rip Out Flax button Y
	
	clickItem(ROFx,ROFy) ; click Rip out Flax
	
	return
}

;Pin menu assuming that it was just brought up
pinMenu()
{
	mouseGetPos , MX , MY
	;Pin icon relative location
	pinX:=MX+155
	pinY:=MY-33
	
	click %pinX% , %pinY% ;Click the pin button
	
	MouseMove , MX, MY, 0 ;put back the mouse
	
	return	
}

;Plant the flax seed
plantSeed()
{
	pBX:=50
	pBY:=44
	;click on the flax seed button
	Click %pbX% , %pbY%
	return
}

;Move avatar to location specified AvX, AvY
moveAvatar(AvX, AvY)
{
	Click %AvX%, %AvY%
	sleep 500
	return
}

;Bring up the Flax bed's popup menu provided the avatars current location AvX,AvY
flaxMenu(AvX,AvY)
{
	;MouseGetPos , MX, MY
	;Use above and to the right of the avatar to bring up menu
	flaxMenuX:= AvX+50
	flaxMenuY:= AvY-50
	
	click %flaxMenuX% , %flaxMenuY%
	
	pinMenu()
	
	;MouseMove , MX, MY
	
	return
}
	

;;Click the resource at X,Y then return the pointer
clickItem(X, Y)
{
	oldMouseDelay:= A_MouseDelay
	setMouseDelay , 1
  Click up
  MouseGetPos , MX, MY
  Click , %X%, %Y%
  MouseMove , MX, MY
	setMouseDelay , A_MouseDelay
  return
}

^!f::
WinWait, eGenesis Client, 
IfWinNotActive, eGenesis Client, , WinActivate, eGenesis Client, 
WinWaitActive, eGenesis Client,
WinGetActiveStats, win_Title, win_Width, win_Height, win_Xpos, win_Ypos
InputBox, flaxNum, Flaxing time!, How many passes do you want?
;some local constants

;msgBox " UL= %ULx%,%ULy% _ UM= %UMx%,%UMy% _ UR= %URx%,%URy% _ ML= %MLx%,%MLy% _ MM= %MMx%,%MMy% _ MR= %MRx%,%MRy% _ LL= %LLx%,%LLy% _ LM= %LMx%,%LMy% _ LR= %LRx%,%LRy% _ AL= %ALx%,%ALy% _ AM= %AMx%,%AMy% _ AR= %ARx%,%ARy% _ BL= %BLx%,%BLy% _ BM= %BMx%,%BMy% _ BR= %BRx%,%BRy%"

;middle of the window where the avatar is located
avatarX:=win_Width/2 
avatarY:=win_Height/2 + 28 ;add a little for title-bar adjustment
moveDist:=flaxBed + 8 ;Move one plot plus a little

;Change camera to Cartogropher mode, zoom in and lock camera
MouseMove %avatarX%, %avatarY%

;standard movement values
moveLeft:= avatarX - moveDist
moveRight:= avatarX + moveDist
moveUp:= avatarY - moveDist
moveDown:= avatarY + moveDist

loop {
	SetMouseDelay, 21 
	;Left Rigth Flipper
	moveLR:=1 ;0 for left, 1 for right
	
	TrayTip Planting, still %flaxNum% passes to go,15,1
	if (flaxNum<=0) {	
		TrayTip, Done, Enjoy your flax!, 15, 1
		soundPlay *64,1
		Sleep 360
		exit
	}
	flaxNum:=flaxNum-1
	
if (A_Index==1) {
		moveAvatar(avatarX,moveUp)
		moveAvatar(moveRight,avatarY)
	} else {
		moveAvatar(avatarX,moveUp)
		moveAvatar(avatarX,moveUp)
		moveAvatar(avatarX,moveUp)
		moveAvatar(avatarX,moveUp)
		moveAvatar(moveRight,avatarY)
		moveAvatar(moveRight,AvatarY)
	}
	
	;Set all grid boxes to non moved values ( 0 )
	UL:=0
	UM:=0
	UR:=0
	ML:=0
	MM:=0
	MR:=0
	LL:=0
	LM:=0
	LR:=0
	AL:=0
	AM:=0
	AR:=0
	BL:=0
	BM:=0
	BR:=0
	
	gridXCounter:=3
	gridYCounter:=5
	loop {
		if (gridYCounter > 0) {
			gridYCounter:=gridYCounter-1
			if (moveLR==1) {
				moveLR:=0
			} else {
				moveLR:=1
			}
			gridXCounter:=3
			loop {
				if (gridXCounter > 0)	{
					gridXCounter:=gridXCounter-1
					plantSeed()
					flaxMenu(avatarX, avatarY)
					if (gridYCounter==4) {
						if (UL==0) {
							moveMenu(ULx,ULy)
							UL:=1
						} else if (UM==0) {
							moveMenu(UMx,UMy)
							UM:=1
						} else if (UR==0) {
							moveMenu(URx,URy)
							UR:=1
						}
					}
					if (gridYCounter==3) {
						if (ML==0) {
							moveMenu(MLx,MLy)
							ML:=1
						} else if (MM==0) {
							moveMenu(MMx,MMy)
							MM:=1
						} else if (MR==0) {
							moveMenu(MRx,MRy)
							MR:=1
						}
					}
					if (gridYCounter==2) {
						if (LL==0) {
							moveMenu(LLx,LLy)
							LL:=1
						} else if (LM==0) {
							moveMenu(LMx,LMy)
							LM:=1
						} else if (LR==0) {
							moveMenu(LRx,LRy)
							LR:=1
						}

					}
					if (gridYCounter==1) {
						if (AL==0) {
							moveMenu(ALx,ALy)
							AL:=1
						} else if (AM==0) {
							moveMenu(AMx,AMy)
							AM:=1
						} else if (AR==0) {
							moveMenu(ARx,ARy)
							AR:=1
						}

					}
					if (gridYCounter==0) {
						if (BL==0) {
							moveMenu(BLx,BLy)
							BL:=1
						} else if (BM==0) {
							moveMenu(BMx,BMy)
							BM:=1
						} else if (BR==0) {
							moveMenu(BRx,BRy)
							BR:=1
						}


					}
					if (moveLR==0 && gridXCounter > 0)
					{
						moveAvatar(moveLeft,avatarY)
					} else if (moveLR==1 && gridXCounter > 0) {
						moveAvatar(moveRight,avatarY)
					}
				} else {
					break
				}	
			}
		} else {
			break
		}
		if (gridYCounter>0) 
				moveAvatar(avatarX, moveDown)		
	}
	
	;start harvest loops
	loop {
		if (UL==0 && UM==0 && UR==0 && ML==0 && MM==0 && MR==0 && LL==0 && LM==0 && LR==0 && AL==0 && AM==0 && AR==0 && BL==0 && BM==0 && BR==0)
			break
		if UL
			UL:=processFlax(ULx,ULy)
		if UM
			UM:=processFlax(UMx,UMy)
		if UR
			UR:=processFlax(URx,URy)
		if ML
			ML:=processFlax(MLx,MLy)
		if MM
			MM:=processFlax(MMx,MMy)
		if MR
			MR:=processFlax(MRx,MRy)
		if LL
			LL:=processFlax(LLx,LLy)
		if LM
			LM:=processFlax(LMx,LMy)
		if LR
			LR:=processFlax(LRx,LRy)
		if AL
			AL:=processFlax(ALx,ALy)
		if AM
			AM:=processFlax(AMx,AMy)
		if AR
			AR:=processFlax(ARx,ARy)
		if BL
			BL:=processFlax(BLx,BLy)
		if BM
			BM:=processFlax(BMx,BMy)
		if BR
			BR:=processFlax(BRx,BRy)
	}
	SoundPlay *-1, 1
}
SoundPlay *64,1


^!e::
WinWait, eGenesis Client, 
IfWinNotActive, eGenesis Client, , WinActivate, eGenesis Client, 
WinWaitActive, eGenesis Client,
WinGetActiveStats, win_Title, win_Width, win_Height, win_Xpos, win_Ypos
MsgBox ,48,Let's Flax!, Make sure your plant menu is pinned on top left corner.`n Items and skills menu minimized.`n The half side of the screen should be totally free of menus or icons.`n Ctrl+Alt+E for seeding. Ctrl+Alt+F for flaxing.`n Ctrl+Alt+Shift+P for pause/unpause macro.

InputBox, flaxNum, Seeding time!, How many passes do you want?
;some local constants

;msgBox " UL= %ULx%,%ULy% _ UM= %UMx%,%UMy% _ UR= %URx%,%URy% _ ML= %MLx%,%MLy% _ MM= %MMx%,%MMy% _ MR= %MRx%,%MRy% _ LL= %LLx%,%LLy% _ LM= %LMx%,%LMy% _ LR= %LRx%,%LRy%" _ AL= %ALx%,%ALy% _ AM= %AMx%,%AMy% _ AR= %ARx%,%ARy% _ BL= %BLx%,%BLy% _ BM= %BMx%,%BMy% _ BR= %BRx%,%BRy%

;middle of the window where the avatar is located
avatarX:=win_Width/2 
avatarY:=win_Height/2 + 28 ;add a little for title-bar adjustment
moveDist:=flaxBed + 5 ;Move one plot plus a little

;Change camera to Cartogropher mode, zoom in and lock camera
MouseMove %avatarX%, %avatarY%


;standard movement values
moveLeft:= avatarX - moveDist
moveRight:= avatarX + moveDist
moveUp:= avatarY - moveDist
moveDown:= avatarY + moveDist

loop {
	SetMouseDelay, 21 
	;Left Rigth Flipper
	moveLR:=1 ;0 for left, 1 for right
	
	TrayTip Flaxing, still %flaxNum% passes to go,15,1
	if (flaxNum<=0) {	
		TrayTip, Done, Enjoy your flax!, 15, 1
		soundPlay *64,1
		Sleep 360	
		exit
	}
	flaxNum:=flaxNum-1
	
	if (A_Index==1) {
		moveAvatar(avatarX,moveUp)
		moveAvatar(moveRight,avatarY)
	} else {
		moveAvatar(avatarX,moveUp+50)
		moveAvatar(avatarX,moveUp)
		moveAvatar(avatarX,moveUp)
		moveAvatar(avatarX,moveUp)
		moveAvatar(moveRight-50,avatarY)
		moveAvatar(moveRight,AvatarY)
	}
	;Set all grid boxes to non moved values ( 0 )
	UL:=0
	UM:=0
	UR:=0
	ML:=0
	MM:=0
	MR:=0
	LL:=0
	LM:=0
	LR:=0
	AL:=0
	AM:=0
	AR:=0
	BL:=0
	BM:=0
	BR:=0

	gridXCounter:=3
	gridYCounter:=5
	loop {
		if (gridYCounter > 0) {
			gridYCounter:=gridYCounter-1
			if (moveLR==1) {
				moveLR:=0
			} else {
				moveLR:=1
			}
			gridXCounter:=3
			loop {
				if (gridXCounter > 0)	{
					gridXCounter:=gridXCounter-1
					plantSeed()
					flaxMenu(avatarX, avatarY)
					if (gridYCounter==4) {
						if (UL==0) {
							moveMenu(ULx,ULy)
							UL:=1
						} else if (UM==0) {
							moveMenu(UMx,UMy)
							UM:=1
						} else if (UR==0) {
							moveMenu(URx,URy)
							UR:=1
						}
					}
					if (gridYCounter==3) {
						if (ML==0) {
							moveMenu(MLx,MLy)
							ML:=1
						} else if (MM==0) {
							moveMenu(MMx,MMy)
							MM:=1
						} else if (MR==0) {
							moveMenu(MRx,MRy)
							MR:=1
						}
					}
					if (gridYCounter==2) {
						if (LL==0) {
							moveMenu(LLx,LLy)
							LL:=1
						} else if (LM==0) {
							moveMenu(LMx,LMy)
							LM:=1
						} else if (LR==0) {
							moveMenu(LRx,LRy)
							LR:=1
						}
					}
					if (gridYCounter==1) {
						if (AL==0) {
							moveMenu(ALx,ALy)
							AL:=1
						} else if (AM==0) {
							moveMenu(AMx,AMy)
							AM:=1
						} else if (AR==0) {
							moveMenu(ARx,ARy)
							AR:=1
						}
					}
					if (gridYCounter==0) {
						if (BL==0) {
							moveMenu(BLx,BLy)
							BL:=1
						} else if (BM==0) {
							moveMenu(BMx,BMy)
							BM:=1
						} else if (BR==0) {
							moveMenu(BRx,BRy)
							BR:=1
						}
					}
					if (moveLR==0 && gridXCounter > 0)
					{
						moveAvatar(moveLeft,avatarY)
					} else if (moveLR==1 && gridXCounter > 0) {
						moveAvatar(moveRight,avatarY)
					}
				} else {
					break
				}	
			}
		} else {
			break
		}
		if (gridYCounter>0) 
				moveAvatar(avatarX, moveDown)		
	}
	
	;start gather loops
	loop {
		if (UL>6 && UM>6 && UR>6 && ML>6 && MM>6 && MR>6 && LL>6 && LM>6 && LR>6 && AL>6 && AM>6 && AR>6 && BL>6 && BM>6 && BR>6)
			break
		if UL<6
			UL+=processFlaxSeeds(ULx,ULy,UL)
		if UM<6
			UM+=processFlaxSeeds(UMx,UMy,UM)
		if UR<6
			UR+=processFlaxSeeds(URx,URy,UR)
		if ML<6
			ML+=processFlaxSeeds(MLx,MLy,ML)
		if MM<6
			MM+=processFlaxSeeds(MMx,MMy,MM)
		if MR<6
			MR+=processFlaxSeeds(MRx,MRy,MR)
		if LL<6
			LL+=processFlaxSeeds(LLx,LLy,LL)
		if LM<6
			LM+=processFlaxSeeds(LMx,LMy,LM)
		if LR<6
			LR+=processFlaxSeeds(LRx,LRy,LR)
		if AL<6
			AL+=processFlaxSeeds(ALx,ALy,AL)
		if AM<6
			AM+=processFlaxSeeds(AMx,AMy,AM)
		if AR<6
			AR+=processFlaxSeeds(ARx,ARy,AR)
		if BL<6
			BL+=processFlaxSeeds(BLx,BLy,BL)
		if BM<6
			BM+=processFlaxSeeds(BMx,BMy,BM)
		if BR<6
			BR+=processFlaxSeeds(BRx,BRy,BR)	
	}
	SoundPlay *1, 1
}