Jump to content

Auto Attacker


Recommended Posts

Ok it basicaly searches for the yellow color , clicks then waits 2 minutes and then sends f2 to pick up the items can anyone simplify it since i havent figured out how to make just do one send thing instead of pasting send sleep send sleep

H:\Desktop\Skillbotalpha\BOT!!!!!!!!!!!!!!.au3(15,52) : ERROR: syntax error

$Coord = PixelSearch ( 0, 0, 500, 500, 0xFFFFA0 [

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

H:\Desktop\Skillbotalpha\BOT!!!!!!!!!!!!!!.au3(18,8) : ERROR: syntax error (illegal character)

For $

~~~~~~~^

H:\Desktop\Skillbotalpha\BOT!!!!!!!!!!!!!!.au3(40,1) : ERROR: syntax error

Wend

i get those 3 errors i added a Wend but it didnt work and how is $ an illegal character

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Pixel Search for Monster
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
While 1
   $Coord = PixelSearch ( 0, 0, 500, 500, 0xFFFFA0 [, 5] [, 2]] )
   If Not @error Then
      MouseClick ( "Left" , $Coord[0], $Coord[1] , 2 , 0 )
   sleep(12000)
   Send("{f2}")
   sleep(500)
   send("{f2}")
   sleep(500)
   Send("{f2}")
   sleep(500)
   Send("{f2}")
   sleep(500)
   EndIf
Wend
Edited by thatsgreat2345
Link to comment
Share on other sites

I could only help you with the loop only

instead of copy\paste do this

For $=1 to 6 ;<-- Depends how many times you want it to repeat

Send("{F2}")

Sleep(500)

next

Now as far as concerned about pixel color , there is user in here that has made a whole essay about PixelSearch in Diablo 2.Search for his thread and ask him if any questions about it...

Link to comment
Share on other sites

Ok it basicaly searches for the yellow color , clicks then waits 2 minutes and then sends f2 to pick up the items can anyone simplify it since i havent figured out how to make just do one send thing instead of pasting send sleep send sleep

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Pixel Search for Monster
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
While 1
   $Coord = PixelSearch ( 0, 0, 500, 500, 0xFFFFA0 [, 5] [, 2]] )
   If Not @error Then
      MouseClick ( "Left" , $Coord[0], $Coord[1] , 2 , 0 )
   sleep(12000)
   Send("{f2}")
   sleep(500)
   send("{f2}")
   sleep(500)
   Send("{f2}")
   sleep(500)
   Send("{f2}")
   sleep(500)
   EndIf
Wend

<{POST_SNAPBACK}>

I agree with user="hgeras"

A "For... Next" statement will fix your loop

"... and the Lord said to John, "Come forth and ye shall receive eternal life," but instead John came fifth and won a toaster."

Link to comment
Share on other sites

your code is right with While 1..... It is an endless loop expecting to find yellow and IF it does then sends the requested keys. The loop i gave you is to substitute the copy/paste Send functions.Imagine if you had to send a key for 1000 times....One reason that your script may noit work is that the yellow shade you've given it might not be the one in the game,so always @error would be set to 1.There are hundreds of yellow shades.You have to be sure for the one you give it....

Link to comment
Share on other sites

well i can i limit it to a small portion so that its only search part of the screen and leaving out the other parts with yellow and i was wondering can i just put in fefea6 instead of an 0x cuz thats the color i want to look for and the shade of it doesnt change but i could probaly add some shade variation just to make sure and like i want it to search for yellow where the white square is

http://www.thatsgreat2345.iconrate.net/FlyffHacks/shot3.bmp

Link to comment
Share on other sites

i have a question when you use @error can you make it so that if it doesnt find the pixel then it will hold w for acouple seconds then search for a pixel then hold d for acouple seconds then search for pixel then hold s for acouple seconds then search for the pixel then hold a for acouple seconds then search for the pixel

Link to comment
Share on other sites

  • Moderators

Is the pixel different every time? Or is it the same one?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Opt("PixelCoordMode", 0)
Opt("MouseCoordMode", 0)

While 1
$GetColor = PixelGetColor(x, y)
$Color = 0xFFFFFF; or what ever your color is

If Not $GetColor == $Color Then
Sleep(2000)
EndIf
Wend

Or:

Opt("PixelCoordMode", 0)
Opt("MouseCoordMode", 0)

While 1
$x_1_and_2 = 200
$y_1_and_2 = 100
$Color = 0xFFFFFF; or what ever your color is
$SearchColor = PixelSearch($x_1_and_2, $y_1_and_2, $x_1_and_2 , $y_1_and_2, $Color, 5); 5 is 5 shades of $Color can be up to 250 shades
; (using the same coord for x1 as x2 and y1 as y2 so you can use @error)

If @error Then
Sleep(2000)
EndIf
Wend

Edit: Forgot Code Tags

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Forgive the drawing :dance: :

Rectangle.

__________________

|_________________|

Let's say the Top Left corner is x: 100 so as a variable: $x1 = 100

Let's say at that same spot in corner y: 100 so variable: $y1 = 100

Now to bottom right corner or the rectangle (bottom): $x2 = 300

And to bottom right corner of rectangle for the y is : $y2 = 300

Here you see that the 2 x coords are obviously different so they will check that entire rectangle for my pixel I'm searching for.

This is a rectangle:---->( . )<---- I made it kind of small :whistle:

