Sign in to follow this  
Followers 0
Bounda

Help Shorten My Script

5 posts in this topic

#1 ·  Posted (edited)

This was a script i made for a bot also created in autoit, for diablo ii. I need help making this much smaller, and less error prone. Please help! Ini not included x . x (have fun reading this!)

;=================================================
;The One, The Only, The Muler Script!
;Created by Bounda
;No support for greys or whties
;No support for R/D Or c/i
;=================================================
;VERSION BETA .01
;=================================================

opt("PixelCoordMode", 0)
opt("MouseCoordMode", 0)
opt("ColorMode", 1)
WinActivate("Diablo II")
$slot = iniread("mule.ini", "main", "Mule_Character_Slot", "1")
$items = iniread("mule.ini", "main", "Mule_Item_Amount", "5")
$dir = iniread("mule.ini", "main", "bot_dir", "C:/Program Files/mm.BOT/mm.BOT/Logs/_Stats.ini")
$stashed = iniread($dir, "mm.BOT 5.xx GLOBAL STATISTICS", "Total_Stashed", "1")
$game = iniread("mule.ini", "main", "Game_Name", "blaHBLAH")
$pass = iniread("mule.ini", "main", "Game_pass", "blaHBLAH")
$once = iniread("mule.ini", "main", "Muled_Once", "No")

If $slot = 1 Then
   $slotx = 192
   $sloty = 152
ElseIf $slot = 2 Then
   $slotx = 436
   $sloty = 163
Elseif $slot = 3 Then
   $slotx = 169
   $sloty = 250
Elseif $slot = 4 Then
   $slotx = 436
   $sloty = 256
ElseIf $slot = 5 Then
   $slotx = 163
   $sloty = 340
ElseIf $slot = 6 Then
   $slotx = 426
   $sloty = 329
EndIf

sleep(500)
Send("{ESC}")
Sleep(500)
Mouseclick("left", 369, 287)
Sleep(1000)
MouseClick("Left", 597, 489)
Sleep(500)
Send($game)
Sleep(500)
Send("{Tab}")
Sleep(500)
Send($pass)
Sleep(500)
Send("{ENTER}")
Sleep(25000)
$startpix = Pixelgetcolor(250, 200)

If $stashed = $items Then
      _Mule()
   ElseIf $Stashed > $items Then
      _Mule()
   ElseIf $Stashed < $items Then
      Exit
EndIf

Func _Mule()
   Local $pix2, $pix3, $pix4, $pix5, $pix6, $pix7, $pix8, $pix9, $pix10, $pix11, $pix12, $pix13, $pix14, $pix15, $pix16, $pix17, $pix18, $pix19, $pix20, $pix21, $pix22, $pix23, $pix24, $pix25, $pix26, $pix27, $pix18, $pix29, $pix30
If WinActive("Diablo II") Then
   WinActivate("Diablo II")
Else
Exit
EndIf

If $once = "Yes" Then
   Exit
Endif

If $startpix = 65304 Then
   MouseClick("left", 250, 481)
   Sleep(2000)
   MouseClick("left", 200, 427)
   Sleep(2000)
   MouseClick("left", 326, 469)
   Sleep(2000)
Else
Exit
EndIf
   $right = PixelSearch(450, 155, 715, 464, 65304)
   If Not @Error then
   MouseClick("left", $right[0] + 69, $right[1] + 78)
   Sleep(2000)
EndIf
$stashrel2 = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel2[0] + 69, $stashrel2[1] + 78)
EndIf

Sleep(350000)

$pix3 = pixelgetcolor(177, 183)

