Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

D3 AHK potion/gold farm bot


  • Please log in to reply
66 replies to this topic
LVieira
  • Members
  • 12 posts
  • Last active: Jun 06 2012 07:15 AM
  • Joined: 06 Jun 2012
Well, I dont know what's going on, because i use the same variance of yours
but it still never finds any items

girlgamer
  • Moderators
  • 3263 posts
  • Last active: Feb 01 2015 09:49 AM
  • Joined: 04 Jun 2010
You might also want to look into MWSnap athttp://www.mirekw.co...are/mwsnap.html. That's also pretty handy.

The universe is a wondrous place! The faster you create unbreakable code, the faster the universe creates people that can break it. All scripting follows the rule Rule Of Twos -- 1) Good, 2) Fast 3) Cheap -- pick any Two.
I guarantee absolutely nothing about any code I provide except that it works in my machine. ●
MMO Fighter   KeyLooperDemo   Key Spammer   TinyClickRecorder  GGs Password Generator.ahk
For the newest version of AutoHotkey and some killer scripts go here.
Rock-on%20kitten.gif


LVieira
  • Members
  • 12 posts
  • Last active: Jun 06 2012 07:15 AM
  • Joined: 06 Jun 2012
how do I download your png file?

girlgamer
  • Moderators
  • 3263 posts
  • Last active: Feb 01 2015 09:49 AM
  • Joined: 04 Jun 2010
He listed his png on the previous page of this thread. But, he did qualify that it will only work in the specified screen resolution. You may have to build your own png for the video system you currently have. That's the trouble with trying to rely on someone else's scripts for screen locations and colors. But he did describe his method for creating the image he used.

The universe is a wondrous place! The faster you create unbreakable code, the faster the universe creates people that can break it. All scripting follows the rule Rule Of Twos -- 1) Good, 2) Fast 3) Cheap -- pick any Two.
I guarantee absolutely nothing about any code I provide except that it works in my machine. ●
MMO Fighter   KeyLooperDemo   Key Spammer   TinyClickRecorder  GGs Password Generator.ahk
For the newest version of AutoHotkey and some killer scripts go here.
Rock-on%20kitten.gif


Diablo3Gamer
  • Guests
  • Last active:
  • Joined: --
I might be a fool for asking this but how exactly would you run this script? Is there a way to open up a console for diablo 3? I'm very interested in learning how this is done so I can perhaps make my own script in the future.

Cheers,
Fellow Gamer.

randallf
  • Members
  • 711 posts
  • Last active: Jan 07 2014 11:45 PM
  • Joined: 06 Jul 2009
Install AHK
Copy
Paste
Follow instructions
Profit

randallf
  • Members
  • 711 posts
  • Last active: Jan 07 2014 11:45 PM
  • Joined: 06 Jul 2009

He listed his png on the previous page of this thread. But, he did qualify that it will only work in the specified screen resolution. You may have to build your own png for the video system you currently have. That's the trouble with trying to rely on someone else's scripts for screen locations and colors. But he did describe his method for creating the image he used.


You only need the PNG for detecting gems and even then it is only flawless gems. If the pixel detection doesn't work it's either your screen resolution or you will have to double check the colors on your own system or play with the tolerance like I stated. Using the tolerance that i used won't necessarily work for you as there are potentially differences in pixel shades that I cannot anticipate (gamma setting will mess it up for one) so you'll have to find the right colors.

If all of your settings were exactly the same as mine then this script should work for you.
If not, you will have to adjust the code.

It's not very good code either, it did work for me though. It could be so much better.

girlgamer
  • Moderators
  • 3263 posts
  • Last active: Feb 01 2015 09:49 AM
  • Joined: 04 Jun 2010
@D3Gamer. you said

I might be a fool for asking this but how exactly would you run this script? Is there a way to open up a console for diablo 3? I'm very interested in learning how this is done so I can perhaps make my own script in the future.


