xxd2godxx Posted January 6, 2006 Share Posted January 6, 2006 Ok....I am making a nihlathak bot (a boss in diablo 2) and i am having a few problems with the script. There are four possible ways to this boss (picked at random where he is) Take a look at the picture:Whereever the little stone Petroglyph is.....that is the way to the boss Nihlathak. I have changed the color ot that Petroglyh as seen in the pic below. The pic below is only the bottom left hand corner of the four pathways (SouthWest Passage) I am going to start my way with that first, then i will work myself around. Take a look at the pic below:http://img228.imageshack.us/my.php?image=s...nshot0084oq.jpgNow, my script first checks for the orange stairs and RIGHT CLICKS (TELEPORTS) to get stuck next to the top left hand fire flame urn. Then from there i can get a precise PixelGetColor on the green block. If the Green block is there then teleport to the boss. If he isn't there then sleep for a little and work yourself around. Also, if you take a look at the 2nd picture, the greenblock is on the tip of the isle. If the green block is NOT at the tip of the isle then that means the boss IS NOT down the pathway. Look at the picture below...to see what i mean:http://img355.imageshack.us/my.php?image=s...nshot0064qg.jpgi get a few error like:Line 53 (File "C:\Documents and Settings\Administrator\Desktop\Bot\Scripts\To_Nihi.au3"):MouseClick('Right', $Stairs[0], $Stairs[1],1,0)MouseClick('Right', $Staris^ERRORError: Subscript used with non-array variable.And stuff like that...well if you have any ideas fire away...here is the script:WinActivate("Diablo II")$FCR = 800$TELE_KEY = "f3"$Orange_Stair_Color = 16221753$Light_Green_Block = 1637120$Dark_Green_Block = 551234$Stairs = PixelSearch(0,0,800,600,$Orange_Stair_Color,0,15)Sleep(2500)MouseClick('Right', $Stairs[0], $Stairs[1] ,1,0)sleep (1500)$LightGreen = PixelSearch ( 0, 0, 800, 600, $Light_Green_Block, 0, 15);If Not @error Then ; $Nihi_Green = PixelSearch ( 0, 0, 800, 600, $Dark_Green_Block, 0, 15) ; If Not @error Then; MouseClick('Right', 795, 480 ,1,0);EndIf If $LightGreen[0] > 275 AND $LightGreen[0] < 325 Then Return 1 If $LightGreen[1] > 400 AND $LightGreen[1] < 475 Then Return 1If $LightGreen[0] = 1 AND $LightGreen[1] = 1 Then MouseClick ( "right" , 430 , 565 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 7 , 349 , 1,0) Sleep($FCR) EndIf $i = 0Send ($TELE_KEY, 1)$ONEBLOX = PixelSearch (5, 32, 798, 550, 10821887, 0, 15)If Not @Error Then $i = 1 Send ($TELE_KEY, 1) MouseClick('Right', $ONEBLOX[0] , $ONEBLOX[1] ,1,0) Sleep ($FCR)EndIf ;PixelGetColor ( 138 , 515 );If PixelGetColor = -1 ; Then Exit;If PixelGetColor = $Light_Green_Block ; Then MouseClick('Right', 795, 480 ,1,0);If PixelGetColor = $Dark_Green_Block; Then ;Go to nihi script, SW;Endif Link to comment Share on other sites More sharing options...
t0ddie Posted January 6, 2006 Share Posted January 6, 2006 [0] returns the number of variables in the array so when you make the array it should look like this dim $array[4] $array[1]= hi $array[2]= hello $array[3]= yo if you did this dim $array[3] then you would get the error your describing. Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
greenmachine Posted January 6, 2006 Share Posted January 6, 2006 Try checking to see if $Stairs is an array before the MouseClick command. If IsArray($Stairs) Then MouseClick('Right', $Stairs[0], $Stairs[1] ,1,0) EndIf Actually, to make it easier, I see you have If Not @error commented out in a few places. That could be used for this case too, assuming @error is 0 before you run the command. Link to comment Share on other sites More sharing options...
xxd2godxx Posted January 6, 2006 Author Share Posted January 6, 2006 (edited) thanx, i will look into these advices. [0]returns the number of variables in the array so when you make the array it should look like this dim $array[4] $array[1]= hi $array[2]= hello $array[3]= yo if you did this dim $array[3] then you would get the error your describing. I don't really get what you mean because when you use Func PixelSearch it returns to arrays, the first array($LightGreen[0]) is the $X coordinate and the second array($LightGreen[1]) is the $Y coordinate or the pixel search. Update of the script: WinActivate("Diablo II") $FCR = 800 $TELE_KEY = "f3" $Orange_Stair_Color = 16221753 $Light_Green_Block = 1637120 $Dark_Green_Block = 551234 $Stairs = PixelSearch(0,0,800,600,$Orange_Stair_Color,0,15) Sleep(2500) If IsArray($Stairs) Then MouseClick('Right', $Stairs[0], $Stairs[1] ,1,0) EndIf sleep (1500) $LightGreen = PixelSearch ( 0, 0, 800, 600, $Light_Green_Block, 0, 15) ;If Not @error Then ; $Nihi_Green = PixelSearch ( 0, 0, 800, 600, $Dark_Green_Block, 0, 15) ; If Not @error Then ; MouseClick('Right', 795, 480 ,1,0) ;EndIf If $LightGreen[0] > 275 AND $LightGreen[0] < 325 Then Return 1 If $LightGreen[1] > 400 AND $LightGreen[1] < 475 Then Return 1 If $LightGreen[0] < 275 AND $LightGreen[0] > 325 Then Return 2 If $LightGreen[1] < 400 AND $LightGreen[1] > 475 Then Return 2 If $LightGreen[0] = 1 AND $LightGreen[1] = 1 Then MouseClick ( "right" , 430 , 565 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 7 , 349 , 1,0) Sleep($FCR) EndIf $i = 0 Send ($TELE_KEY, 1) $ONEBLOX = PixelSearch (5, 32, 798, 550, 10821887, 0, 15) If Not @Error Then $i = 1 Send ($TELE_KEY, 1) MouseClick('Right', $ONEBLOX[0] , $ONEBLOX[1] ,1,0) Sleep ($FCR) EndIf If $LightGreen[0] = 2 AND $LightGreen[1] = 2 Then ;Boss is not in SW position ;PixelGetColor ( 138 , 515 ) ;If PixelGetColor = -1 ; Then Exit ;If PixelGetColor = $Light_Green_Block ; Then MouseClick('Right', 795, 480 ,1,0) ;If PixelGetColor = $Dark_Green_Block ; Then ;Go to nihi script, SW ;Endif I am also going to use this script: ;================================================= AutoItSetOption ( "ColorMode", 1 ) AutoItSetOption("WinTitleMatchMode", 3) AutoItSetOption("WinWaitDelay", 250) AutoItSetOption ("PixelCoordMode", 0) AutoItSetOption ("MouseCoordMode", 0) WinActivate("Diablo II") WinWaitActive("Diablo II") For $i=0 to 3 If SearchBox($i) Then MsgBox(0,"",$i) EndIf Next ;return values: 0=N-W,1=N-E,2=S-W,3=S-E Func SearchBox($box) ;availables box's=0,1,2,3 Select case $box = 0 PixelSearch(114,125,162,150,1055834,0,1) If Not @error Then return 1 EndIf case $box = 1 PixelSearch(704,120,767,153,1055834,0,1) If Not @error Then return 1 EndIf case $box = 2 PixelSearch(117,424,156,448,1055834,0,1) If Not @error Then return 1 EndIf case $box = 3 PixelSearch(716,419,749,453,1055834,0,1) If Not @error Then return 1 EndIf EndSelect return 0 EndFunc Edited January 6, 2006 by xxd2godxx Link to comment Share on other sites More sharing options...
t0ddie Posted January 6, 2006 Share Posted January 6, 2006 ooh sorry i just read the error, not the script. my bad Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
xxd2godxx Posted January 6, 2006 Author Share Posted January 6, 2006 ooh sorry i just read the error, not the script. my bad Its Cool Here is a little pathing tutorial. My pathing Starts with an "X" and Ends with a "|" It goes from SouthWest Position and moves to the NorthWest Position. Then it gets stuck to the left of the flaming torch. Once stuck....it pixelsearchs for the Dark Green block at the NorthWest passage of Nihlathak. If the pixelsearch = 1 then it will path its way to Nihlathak. If the pixelsearch = 0 then it continues its searching for Nihlathak. It then teleports to the very NORTH of the screen and left clicks (walks) to the very top. from there it teleports to the NorthEast torch and gets stuck. It then pixelsearchs for the dark green box. If pixelsearch = 1 then it teleports to Nihlathak and if it = 0 then it continues its way around. Now...there are to ways to get to the next torch (i am trying to determine which one is more stable). I can either teleport SW and get stuck behind a wall, then from there teleport to the torch and get stuck behind it or i can teleport to the very East end of the pathway then teleport to the south a little and get stuck behind a wall. Then from there teleport to the torch and get stuck. Once at the torch i will pixelsearch for the dark green color. If pixelsearch=1 then teleport to Nihilathak and if pixelsearch = 0 then begin pathing to the Stairs. I will then go to the south corner and get myself stuck. From there i will teleport near the stairs (orange color). I will use pixelsearch and the stairs. I will then take the coordinates of the stairs and subtract (i think) 100 from X and 100 from 100, to get an exact location. From there i will path my way to Nihlathak (i know he is down this passage because the other 3's pixelsearch's = 0 ). Once at Nihlathak i will pixelsearch his color (purple) and will attack him. Then I will exit the game. Here is a little pic of the pathing i am going to do: ***MY SCRIPT IS BELOW THE PICTURE*** 1) the curved lines are teleports 2) the circles are pixelsearchs 3) straight lines are walks 4) colored boxes are the colors of the mod'd walls Here is my Script: ;===============Func SearchBox======================================== AutoItSetOption ( "ColorMode", 1 ) AutoItSetOption("WinTitleMatchMode", 3) AutoItSetOption("WinWaitDelay", 250) AutoItSetOption ("PixelCoordMode", 0) AutoItSetOption ("MouseCoordMode", 0) WinActivate("Diablo II") WinWaitActive("Diablo II") For $i=0 to 3 If SearchBox($i) Then MsgBox(0,"",$i) EndIf Next ;return values: 0=N-W,1=N-E,2=S-W,3=S-E Func SearchBox($box) ;availables box's=0,1,2,3 Select case $box = 0 PixelSearch(114,125,162,150,551234,0,1) If Not @error Then return 1 EndIf case $box = 1 PixelSearch(704,120,767,153,551234,0,1) If Not @error Then return 1 EndIf case $box = 2 PixelSearch(117,424,156,448,1637120,0,1) If Not @error Then return 1 EndIf case $box = 3 PixelSearch(716,419,749,453,551234,0,1) If Not @error Then return 1 EndIf EndSelect return 0 EndFunc ;===================================================================== ;Globals ;===================================================================== $FCR = 800 $TELE_KEY = "f3" $Orange_Stair_Color = 16221753 $Light_Green_Block = 1637120 $Dark_Green_Block = 551234 $Boss_Purple_Color = 10821887 ;=============================== ;Get to flaming torch next to stairs ;=============================== $Stairs = PixelSearch(0,0,800,600,$Orange_Stair_Color,0,15) Sleep(2500) If IsArray($Stairs) Then MouseClick('Right', $Stairs[0], $Stairs[1] ,1,0) EndIf sleep (1500) ;================================ ;Pathing to NW flame torch ;================================ MouseClick('Right', $Stairs[0], $Stairs[1] + 100 ,1,0) ;Pathing to NW flame Torch (i need to do this part) $North_West=Func SearchBox(0) If $North_West = 1 Then ;Pathing to Nihi ( need to do this part) EndIf ;================================= ;Pathing to NE flame Torch ;================================= ;Pathing to NE flame Torch (i need to do this part) $North_East = Func SearchBox(1) If $North_East = 1 Then ;Pathing to Nihi (i need to do this part) EndIf ;================================== ;Pathing to South East flame torch. ;================================== ;Pathing to South East Flame Torch (i need to do this part) $South_East = Func SearchBox(3) If $South_East = 1 Then ;Pathing to Nihi (need to do this part) EndIf ;================================== ;Pathing to Wp Orange Box. ;================================== ;Pathing To just outside WP $Stairs2 = PixelSearch(0,0,800,600,$Orange_Stair_Color,0,15) Sleep(2500) If IsArray($Stairs2) Then MouseClick('Right', $Stairs2[0], $Stairs2[1] - 100 ,1,0) EndIf sleep (1500) MouseClick ( "right" , 430 , 565 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 90 , 526 , 1,0) Sleep($FCR) MouseClick ( "right" , 7 , 349 , 1,0) Sleep($FCR) EndIf $i = 0 Send ($TELE_KEY, 1) $ONEBLOX = PixelSearch (5, 32, 798, 550, $Boss_Purple_Color, 0, 15) If Not @Error Then $i = 1 Send ($TELE_KEY, 1) MouseClick('Right', $ONEBLOX[0] , $ONEBLOX[1] ,1,0) Sleep ($FCR) EndIf ;I kill boss in sequence (other part of script) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now