Jump to content

need help on my bot


salter
 Share

Recommended Posts

Well i tryed my best to make this but im new to autoit so im not really sure how to do some things.

Im having troubes with a few things ive pointed most of them out in comments in the code.

ya i dont really know how to use functions lol.

If you could help me out that would be awsome. THX

This is what i got so far:

; Script Start - Add your code below here

;---------------------SETUP--------------------------------------------------
; Will add skill options here some otehr time
;-------------------------------------------------------------------------------
Opt("MouseCoordMode", 0); Read the help file for "Opt" to see if you need to keep the '2' a '2', '1', or '0'
Opt("PixelCoordMode", 0); Read the help file for "Opt" to see if you need to keep the '2' a '2', '1', or '0'
Hotkeyset("{HOME}","start")
Hotkeyset("{END}","stop")

Global $stop

Func start()
If Not WinExists("AlefClient") Then
         MsgBox(0, Random(0, 100), "Archlord must be opened.")
         Exit
      EndIf
WinActivate ( 'AlefClient' )
Sleep ( 300 )
$stop = NOT $stop
While $stop




Sleep(100)                     
Func Search()                  ;This is the monster select thing, what it does is
send("{LSHIFT down}")          ;pushes shift + tab which is the select a monster command for the game.
Sleep(Random(40, 55))          ;Then it checks to see if it has a hp bar up top and if it does it hits 3
send("{Tab}")                  ;which is the attack button and if it doesnt have a hp bar then it
Sleep(Random(900, 1070))       ;moves the camera to the left abit then hits shift + tab again.
send("{LSHIFT up}")
Sleep(Random(450, 520))
$var = PixelGetColor(424, 25)
If $var = 0xD63839 then        
Send("3")
Else

Sleep(Random(70, 120))
Send("{LEFT}")
Sleep(Random(70, 120))
Send("{LEFT}")
EndIf
EndFunc



Func Fight()
Sleep(Random(450, 600))
$var = PixelGetColor(424, 25) ; This part here is the search for hp bar
If $var = 0xD63839 then       ; and if it still has that color in it i want it to keep waiting.
Sleep(Random(900, 1200))      ; Then i want it to search again and if it still has that color to keep waiting.
Else                          ; Then when that color isnt there anymore i want it too start the Getitems Function.
Sleep(Random(95, 135))
EndIf
EndFunc 



Func Getitems()               ; this is supposed to go when the fight function is done.
Sleep(Random(98, 150))
Send("{SPACE}")
Sleep(Random(100, 145))
Send("{SPACE}")
Sleep(Random(99, 150))
Send("{SPACE}")
Sleep(Random(97, 145))
EndIf
EndFunc 




Func AFK()                   ;I want this to go off like every 30 seconds or so.
MouseMove (Random)           ;Im not sure if this is right.
Sleep(Random(100, 180))
MouseMove (Random)
Sleep(Random(100, 180))
Send("m")
Sleep(Random(400, 600))
Send("m")
Sleep(Random(100, 180))
EndFunc



EndIf
WEnd
EndFunc 

Func stop()
Exit
EndFunc

While 1
Sleep(50)
WEnd
Edited by salter
Link to comment
Share on other sites

$stop = 1

Func start()
If Not WinExists("AlefClient") Then
         MsgBox(0, Random(0, 100), "Archlord must be opened.")
         Exit
      EndIf
WinActivate ( 'AlefClient' )
Sleep ( 300 )
$stop = 0
If $stop = 0 Then
While 1
Search()
Fight()
getitems()
Sleep(30000)
AFK()
WEnd

Else

Sleep(1000)

EndIf
EndFunc

Edited by Jasio
Link to comment
Share on other sites

  • Moderators

Bump

Here's an idea... instead of adding to code that doesn't work, use the Debug option in SciTe and go through line by line and see where it is being held up at.

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

I think this:

Func Fight()
Sleep(Random(450, 600))
$var = PixelGetColor(424, 25) 
If $var = 0xD63839 then       
Sleep(Random(900, 1200))
$var = PixelGetColor(424, 25) 
If $var = 0xD63839 then       
Sleep(Random(900, 1200))             
$var = PixelGetColor(424, 25) 
If $var = 0xD63839 then                   ; ya dont know what to do here
Sleep(Random(900, 1200))                  ; Im trying to make it check the hp bar of the monster
$var = PixelGetColor(424, 25)             ; every second or so to see if he still has hp left
If $var = 0xD63839 then                   ; and if he does i want him to keep waiting and if it has no
Sleep(Random(900, 1200))                  ; hp left then the monster is dead so i want it too end that function.
$var = PixelGetColor(424, 25)             
If $var = 0xD63839 then       
Sleep(Random(900, 1200))       
$var = PixelGetColor(424, 25) 
If $var = 0xD63839 then       
Sleep(Random(900, 1200)) 
$var = PixelGetColor(424, 25) 
If $var = 0xD63839 then       
Sleep(Random(900, 1200))       
$var = PixelGetColor(424, 25) 
If $var = 0xD63839 then       
Sleep(Random(900, 1200))       
$var = PixelGetColor(424, 25) 
If $var = 0xD63839 then       
Sleep(Random(900, 1200))       
$var = PixelGetColor(424, 25) 
If $var = 0xD63839 then       
Sleep(Random(900, 1200))       
$var = PixelGetColor(424, 25) 
If $var = 0xD63839 then       
Sleep(Random(900, 1200))                 
Else                           
Sleep(Random(95, 135))
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndFunc

edit -

It looks like one of your problems is this

$var = PixelGetColor(424, 25)

If $var = 0xD63839 then

PixelGetColor returns a color in decimal, and you're comparing it to a hex value...pretty sure. If you want to keep using the hex value, you'd need to do: $var = '0x' & Hex(PixelGetColor(424, 25), 6)

Edited by xcal
Link to comment
Share on other sites

That code does do that, but the pixelgetcolor wont give you the hex directly, i dont believe..

$var = PixelGetColor( 424, 25 )
$var = Hex($var, 6)
If $var = D63839 Then
;Blah
Else
;Blah
EndIf
oÝ÷ Ù8Z·¥¯{*.¶ºr«iË^¯÷b+G{yȦjW(uémÜ$̨»e§¶Ú)ºÖ®¶­sdgVæ26V&6¥vÆR§6VæBgV÷C·´Å4eBF÷vçÒgV÷C²¥6ÆVW&æFöÒCÂSR§6VæBgV÷C·µF'ÒgV÷C²¥6ÆVW&æFöÒÂs§6VæBgV÷C·´Å4eBWÒgV÷C²¥6ÆVW&æFöÒCSÂS#¢b33c·f"ÒVÄvWD6öÆ÷"C#BÂ#R¤bb33c·f"ÒCc33FVâ¥6VæBgV÷C³2gV÷C²¤WDÆö÷¤VÇ6P¥6ÆVW&æFöÒsÂ#¥6VæBgV÷C·´ÄTeGÒgV÷C²¥6ÆVW&æFöÒsÂ#¥6VæBgV÷C·´ÄTeGÒgV÷C²¤VæD`¥tVæ@¤VæDgVæ0
Edited by Jasio
Link to comment
Share on other sites

  • 1 month later...

$var = PixelGetColor( 424, 25 )

$var = Hex($var, 6)

If $var = D63839 Then

;Blah

Else

;Blah

EndIf

i didnt know

If $var = D63839 Then

is same as

If $var <> D63839 Then

and wouldnt "D63839" -> String ?

[quote]I am so clever that sometimes I don't understand a single word of what I am saying.[/quote]

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...