I don't know what experience you have had with programming but the process involves
[*:26umv1xi] download and install AutoHotkey from the website. Either Basic or L will work but L is the most current version. Basic is no longer being maintained.
[*:26umv1xi]download and install a good programmer's editor like SciTEAutoHotkey or Notepad++ or some other editor that gives you syntax checking, a run/debug mode, and syntax highlighting
[*:26umv1xi]create links to the help files, tutorials, faqs, and any threads that you find interesting.
[*:26umv1xi]download some simple script samples that you can play with, modify, test and run to help you understand how AutoHotkey works and how scripts are built.
[*:26umv1xi]haunt the forums for any subjects that pique your interest and try to disassemble the code to see how it works.
[*:26umv1xi]have fun with it.

The universe is a wondrous place! The faster you create unbreakable code, the faster the universe creates people that can break it. All scripting follows the rule Rule Of Twos -- 1) Good, 2) Fast 3) Cheap -- pick any Two.
I guarantee absolutely nothing about any code I provide except that it works in my machine. ●
MMO Fighter   KeyLooperDemo   Key Spammer   TinyClickRecorder  GGs Password Generator.ahk
For the newest version of AutoHotkey and some killer scripts go here.
Rock-on%20kitten.gif


LVieira
  • Members
  • 12 posts
  • Last active: Jun 06 2012 07:15 AM
  • Joined: 06 Jun 2012
Well, I've been programming for some years now and I was having some troubles with this code (I never played with autohotkey before)
So I decided to basically rebuild your code from scratch with some differences and some upgrades. (Not that your code was bad or something I just wanted to make my own and maybe share here)

What I've come to right now is a code that does the same thing as yours but at the resolution of 1920 x 1080 (I would make it available for any 16:9 resolution but I just dont have the time to do it right now), also now it checks if there is a chest by the blue glow that appears when the mouse is over the position, so if there is no chest it just moves the mouse to both positions and leaves, it doesnt move around trying to find, it will only click if it finds the glow, this makes each run a bit faster. Also I added some moving around (5 random clicks) on the position close to the chest after u get blues, just to make sure you get anything that could possibly be around it (at least most of the things, the most important being gold).

And now it doesnt check for blues on the inventory to sell what it does is it clicks on every slot of the inventory after the given column. So if you change it to 3 it will click every block of the inventory from the 3rd column on. That helps a lot with the tomes and jewels and even yellows/legendaries, because I was having trouble selecting a color and a variance that would only click blues, and click all blues besides tome of secrets and maybe the purple of the amethyst. I just couldnt find, so now what I do is:
I setup my inventory like it is on the picture attached, and those spots wont be touched when selling, and I wont sell yellows or legendaries because I can't identify them with the npc window open.

So, enough talk, and lets show some code:

WinActivate, Diablo III



ChestFound = 0

ItemFound = 0	



MainFunctionHiddenCellar(20)



F5::

Exitapp



F6::

Pause





; ///////////////////////////////////////////////////////////////////////

; END OF MAIN CODE, START OF FUNCTIONS

; ///////////////////////////////////////////////////////////////////////





MainFunctionHiddenCellar(x)

{

	Loop, 99999

	{

		Global ChestFound

		Global ItemFound

		ChestFound = 0

		ItemFound = 0



		sleep 2000

		MouseMove, 200, 410, 1 ;resume game

		sleep 100

		Click

		sleep 4000



		MouseMove, 1416, 621, 5 ;first move

		Click

		Sleep 1500



		MouseMove, 1483, 302, 5 ;second move

		Click

		Sleep, 2000



		MouseMove, 1420, 290, 5 ;cauldron

		Click

		Sleep, 2000



		MouseMove, 1000, 473, 5 ;potion

		Click

		Sleep, 1500



		MouseMove, 970, 300, 5 ;Position to check chests

		Click

		Sleep, 1500



		Global ChestFound

		Global ItemFound



		CheckIfChestExists(945, 93, 200, 150, 15)

		If ChestFound = 0       

		{

			CheckIfChestExists(1490, 435, 200, 150, 10)

		} 



		If ChestFound = 1

		{

	   		;Checks for Items on the ground 

	  		Loop, 5

	   		{

	   		    ItemPickup(500, 200, 1200, 800)

			}



			; Moves around to grab gold and white items on floor (works perfectly with 7 radius pickup, havent checked with less)

			MouseMove, 980, 560, 10

			Click

			Sleep, 50



			MouseMove, 940, 550, 10

			Click

			Sleep, 50



			MouseMove, 975, 505, 10

			Click

			Sleep, 50



			MouseMove, 940, 495, 10

			Click

			Sleep, 50



			MouseMove, 975, 500, 10

			Click

			Sleep, 50

		}



		Teleport()



		;Will run the program x times before it sells the items

		If !(Mod(A_INDEX, x))

		{

			MouseMove, 1800, 100, 10

			Click

			Sleep, 3500



			MouseMove, 980, 100, 10

			Click

			Sleep, 4000



			SellItem(3)



			Sleep, 100

			Send, {Esc}

		}



		LeaveGame()

	}

}