If $pix3 <> 1024 Then
   MouseClick("Left", 180, 189, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(400)
   MouseClick("Left")
   sleep(400)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix4 = pixelgetcolor(175, 213)

If $pix4 <> 1024 Then
   MouseClick("Left", 175, 213, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

sleep(500)
$pix5 = pixelgetcolor(164, 241)

If $pix5 <> 1024 Then
   MouseClick("Left", 165, 244, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(500)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix6 = pixelgetcolor(173, 274)

If $pix6 <> 1024 Then
   MouseClick("Left", 173, 274, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix7 = pixelgetcolor(173, 303)

If $pix7 <> 1024 Then
   MouseClick("Left", 173, 303, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix8 = pixelgetcolor(173, 327)

If $pix8 <> 1024 Then
   MouseClick("Left", 171, 330, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix9 = pixelgetcolor(199, 185)

If $pix9 <> 1024 Then
   MouseClick("Left", 199, 185, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix10 = pixelgetcolor(199, 220)

If $pix10 <> 1024 Then
   MouseClick("Left", 199, 220, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix11 = pixelgetcolor(199, 248)

If $pix11 <> 1024 Then
   MouseClick("Left", 199, 248, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix12 = pixelgetcolor(199, 277)

If $pix12 <> 1024 Then
   MouseClick("Left", 199, 277, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix13 = pixelgetcolor(205, 307)

If $pix13 <> 1024 Then
   MouseClick("Left", 205, 307, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix14 = pixelgetcolor(194, 324)

If $pix14 <> 1024 Then
   MouseClick("Left", 194, 324, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix15 = pixelgetcolor(231, 183)

If $pix15 <> 1024 Then
   MouseClick("Left", 231, 186, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix16 = pixelgetcolor(223, 209)

If $pix16 <> 1024 Then
   MouseClick("Left", 223, 212, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix17 = pixelgetcolor(234, 242)

If $pix17 <> 1024 Then
   MouseClick("Left", 234, 242, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix18 = pixelgetcolor(230, 270)

If $pix18 <> 1024 Then
   MouseClick("Left", 230, 270, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix19 = pixelgetcolor(227, 300)

If $pix19 <> 1024 Then
   MouseClick("Left", 227, 300, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix20 = pixelgetcolor(228, 330)

If $pix20 <> 1024 Then
   MouseClick("Left", 228, 330, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix21 = pixelgetcolor(229, 362)

If $pix21 <> 1024 Then
   MouseClick("Left", 229, 362, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix22 = pixelgetcolor(229, 385)

If $pix22 <> 1024 Then
   MouseClick("Left", 229, 385, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix23 = pixelgetcolor(260, 182)

If $pix23 <> 1024 Then
   MouseClick("Left", 260, 182, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix24 = pixelgetcolor(257, 209)

If $pix24 <> 1024 Then
   MouseClick("Left", 257, 209, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix25 = pixelgetcolor(257, 246)

If $pix25 <> 1024 Then
   MouseClick("Left", 257, 246, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix26 = pixelgetcolor(250, 266)

If $pix26 <> 1024 Then
   MouseClick("Left", 250, 266, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix27 = pixelgetcolor(259, 295)

If $pix27 <> 1024 Then
   MouseClick("Left", 259, 295, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix28 = pixelgetcolor(265, 329)

If $pix28 <> 1024 Then
   MouseClick("Left", 265, 329, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix29 = pixelgetcolor(258, 353)

If $pix29 <> 1024 Then
   MouseClick("Left", 258, 353, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

$pix30 = pixelgetcolor(253, 292)

If $pix30 <> 1024 Then
   MouseClick("Left", 253, 292, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(300)
   MouseClick("Left")
   sleep(300)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

Sleep(1000)
Send("{ESC}")
Sleep(500)
Send("{ESC}")
Sleep(500)
Mouseclick("left", 369, 287)
Sleep(2000)
MouseClick("Left", 752, 512)
Sleep(1500)
Mouseclick("Left", $slotx, $sloty)
Sleep(500)
Send("{Enter}")
Sleep(1000)
MouseClick("Left", 720, 488)
Sleep(500)
Send($game)
Sleep(500)
Send("{Tab}")
Sleep(500)
Send($pass)
Sleep(25000)
$start2 = pixelgetcolor(260, 185)
If $start2 = $startpix Then
   Sleep(500)
   Mouseclick("Left", 258, 464)
   Sleep(2000)
   Mouseclick("Left", 210, 415)
   Sleep(2000)
   Mouseclick("Left", 328, 477)
   Sleep(2000)
Else
Sleep(5000)
MouseClick("Left", 720, 488)
Sleep(500)
Send("lil1")
Sleep(500)
Send("{Tab}")
Sleep(500)
Send("1")
Sleep(2500)
If $start2 = $startpix Then
   Sleep(500)
   Mouseclick("Left", 258, 464)
   Sleep(2000)
   Mouseclick("Left", 210, 415)
   Sleep(2000)
   Mouseclick("Left", 328, 477)
   Sleep(2000)
EndIf
Endif

Send("{Alt Down}")
Sleep(500)

Do
$pickitup = PixelSearch(455, 196, 759, 480, 16720037)
If Not @error then
Mouseclick("Left", $pickitup[0], $pickitup[1] + 5)
Sleep(1000)
Endif
Until  Not IsArray($pickitup)

Do
$pickitup = PixelSearch(300, 150, 250, 350, 16720037)
If Not @error then
Mouseclick("Left", $pickitup[0], $pickitup[1] + 5)
Sleep(1000)
Endif
Until  Not IsArray($pickitup)

Send("{Alt Up}")
Sleep(500)

IniWrite("mule.ini", "Main", "Muled_Once", "Yes")

EndFunc
Edited by Bounda

Share this post


Link to post
Share on other sites



Just wondering, why do you need a shorter script?

Share this post


Link to post
Share on other sites

Im assuming you cant use the ControlClick/ControlSend function since its diablo ii right? That would be the quickest way to shorten it. As for error checking, all i can really see that you havent done yet is checking to make sure IniRead and IniWrite complete successfully.


_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Share this post


Link to post
Share on other sites

This was a script i made for a bot also created in autoit, for diablo ii. I need help making this much smaller, and less error prone. Please help! Ini not included x . x (have fun reading this!)

CODE
;=================================================

;The One, The Only, The Muler Script!

;Created by Bounda

;No support for greys or whties

;No support for R/D Or c/i

;=================================================

;VERSION BETA .01

;=================================================

opt("PixelCoordMode", 0)

opt("MouseCoordMode", 0)

opt("ColorMode", 1)

WinActivate("Diablo II")

$slot = iniread("mule.ini", "main", "Mule_Character_Slot", "1")

$items = iniread("mule.ini", "main", "Mule_Item_Amount", "5")

$dir = iniread("mule.ini", "main", "bot_dir", "C:/Program Files/mm.BOT/mm.BOT/Logs/_Stats.ini")

$stashed = iniread($dir, "mm.BOT 5.xx GLOBAL STATISTICS", "Total_Stashed", "1")

$game = iniread("mule.ini", "main", "Game_Name", "blaHBLAH")

$pass = iniread("mule.ini", "main", "Game_pass", "blaHBLAH")

$once = iniread("mule.ini", "main", "Muled_Once", "No")

If $slot = 1 Then

$slotx = 192

$sloty = 152

ElseIf $slot = 2 Then

$slotx = 436

$sloty = 163

Elseif $slot = 3 Then

$slotx = 169

$sloty = 250

Elseif $slot = 4 Then

$slotx = 436

$sloty = 256

ElseIf $slot = 5 Then

$slotx = 163

$sloty = 340

ElseIf $slot = 6 Then

$slotx = 426

$sloty = 329

EndIf

sleep(500)

Send("{ESC}")

Sleep(500)

Mouseclick("left", 369, 287)

Sleep(1000)

MouseClick("Left", 597, 489)

Sleep(500)

Send($game)

Sleep(500)

Send("{Tab}")

Sleep(500)

Send($pass)

Sleep(500)

Send("{ENTER}")

Sleep(25000)

$startpix = Pixelgetcolor(250, 200)

If $stashed = $items Then

_Mule()

ElseIf $Stashed > $items Then

_Mule()

ElseIf $Stashed < $items Then

Exit

EndIf

Func _Mule()

Local $pix2, $pix3, $pix4, $pix5, $pix6, $pix7, $pix8, $pix9, $pix10, $pix11, $pix12, $pix13, $pix14, $pix15, $pix16, $pix17, $pix18, $pix19, $pix20, $pix21, $pix22, $pix23, $pix24, $pix25, $pix26, $pix27, $pix18, $pix29, $pix30

If WinActive("Diablo II") Then

WinActivate("Diablo II")

Else

Exit

EndIf

If $once = "Yes" Then

Exit

Endif

If $startpix = 65304 Then

MouseClick("left", 250, 481)

Sleep(2000)

MouseClick("left", 200, 427)

Sleep(2000)

MouseClick("left", 326, 469)

Sleep(2000)

Else

Exit

EndIf

$right = PixelSearch(450, 155, 715, 464, 65304)

If Not @Error then

MouseClick("left", $right[0] + 69, $right[1] + 78)

Sleep(2000)

EndIf

$stashrel2 = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel2[0] + 69, $stashrel2[1] + 78)

EndIf

Sleep(350000)

$pix3 = pixelgetcolor(177, 183)

If $pix3 <> 1024 Then

MouseClick("Left", 180, 189, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(400)

MouseClick("Left")

sleep(400)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix4 = pixelgetcolor(175, 213)

If $pix4 <> 1024 Then

MouseClick("Left", 175, 213, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

sleep(500)

$pix5 = pixelgetcolor(164, 241)

If $pix5 <> 1024 Then

MouseClick("Left", 165, 244, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(500)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix6 = pixelgetcolor(173, 274)

If $pix6 <> 1024 Then

MouseClick("Left", 173, 274, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix7 = pixelgetcolor(173, 303)

If $pix7 <> 1024 Then

MouseClick("Left", 173, 303, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix8 = pixelgetcolor(173, 327)

If $pix8 <> 1024 Then

MouseClick("Left", 171, 330, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix9 = pixelgetcolor(199, 185)

If $pix9 <> 1024 Then

MouseClick("Left", 199, 185, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix10 = pixelgetcolor(199, 220)

If $pix10 <> 1024 Then

MouseClick("Left", 199, 220, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix11 = pixelgetcolor(199, 248)

If $pix11 <> 1024 Then

MouseClick("Left", 199, 248, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix12 = pixelgetcolor(199, 277)

If $pix12 <> 1024 Then

MouseClick("Left", 199, 277, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix13 = pixelgetcolor(205, 307)

If $pix13 <> 1024 Then

MouseClick("Left", 205, 307, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix14 = pixelgetcolor(194, 324)

If $pix14 <> 1024 Then

MouseClick("Left", 194, 324, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix15 = pixelgetcolor(231, 183)

If $pix15 <> 1024 Then

MouseClick("Left", 231, 186, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix16 = pixelgetcolor(223, 209)

If $pix16 <> 1024 Then

MouseClick("Left", 223, 212, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix17 = pixelgetcolor(234, 242)

If $pix17 <> 1024 Then

MouseClick("Left", 234, 242, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix18 = pixelgetcolor(230, 270)

If $pix18 <> 1024 Then

MouseClick("Left", 230, 270, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix19 = pixelgetcolor(227, 300)

If $pix19 <> 1024 Then

MouseClick("Left", 227, 300, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix20 = pixelgetcolor(228, 330)

If $pix20 <> 1024 Then

MouseClick("Left", 228, 330, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix21 = pixelgetcolor(229, 362)

If $pix21 <> 1024 Then

MouseClick("Left", 229, 362, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix22 = pixelgetcolor(229, 385)

If $pix22 <> 1024 Then

MouseClick("Left", 229, 385, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix23 = pixelgetcolor(260, 182)

If $pix23 <> 1024 Then

MouseClick("Left", 260, 182, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix24 = pixelgetcolor(257, 209)

If $pix24 <> 1024 Then

MouseClick("Left", 257, 209, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix25 = pixelgetcolor(257, 246)

If $pix25 <> 1024 Then

MouseClick("Left", 257, 246, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix26 = pixelgetcolor(250, 266)

If $pix26 <> 1024 Then

MouseClick("Left", 250, 266, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix27 = pixelgetcolor(259, 295)

If $pix27 <> 1024 Then

MouseClick("Left", 259, 295, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix28 = pixelgetcolor(265, 329)

If $pix28 <> 1024 Then

MouseClick("Left", 265, 329, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix29 = pixelgetcolor(258, 353)

If $pix29 <> 1024 Then

MouseClick("Left", 258, 353, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

$pix30 = pixelgetcolor(253, 292)

If $pix30 <> 1024 Then

MouseClick("Left", 253, 292, 1, 2)

Sleep(500)

MouseClick("left", 370, 479, 1, 2)

Sleep(300)

MouseClick("Left")

sleep(300)

$stashrel = pixelsearch(220, 115, 450, 336, 65304)

If Not @error then

MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)

Sleep(500)

EndIf

EndIf

Sleep(1000)

Send("{ESC}")

Sleep(500)

Send("{ESC}")

Sleep(500)

Mouseclick("left", 369, 287)

Sleep(2000)

MouseClick("Left", 752, 512)

Sleep(1500)

Mouseclick("Left", $slotx, $sloty)

Sleep(500)

Send("{Enter}")

Sleep(1000)

MouseClick("Left", 720, 488)

Sleep(500)

Send($game)

Sleep(500)

Send("{Tab}")

Sleep(500)

Send($pass)

Sleep(25000)

$start2 = pixelgetcolor(260, 185)

If $start2 = $startpix Then

Sleep(500)

Mouseclick("Left", 258, 464)

Sleep(2000)

Mouseclick("Left", 210, 415)

Sleep(2000)

Mouseclick("Left", 328, 477)

Sleep(2000)

Else

Sleep(5000)

MouseClick("Left", 720, 488)

Sleep(500)

Send("lil1")

Sleep(500)

Send("{Tab}")

Sleep(500)

Send("1")

Sleep(2500)

If $start2 = $startpix Then

Sleep(500)

Mouseclick("Left", 258, 464)

Sleep(2000)

Mouseclick("Left", 210, 415)

Sleep(2000)

Mouseclick("Left", 328, 477)

Sleep(2000)

EndIf

Endif

Send("{Alt Down}")

Sleep(500)

Do

$pickitup = PixelSearch(455, 196, 759, 480, 16720037)

If Not @error then

Mouseclick("Left", $pickitup[0], $pickitup[1] + 5)

Sleep(1000)

Endif

Until Not IsArray($pickitup)

Do

$pickitup = PixelSearch(300, 150, 250, 350, 16720037)

If Not @error then

Mouseclick("Left", $pickitup[0], $pickitup[1] + 5)

Sleep(1000)

Endif

Until Not IsArray($pickitup)

Send("{Alt Up}")

Sleep(500)

IniWrite("mule.ini", "Main", "Muled_Once", "Yes")

EndFunc

Well for one thing, take repetitive parts like the following:

If $pix3 <> 1024 Then
   MouseClick("Left", 180, 189, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(400)
   MouseClick("Left")
   sleep(400)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

...and turn them into functions with variables for the unique values:

If $Input_A <> 1024 Then
   MouseClick("Left", $Input_X, $Input_Y, 1, 2)
   Sleep(500)
   MouseClick("left", 370, 479, 1, 2)
   Sleep(400)
   MouseClick("Left")
   sleep(400)
$stashrel = pixelsearch(220, 115, 450, 336, 65304)
If Not @error then
   MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
   Sleep(500)
EndIf
EndIf

You see there are really only three unique things to pass, so:

;-----------------
; Function _DoWhatever()
;   Does...whatever....
; Call with:  _DoWhatever($Input_A, $Input_X, $Input_Y)
;   Where:
;       $Input_A is a pixel color
;       $Input_X is the x-coord to click on
;       $Input_Y is the y-coord to click on
;-----------------
Func _DoWhatever($Input_A, $Input_X, $Input_Y)
    If $Input_A <> 1024 Then
       MouseClick("Left", $Input_X, $Input_Y, 1, 2)
       Sleep(500)
       MouseClick("left", 370, 479, 1, 2)
       Sleep(400)
       MouseClick("Left")
       sleep(400)
       $stashrel = pixelsearch(220, 115, 450, 336, 65304)
       If Not @error then
           MouseClick("left", $stashrel[0] + 69, $stashrel[1] + 78)
           Sleep(500)
        EndIf
    EndIf
EndFunc; ===> _DoWhatever

There's a start... :D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0