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.

Difference between revisions of "User:Cegaiel/Macros/PapyPicker/Code"

From ATITD6
Jump to navigationJump to search
(Created page with "<pre> ;This was created/tested in 1280x1024 resolution ;The script will search an area (square box around avatar's location) for the papy color (0xDBD401). It will right click ea...")
 
Line 1: Line 1:
 
<pre>
 
<pre>
 +
;Author: Cegaiel
 +
;Date: 9/16/2010
 +
;Last Update: 2/3/2012
 +
;Ctrl+R = Reload
 +
;Ctrl+P = Pause/Resume
 +
 +
 
;This was created/tested in 1280x1024 resolution
 
;This was created/tested in 1280x1024 resolution
;The script will search an area (square box around avatar's location) for the papy color (0xDBD401). It will right click each papy and gather.
+
;The script will search an area (square box around avatar's location) for the papy color (0xDBD401). It will right click  
 +
 
 +
each papy and gather.
 
;Script will automatically zoom in to my favorite zoom level, which I found to be best under most situations
 
;Script will automatically zoom in to my favorite zoom level, which I found to be best under most situations
  
  
 
;Explanation of Modes:
 
;Explanation of Modes:
;Automatic Mode: means that it is looking for papy, continuously and all the time, and will pick them if you are in range.
+
;Automatic Mode: means that it is looking for papy, continuously and all the time, and will pick them if you are in  
 +
 
 +
range.
  
 
;Manual Mode: means that it will not look until you press the F1 key. It will pick everything within range and stop.  
 
;Manual Mode: means that it will not look until you press the F1 key. It will pick everything within range and stop.  
 
;After stopping, it will wait for you to press the F1 key again and repeat.
 
;After stopping, it will wait for you to press the F1 key again and repeat.
  
;While Automatic seems more better, sometimes it is annoying. If it see a single papy in range and you have 5 more a couple coords away
+
;While Automatic seems more better, sometimes it is annoying. If it see a single papy in range and you have 5 more a  
;then it will pick the 1 first, and sometimes your avatar stops running. You might find yourself, clicking to keep running as much as if you picked the papy by hand.
+
 
;The benefit of Manual mode is you can run and stand in the center of a big papy patch, and have it gather them all at once. Then you are free to run to next patch
+
couple coords away
 +
;then it will pick the 1 first, and sometimes your avatar stops running. You might find yourself, clicking to keep  
 +
 
 +
running as much as if you picked the papy by hand.
 +
;The benefit of Manual mode is you can run and stand in the center of a big papy patch, and have it gather them all at  
 +
 
 +
once. Then you are free to run to next patch
 
;without your avatar stopping on single papys.
 
;without your avatar stopping on single papys.
  
Line 19: Line 36:
  
 
;The video settings I am using is:
 
;The video settings I am using is:
;Shadow Quality: 2nd checkbox (from left)
+
;Shadow Quality: 2nd checkbox (from left) - Should not matter
;Time of day lighting: 1st checkbox
+
;Time of day lighting: 1st checkbox - THIS WILL MATTER THE MOST
;Light Intensity: 3rd checkbox
+
;Light Intensity: 3rd checkbox - Should not matter, maybe a tiny bit.
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
; // CONFIGURE NOTES:
 +
 
 +
;Shades is a number between 0 and 255 (inclusive) to indicate the allowed number of shades of variation in either
 +
 
 +
direction for the intensity of the red, green, and blue components of the color.
 +
 
 +
;;The shades number is used in the Pixelsearch line represents how many shades away from color 0xDBD401 that it will
 +
 
 +
accept as a valid color.
 +
 
 +
;If you are having problems with in not clicking the papy, try raising that number 5 shades
 +
;If it is too sensitive and clicking on all kinds of stuff around you, then try lowering it 5 shades a time
 +
 
 +
;Also it is possible some video cards may show the papy color slightly different. If after changing your video settings
 +
 
 +
to match mine and it still does not work,
 +
;Then use my Get Mouse Position macro to find out what the color for you is and change the 0xDBD401 to match it.
 +
 
  
;Screenshot avail at http://www.atitd.org/wiki/tale4/User:Cegaiel/Macros/PapyPicker
+
;The upper left corner coords are 200,400 (TopLeftX,Y)
 +
;The bottom right corner is 1100,800 (BottomRightX,Y)
 +
;You can adjust as you see fit.
  
 +
;Use my Get Mouse Position macro to help you find the coords you want to use, if you need to...
  
;Ctrl+R = Reload
 
;Ctrl+P = Pause/Resume
 
  
  
;Author: Cegaiel
+
; // CONFIGURE HERE
;Date: 9/16/2010
 
;Last Update: 10/10/2010
 
  
 +
shades:="*10"
 +
color := "0xDBD401"
  
 +
TopLeftX  := 200
 +
TopLeftY  := 400
 +
BottomRightX := 1100
 +
BottomRightY := 800
  
 +
; // STOP HERE
  
  
Line 65: Line 113:
  
  
;This just simply sets the zoom level to what I felt was just right. It is not critical you can zoom in or out a couple times as you see fit.
+
;This just simply sets the zoom level to what I felt was just right. It is not critical you can zoom in or out a couple  
 +
 
 +
times as you see fit.
 
;The below is optional and can be removed...
 
;The below is optional and can be removed...
  
  
  
Msgbox, The screen will now zoom in, then back out to a descent zoom level in F6 mode!`n`nDon't move the mouse until you are given the Ready box, in a moment.
+
Msgbox, The screen will now zoom in, then back out to a descent zoom level in F6 mode!`n`nDon't move the mouse until you  
 +
 
 +
are given the Ready box, in a moment.
  
  
Line 107: Line 159:
 
if (Mode = "Automatic")
 
if (Mode = "Automatic")
 
{
 
{
Msgbox, Papy Picker now ready (Automatic Mode)!`n`nJust start running past pappy and it will automatically pick it via right click.`n`nCtrl+P to pause/resume, Ctrl+R to reload script
+
Msgbox, Papy Picker now ready (Automatic Mode)!`n`nJust start running past pappy and it will automatically pick it via  
 +
 
 +
right click.`n`nCtrl+P to pause/resume, Ctrl+R to reload script
 
Gosub, Automatic
 
Gosub, Automatic
 
} else {
 
} else {
Msgbox, Papy Picker now ready (Manual Mode)!`n`nRun to a patch of papy, stand in the middle of it and hit F1 to pick everything in range, via right click.`n`nCtrl+P to pause/resume, Ctrl+R to reload script
+
Msgbox, Papy Picker now ready (Manual Mode)!`n`nRun to a patch of papy, stand in the middle of it and hit Left Shift to  
 +
 
 +
pick everything in range, via right click.`n`nCtrl+P to pause/resume, Ctrl+R to reload script
 
Gosub, Manual
 
Gosub, Manual
 
}
 
}
Line 170: Line 226:
  
  
;The FindPapy subroutine, below searches for the color of pappy (0xDBD401) in a square box around the avatar
+
;The FindPapy subroutine, below searches for the color of pappy in a near the avatar
  
;The upper left corner coords are 200,400
 
;The bottom right corner is 1100,800
 
;You can adjust as you see fit.
 
  
;Use my Get Mouse Position macro to help you find the coords you want to use, if you need to...
 
  
  
 
;NOTE: The number 10 in the Pixelsearch line represents how many shades away from color 0xDBD401 that it will accept as a valid color
 
;If you are having problems with in not clicking the papy, try raising that number 5 shades
 
;If it is too sensitive and clicking on all kinds of stuff around you, then try lowering it 5 shades a time
 
 
;Also it is possible some video cards may show the papy color slightly different. If after changing your video settings to match mine and it still does not work,
 
;Then use my Get Mouse Position macro to find out what the color for you is and change the 0xDBD401 to match it.
 
  
  
 
FindPapy:
 
FindPapy:
PixelSearch, Px, Py, 200, 400, 1100, 800, 0xDBD401, 10, Fast|RGB
+
PixelSearch, Px, Py, %UpperLeftX% , %UpperLeftY%, %LowerRightX%, %LowerRightY%, %color%, %shades%, Fast|RGB
 
return
 
return
  

Revision as of 05:58, 3 February 2012

;Author: Cegaiel
;Date: 9/16/2010
;Last Update: 2/3/2012
;Ctrl+R = Reload
;Ctrl+P = Pause/Resume


;This was created/tested in 1280x1024 resolution
;The script will search an area (square box around avatar's location) for the papy color (0xDBD401). It will right click 

each papy and gather.
;Script will automatically zoom in to my favorite zoom level, which I found to be best under most situations


;Explanation of Modes:
;Automatic Mode: means that it is looking for papy, continuously and all the time, and will pick them if you are in 

range.

;Manual Mode: means that it will not look until you press the F1 key. It will pick everything within range and stop. 
;After stopping, it will wait for you to press the F1 key again and repeat.

;While Automatic seems more better, sometimes it is annoying. If it see a single papy in range and you have 5 more a 

couple coords away
;then it will pick the 1 first, and sometimes your avatar stops running. You might find yourself, clicking to keep 

running as much as if you picked the papy by hand.
;The benefit of Manual mode is you can run and stand in the center of a big papy patch, and have it gather them all at 

once. Then you are free to run to next patch
;without your avatar stopping on single papys.



;The video settings I am using is:
;Shadow Quality: 2nd checkbox (from left) - Should not matter
;Time of day lighting: 1st checkbox - THIS WILL MATTER THE MOST
;Light Intensity: 3rd checkbox - Should not matter, maybe a tiny bit.







; // CONFIGURE NOTES:

;Shades is a number between 0 and 255 (inclusive) to indicate the allowed number of shades of variation in either 

direction for the intensity of the red, green, and blue components of the color. 

;;The shades number is used in the Pixelsearch line represents how many shades away from color 0xDBD401 that it will 

accept as a valid color.

;If you are having problems with in not clicking the papy, try raising that number 5 shades
;If it is too sensitive and clicking on all kinds of stuff around you, then try lowering it 5 shades a time

;Also it is possible some video cards may show the papy color slightly different. If after changing your video settings 

to match mine and it still does not work,
;Then use my Get Mouse Position macro to find out what the color for you is and change the 0xDBD401 to match it.


;The upper left corner coords are 200,400 (TopLeftX,Y)
;The bottom right corner is 1100,800 (BottomRightX,Y)
;You can adjust as you see fit.

;Use my Get Mouse Position macro to help you find the coords you want to use, if you need to...



; // CONFIGURE HERE

shades:="*10"
color := "0xDBD401"

TopLeftX  := 200
TopLeftY  := 400
BottomRightX := 1100
BottomRightY := 800

; // STOP HERE






	; Wait for the window to become active, then get the window stats
	WinWait, eGenesis Client, 
	IfWinNotActive, eGenesis Client, , WinActivate, eGenesis Client, 
	WinWaitActive, eGenesis Client,
	WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos



	Gui, Add, Text,, Mode:
	Gui, Add, DropDownList, vMode Choose2, Automatic|Manual
	Gui, Add, Button, gStart, START
	Gui, Show
	return




Start:
WinActivate, eGenesis Client
	Gui, Submit



;This just simply sets the zoom level to what I felt was just right. It is not critical you can zoom in or out a couple 

times as you see fit.
;The below is optional and can be removed...



Msgbox, The screen will now zoom in, then back out to a descent zoom level in F6 mode!`n`nDon't move the mouse until you 

are given the Ready box, in a moment.


	Send {F6}

	Xcenter := Xmax//2 - 3
	Ycenter := Ymax//2 + 16
	MouseMove, Xcenter, Ycenter, 0


Loop, 32
{
		click, WU
		sleep 250
}

	MouseMove, Xcenter, Ycenter, 0


Loop, 16
{
		click, WD
		sleep 250
}



; End zooming


SetDefaultMouseSpeed,0
  SetMouseDelay,-1



if (Mode = "Automatic")
{
Msgbox, Papy Picker now ready (Automatic Mode)!`n`nJust start running past pappy and it will automatically pick it via 

right click.`n`nCtrl+P to pause/resume, Ctrl+R to reload script
Gosub, Automatic
} else {
Msgbox, Papy Picker now ready (Manual Mode)!`n`nRun to a patch of papy, stand in the middle of it and hit Left Shift to 

pick everything in range, via right click.`n`nCtrl+P to pause/resume, Ctrl+R to reload script
Gosub, Manual
}





Manual:
KeyWait, LShift, D


WinActivate, eGenesis Client


Loop 25
{

Gosub, FindPapy

if ErrorLevel = 0
{
NewX := Px + 2
NewY := Py + 5
MouseGetPos, OldX, OldY
Click Right %NewX%, %NewY%
MouseMove, %OldX%, %OldY%

Sleep 150
}
}

Gosub, Manual








Automatic:
Loop
{

Gosub, FindPapy

if ErrorLevel = 0
{
NewX := Px + 2
NewY := Py + 5
MouseGetPos, OldX, OldY
Click Right %NewX%, %NewY%
MouseMove, %OldX%, %OldY%
Sleep 150
}

}


;The FindPapy subroutine, below searches for the color of pappy in a near the avatar






FindPapy:
PixelSearch, Px, Py, %UpperLeftX% , %UpperLeftY%, %LowerRightX%, %LowerRightY%, %color%, %shades%, Fast|RGB
return


^r::reload
^p::Pause