Teleport()

{

	Send, {t}

	Sleep, 7000

}



LeaveGame()

{

	Sleep, 100

	Send, {Esc}

	Sleep, 100



	MouseMove, 820, 583

	Sleep, 100

	Click

	MouseMove, 50, 50

	Sleep, 4000

}



CheckIfChestExists(x, y, varX, varY, varC)

{

	x1 = 0

	x2 = 0

	y1 = 0

	y2 = 0



	If x < varX + 1 

	{

		x1 = 1

		x2 := x + varX

	}

	Else 

	{

		If x > 1919 - varX

		{

			x1 := x - varX

			x2 = 1919

		}

		Else 

		{

			x1 := x - varX

			x2 := x + varX

		}

	}



	If y < varY + 1 

	{

		y1 = 1

		y2 := y + varY

	}

	Else 

	{

		If y > 1079 - vary

		{

			y1 := y - varY	

			y2 = 1079

		}

		Else 

		{

			y1 := y - varY

			y2 := y + varY

		}

	}



	Global ChestFound

	MouseMove, %x%, %y%

	Sleep 300

	PixelSearch, xloc, yloc, x1, y1, x2, y2, 0xA37758, varC, Fast

	If !ErrorLevel

	{

		ChestFound := 1

		Click

		Sleep, 3000

	}

}





ItemPickup(xa, ya, xb, yb)

{

	Global ItemFound



	PixelSearch, xloc, yloc, %xa%, %ya%, %xb%, %yb%, 0x2F64BF, 2, Fast ;Legendary Items

	If !ErrorLevel

	{

		ItemFound := 1

		MouseMove, %xloc%, %yloc%, 5

		Click

		Sleep, 500

	}



	PixelSearch, xloc, yloc, %xa%, %ya%, %xb%, %yb%, 0x00FFFF, 2, Fast ;Rare Items

	If !ErrorLevel

	{

		ItemFound := 1

		MouseMove, %xloc%, %yloc%, 5

		Click

		Sleep, 500

	}



	PixelSearch, xloc, yloc, %xa%, %ya%, %xb%, %yb%, 0xFF6969, 20, Fast ;Magic Items

	If !ErrorLevel

	{

		ItemFound := 1

		MouseMove, %xloc%, %yloc%, 5

		Click

		Sleep, 500

	}

}





SellItem(column)

{

	i = 0

	var = 49

	startY = 608

	startX = 1434

	actualX = 0

	actualY = 0

	

	i := column

	while i < 10

	{

		actualX := (startX + (var * i))



		actualY := startY
		MouseMove, %actualX%, %actualY%

		Click Right

		Sleep, 10



		actualY := actualY + var

		MouseMove, %actualX%, %actualY%

		Click Right

		Sleep, 10



		actualY := actualY + var

		MouseMove, %actualX%, %actualY%

		Click Right

		Sleep, 10



		actualY := actualY + var

		MouseMove, %actualX%, %actualY%

		Click Right

		Sleep, 10



		actualY := actualY + var

		MouseMove, %actualX%, %actualY%

		Click Right

		Sleep, 10



		actualY := actualY + var

		MouseMove, %actualX%, %actualY%

		Click Right

		Sleep, 10

	

		i++

	}

}

Edit: OMG The code here on the forum got so bad indented an bunch of white lines, it looks a lot better on my gedit.
Edit2: The code had some errors so I fixed it, to read about the errors go some posts down

girlgamer
  • Moderators
  • 3263 posts
  • Last active: Feb 01 2015 09:49 AM
  • Joined: 04 Jun 2010
Nice thinking on using the glow to detect the item. Harvesting in AION has nodes that cycle colors and progress boxes that pop up when you click on a node. and, there can be from 1 to 5 potential harvests off one node. That was an interesting scripting exercise. And the "positioning the items in inventory first" idea is a handy way to overcome the restrictions on what to sell and what not to sell. That's good work.