(It's the period if your wondering)

Well the pixel I'm searching for in this isntance is the same size as my rectangle or point. So I just search that one coord, basically turnning my PixelSearch into a PixelGetColor (which allows me to use the "@error").

So that's why you see the variables: $x_1_and_2 & $y_1_and_2 with an explination in the code that I'm only use one coordinate for both "x" cooridnates required, and one coordinate for boty "y" coordinates required.

Edit: My rectangle looked even worse :dance:

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

dude this is atuo attacker not auto heal i want it to search almost the whole screen but part of the top and part of the bottom lol i guess ill just use that script for auto heal :whistle: well does this actualy mean i can use for both since for the heal i can just add in send("{f8}") and for the auto attacker i can just add mouse click

Edited by thatsgreat2345
Link to comment
Share on other sites

  • Moderators

"dude" :whistle: "My 6 year old says that to me" -- See why I posted in the other post to sum them up into one since your basically trying to accomplish the same thing.

1. I don't know the game at all, I was just trying to help.

2. Use some sense when looking at these codes that people are giving you, they can be used in more than one area of your scripts.

3. The sense part is, I know that if I'm not just searching the specific part, that I would just put in my top left x and top left y coord at the beginning, and my bottom right x and y after that, to come with the desired results that I'm looking for.

I misunderstood your post, but if you change just "1" thing the 2nd $x_1_and_2 & $y_1_and_2 to the proper x and y, it works.

Starting to wonder why I'm the only one posting anymore?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

And Im back ok i got the coordinates of the rectangle and the health but im confused about the auto attacker i got the health

this is the script but where do i put the 4 different coordinates

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Pixel Search for Monster
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
While 1
   $Coord = PixelSearch ( 0, 0, 500, 500, 0x32331E [, 5] [, 2]] )
   If Not @error Then
      MouseClick ( "Left" , $Coord[0], $Coord[1] , 2 , 0 )
   EndIf
Wend

POINT 1 OF RECTANGLE

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 9 Y: 147

Cursor ID: 0

POINT 2 OF RECTANGLE

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 1017 Y: 171

Cursor ID: 0

POINT 3 OF RECTANGLE

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 1019 Y: 712

Cursor ID: 0

POINT 4 OF RECTANGLE

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 10 Y: 717

Cursor ID: 0

Link to comment
Share on other sites

And Im back ok i got the coordinates of the rectangle and the health but im confused about the auto attacker i got the health

this is the script but where do i put the 4 different coordinates

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Pixel Search for Monster
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
While 1
   $Coord = PixelSearch ( 0, 0, 500, 500, 0x32331E [, 5] [, 2]] )
   If Not @error Then
      MouseClick ( "Left" , $Coord[0], $Coord[1] , 2 , 0 )
   EndIf
Wend

POINT 1 OF RECTANGLE

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 9 Y: 147

Cursor ID: 0

POINT 2 OF RECTANGLE

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 1017 Y: 171

Cursor ID: 0

POINT 3 OF RECTANGLE

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 1019 Y: 712

Cursor ID: 0

POINT 4 OF RECTANGLE

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 10 Y: 717

Cursor ID: 0

<{POST_SNAPBACK}>

When you're defining a rectangle to search, you only have to define the top left and bottom right coordinates. In this case, it looks like your top left coordinate will be 9, 147 and your bottom right coordinate will be 1019, 717.

So you have your coordinates - the next thing you need to do is clean up your code. The first error you are getting is a syntax error in this line:

$Coord = PixelSearch ( 0, 0, 500, 500, 0x32331E [, 5] [, 2]] )

The reason you're getting this error is because you are including the brackets ( "[" and "]" ) in the arguments. This is most likely because you are following the example provided by the help file or auto complete in Scite:

"PixelSearch( left, top, right, bottom, color [, shade-variation] [, step]] )"

The brackets aren't supposed to be included - they are just there to show you that those parameters are optional. This is what the line should look like:

$Coord = PixelSearch ( 0, 0, 500, 500, 0x32331E, 5, 2 )

Now that the syntax has been corrected, you need to plug in the correct coordinate values. Your coordinates 9, 147 and 1019, 717 give you the values for left, top, right, and bottom.

Left = 9

Top = 147

Right = 1019

Bottom = 717

The final product:

$Coord = PixelSearch ( 9, 147, 1019, 717, 0x32331E, 5, 2 )

Now, back to the original piece of code you posted (with the corrected line inserted):

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Pixel Search for Monster
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
While 1
   $Coord = PixelSearch ( 9, 147, 1019, 717, 0x32331E, 5, 2 )
   If Not @error Then
      MouseClick ( "Left" , $Coord[0], $Coord[1] , 2 , 0 )
      sleep(12000)
      Send("{f2}")
      sleep(500)
      send("{f2}")
      sleep(500)
      Send("{f2}")
      sleep(500)
      Send("{f2}")
      sleep(500)
   EndIf
Wend

This snipet of code should now work correctly, as long as your color value is correct. There is a more efficient way to do this code though. Before I give it to you, I want to explain the other error you got:

H:\Desktop\Skillbotalpha\BOT!!!!!!!!!!!!!!.au3(18,8) : ERROR: syntax error (illegal character)
For $
~~~~^

The reason you got this error is because when you use a For...Next loop, it has to use a variable - not just the "$" character.

Wrong:

For $ = 1 to 6
   Send("{F2}")
   Sleep(500)
Next

Right:

For $a = 1 to 6
   Send("{F2}")
   Sleep(500)
Next

The "$a" can be any variable ($a, $b, $c, $blah, $this, ..... etc).

So anyway, you get the idea. Here is the final version of the code I would use if I were you:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Pixel Search for Monster
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
While 1
   $Coord = PixelSearch ( 9, 147, 1019, 717, 0x32331E, 5, 2 )
   If Not @error Then
      MouseClick ( "Left" , $Coord[0], $Coord[1] , 2 , 0 )
      sleep(12000)
      For $a = 1 to 4
         Send("{f2}")
         Sleep(500)
      Next
   EndIf
Wend

Hope this helps. Enjoy :whistle:

Edited by michael
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...