I wrote a simple AI script which will automatically gamble Jewels. It seem harmless enough and it might be educational for some. It's good to learn, especially in a world where automation is the future and perhaps you can apply knowledge like this in real life.
What the script does:
-By following it's instructions it automatically opens and closes the gamble screen
-scans for a certain pixel color that only Jewels have and purchases it
-Fills the inventory full of Jewels.
-can be modified to purchase charms
You will need autoit, a windows programing tool that uses a general script language.
Also run D2 in windows mode.
https://www.autoitscript.com/site/autoit/Code:
#RequireAdmin
#include <MsgBoxConstants.au3>
HotKeySet("{ESC}", "Terminate")
HotKeySet("{g}", "Start")
HotKeySet("{1}", "Gheed")
HotKeySet("{2}", "Gamble")
WinActivate("Diablo II")
Local $ga, $gh
MsgBox($MB_SYSTEMMODAL, "Locate Coords", "Talk to a NPC that can gamble and do not move. Then issue coordinates by pressing 1 on NPC, and press 2 on the word 'Gamble.' Press 'G' to begin and press ESC to stop the script.")
While 1
Sleep(1000)
WEnd
Func Gheed()
$gh = MouseGetPos()
MsgBox($MB_SYSTEMMODAL, "Gheed's Location", $gh[0] & ", " & $gh[1])
EndFunc
Func Gamble()
$ga = MouseGetPos()
MsgBox($MB_SYSTEMMODAL, "Gamble Location:", $ga[0] & ", " & $ga[1])
EndFunc
Func Start()
Local $hWnd = WinWait("Diablo II", "", 10)
Local $aClientSize = WinGetClientSize($hWnd)
For $b = 1 to 100
mouseClick("right", $ga[0], $ga[1], 1)
sleep(500)
$pt = PixelSearch( (@DeskTopWidth-$aClientSize[0])/2, (@DeskTopHeight-$aClientSize[1])/2, @DeskTopWidth/2, @DeskTopHeight-($aClientSize[1]/2), 0xc043fe, 0)
While @error = 0
mousemove($pt[0], $pt[1], 0)
mousedown("right")
mouseup("right")
sleep(510)
$pt = PixelSearch( (@DeskTopWidth-$aClientSize[0])/2, (@DeskTopHeight-$aClientSize[1])/2, @DeskTopWidth/2, @DeskTopHeight-($aClientSize[1]/2), 0xc043fe, 0)
WEnd
sleep(75)
Send("{Space 1}")
sleep(125)
mousemove($gh[0], $gh[1], 1)
sleep(125)
mousedown("left")
mouseup("left")
sleep(200)
next
EndFunc
Func Terminate()
Exit
EndFunc
Save this code as a .au3 file and double click it while your char is in a game.