The universe is a wondrous place! The faster you create unbreakable code, the faster the universe creates people that can break it. All scripting follows the rule Rule Of Twos -- 1) Good, 2) Fast 3) Cheap -- pick any Two.
I guarantee absolutely nothing about any code I provide except that it works in my machine. ●
MMO Fighter   KeyLooperDemo   Key Spammer   TinyClickRecorder  GGs Password Generator.ahk
For the newest version of AutoHotkey and some killer scripts go here.
Rock-on%20kitten.gif


LVieira
  • Members
  • 12 posts
  • Last active: Jun 06 2012 07:15 AM
  • Joined: 06 Jun 2012
Thank you.
I spent some good hours thinking on this, and I might use this as base for some other scripts now that I already have some base functions.
If you have any other tips/ideas tell me and I'll try to add them as soon as possible and post here.

girlgamer
  • Moderators
  • 3263 posts
  • Last active: Feb 01 2015 09:49 AM
  • Joined: 04 Jun 2010
There are several tricks i use in my development effort.
[*:31c7ec7n]I build in debugging commands with hotkeys at the end of my prototypes. Here's an example
!Esc::
GuiClose:
	ExitApp

; debugging hotkeys
!F7::KeyHistory
!F8::ListHotkeys
!F9::Pause
!F10::ListVars
!F11::ListLines
!F12::Reload
[*:31c7ec7n]I also set up common support utilities in the prototype with stuff like
[*:31c7ec7n]a simple screen location/color grabber that puts data on the clipboard for pasting into a text file or into the script itself. That way i can alter the pixel routine's data on the fly as I'm coding.
;------------------------------------------------
; a simple screen location and color grabber for
; use in mmo's to grab important locations
; copies the x,y coordinates and the color at that
; location to the clipboard. Use paste or Ctrl-V
; to insert the color into a script or text file.
; this can be used for finding click locations,
; health and mana bar colors, on screen ui elements
; etc.
XButton2::
DoFastGrab:
	MouseGetPos, oposx, oposy
	Sleep 300
	PixelGetColor, grabcolor, %oposx%, %oposy%, RGB
	Sleep 300
	Clipboard = %oposx%,%oposy%,%grabcolor%
	ClipWait
	Soundbeep,750
	SoundBeep,750
	Return
[*:31c7ec7n]and usually a little utility routine that scans through my source code to show me what hotkeys I've used in the script.
;------------------------------------------------
; build hotkey help file
;------------------------------------------------
!h::
ShowHotkeyHelp:
	splitpath, A_Scriptname,,,, oname,
	HelpFile = %oname%Help.txt
	IfWinExist, %HelpFile%
	{	WinClose, %Helpfile%
		WinWaitclose, %HelpFile%
	}
	
	IfExist, %HelpFile%
		FileDelete, %HelpFile%
		
	Loop
	{	fileReadline, thisline, %A_ScriptName%, %A_Index%
		;Msgbox,0,Line#%A_LineNumber%, Reading line=%A_Index% data=%thisline%
		If ErrorLevel
			Break
		
		; Ignore test lines
		IfInString, thisline, IfInString
			continue
			
		;....................	
		; process rem comments
		;IfInString, thisline, %beginBlockComment%
		IfInString, thisline, /*
		{	InComment = 1	
			;MsgBox,0,Line#%A_lineNumber%,Found block comment start at line %A_Index%
			Continue
		}
		;IfInString, thisline, %endBlockComment%
		IfInString, thisline, */
		{	InComment = 0	
			;MsgBox,0,Line#%A_lineNumber%,Found block comment end at line %A_Index%
			Continue
		}
		; process single line comment statement
		IfInString, thisline, `;
			Continue
		; handle a line within a block comment
		If (InComment = 1)
			Continue
		;....................
		; process hotkey line	
		IfInString, thisline, ::
		{	;IfInstring, thisline, IfInString
			;	continue
			FileAppend, `nLine# %A_Index% Hotkey= %thisline%`n, %HelpFile%
			Continue
		}
		
		; process label line this makes the assumption that a label
		; is the only item on the line
		StringRight, ch, thisline, 1
		{	If (ch = ":")
			{	FileAppend, `tLine# %A_Index% Label= %thisline%`n, %Helpfile%
			}
		}
		
	}	
	Run, Notepad %HelpFile%
	Return
[*:31c7ec7n]occasionally i'll use an ini file to store common data items that can be reloaded on the fly without having to stop and restart the script. A kind of just-in-time data management thing.
[*:31c7ec7n]often i'll preload the Window's notepad to take notes with the script so i can make notes during coding as ideas come to me. and the calculator for number conversions.
[*:31c7ec7n]since i use screen clips now and then I build in a hotkey to run the Vista Snipping tool so i can grab whole screen images too with links to Gimp as well.
[*:31c7ec7n]using the Splitpath command and A_ScriptName i can recreate a new file with a different name much more easily and have the new script automatically adjust to any ini files i might want to use since the system usuallly has the same base name for all files. you can see that at work in the listing for the help hotkey. [/list]
A lot of the fluff gets stripped out after the script is complete but the prototypes usually have all of that stuff ready for the next project.

I'm sure you can come up with ideas of your own as well. Prototype scripts, modules. function libraries. lots of different ways to manage the code development process. These are just some ideas for you to consider.

The universe is a wondrous place! The faster you create unbreakable code, the faster the universe creates people that can break it. All scripting follows the rule Rule Of Twos -- 1) Good, 2) Fast 3) Cheap -- pick any Two.
I guarantee absolutely nothing about any code I provide except that it works in my machine. ●
MMO Fighter   KeyLooperDemo   Key Spammer   TinyClickRecorder  GGs Password Generator.ahk
For the newest version of AutoHotkey and some killer scripts go here.
Rock-on%20kitten.gif


Wingfat
  • Members
  • 937 posts
  • Last active: Oct 14 2015 04:20 PM
  • Joined: 23 Aug 2004
WOW! I so can not wait to get off work and get home to try this out.. hmm maybe i'll take a long lunch today hehehe.
thanks for your great work on this.
----------------------------
Wingfool you fat! I mean, Wingfat you fool!
Line from Woody Allen's movie "What's Up Tiger Lilly?"
-----------------------------

  • Guests
  • Last active:
  • Joined: --
randalf, i have a question.

regarding the scanning for a color, does it scan just that specific area within "x" radius of the mouse location or does it scan the entire screen and then go over to that location to pick it up?

i just want to better understand the mechanics of scanning for yellow, green, gold and blue items

LVieira
  • Members
  • 12 posts
  • Last active: Jun 06 2012 07:15 AM
  • Joined: 06 Jun 2012
Hey, I just realized the code I posted here is probably not working, so here is the real code that you should have to try.
I also made some changes on the timing and some positions to click, so that I could make it stop having random and really weird runs sometimes, and also increasing efficiency.
(I also changed on my previous post just to make sure anyone that gets the code gets the right one)

WinActivate, Diablo III



ChestFound = 0

ItemFound = 0	



MainFunctionHiddenCellar(20)



F5::

Exitapp



F6::

Pause





; ///////////////////////////////////////////////////////////////////////

; END OF MAIN CODE, START OF FUNCTIONS

; ///////////////////////////////////////////////////////////////////////





MainFunctionHiddenCellar(x)

{

	Loop, 99999

	{

		Global ChestFound

		Global ItemFound

		ChestFound = 0

		ItemFound = 0



		sleep 2000

		MouseMove, 200, 410, 1 ;resume game

		sleep 100

		Click

		sleep 4000



		MouseMove, 1416, 621, 5 ;first move

		Click

		Sleep 1500



		MouseMove, 1483, 302, 5 ;second move

		Click

		Sleep, 2000



		MouseMove, 1420, 290, 5 ;cauldron

		Click

		Sleep, 2000



		MouseMove, 1000, 473, 5 ;potion

		Click

		Sleep, 1500



		MouseMove, 970, 300, 5 ;Position to check chests

		Click

		Sleep, 1500



		Global ChestFound

		Global ItemFound



		CheckIfChestExists(945, 93, 200, 150, 15)

		If ChestFound = 0       

		{

			CheckIfChestExists(1490, 435, 200, 150, 10)

		} 



		If ChestFound = 1

		{

	   		;Checks for Items on the ground 

	  		Loop, 5

	   		{

	   		    ItemPickup(500, 200, 1200, 800)

			}



			; Moves around to grab gold and white items on floor (works perfectly with 7 radius pickup, havent checked with less)

			MouseMove, 980, 560, 10

			Click

			Sleep, 50



			MouseMove, 940, 550, 10

			Click

			Sleep, 50



			MouseMove, 975, 505, 10

			Click

			Sleep, 50



			MouseMove, 940, 495, 10

			Click

			Sleep, 50



			MouseMove, 975, 500, 10

			Click

			Sleep, 50

		}



		Teleport()



		;Will run the program x times before it sells the items

		If !(Mod(A_INDEX, x))

		{

			MouseMove, 1800, 100, 10

			Click

			Sleep, 3500



			MouseMove, 980, 100, 10

			Click

			Sleep, 4000



			SellItem(3)



			Sleep, 100

			Send, {Esc}

		}



		LeaveGame()

	}

}



Teleport()

{

	Send, {t}

	Sleep, 7000

}



LeaveGame()

{

	Sleep, 100

	Send, {Esc}

	Sleep, 100



	MouseMove, 820, 583

	Sleep, 100

	Click

	MouseMove, 50, 50

	Sleep, 4000

}



CheckIfChestExists(x, y, varX, varY, varC)

{

	x1 = 0

	x2 = 0

	y1 = 0

	y2 = 0



	If x < varX + 1 

	{

		x1 = 1

		x2 := x + varX

	}

	Else 

	{

		If x > 1919 - varX

		{

			x1 := x - varX

			x2 = 1919

		}

		Else 

		{

			x1 := x - varX

			x2 := x + varX

		}

	}



	If y < varY + 1 

	{

		y1 = 1

		y2 := y + varY

	}

	Else 

	{

		If y > 1079 - vary

		{

			y1 := y - varY	

			y2 = 1079

		}

		Else 

		{

			y1 := y - varY

			y2 := y + varY

		}

	}



	Global ChestFound

	MouseMove, %x%, %y%

	Sleep 300

	PixelSearch, xloc, yloc, x1, y1, x2, y2, 0xA37758, varC, Fast

	If !ErrorLevel

	{

		ChestFound := 1

		Click

		Sleep, 3000

	}

}





ItemPickup(xa, ya, xb, yb)

{

	Global ItemFound



	PixelSearch, xloc, yloc, %xa%, %ya%, %xb%, %yb%, 0x2F64BF, 2, Fast ;Legendary Items

	If !ErrorLevel

	{

		ItemFound := 1

		MouseMove, %xloc%, %yloc%, 5

		Click

		Sleep, 500

	}



	PixelSearch, xloc, yloc, %xa%, %ya%, %xb%, %yb%, 0x00FFFF, 2, Fast ;Rare Items

	If !ErrorLevel

	{

		ItemFound := 1

		MouseMove, %xloc%, %yloc%, 5

		Click

		Sleep, 500

	}



	PixelSearch, xloc, yloc, %xa%, %ya%, %xb%, %yb%, 0xFF6969, 20, Fast ;Magic Items

	If !ErrorLevel

	{

		ItemFound := 1

		MouseMove, %xloc%, %yloc%, 5

		Click

		Sleep, 500

	}

}





SellItem(column)

{

	i = 0

	var = 49

	startY = 608

	startX = 1434

	actualX = 0

	actualY = 0

	

	i := column

	while i < 10

	{

		actualX := (startX + (var * i))



		actualY := startY
		MouseMove, %actualX%, %actualY%

		Click Right

		Sleep, 10



		actualY := actualY + var

		MouseMove, %actualX%, %actualY%

		Click Right

		Sleep, 10



		actualY := actualY + var

		MouseMove, %actualX%, %actualY%

		Click Right

		Sleep, 10



		actualY := actualY + var

		MouseMove, %actualX%, %actualY%

		Click Right

		Sleep, 10



		actualY := actualY + var

		MouseMove, %actualX%, %actualY%

		Click Right

		Sleep, 10



		actualY := actualY + var

		MouseMove, %actualX%, %actualY%

		Click Right

		Sleep, 10

	

		i++

	}

}