Sign in to follow this  
Followers 0
Azrakan

need help for wow bot ...

2 posts in this topic

hi all !

just making a wow fishing bot that can fish just a certain type of fish.

here is the code, I got some problems, especially I got the "variable used without being declared" error for $x, $var, $var1, $var2 variables.

Moreover, I don't know if the functions I used are good for this bot or if I can make it better with other functions...

please help :whistle:

here is the code

;bot pour la pêche de pd (poissons déviants) :dance:

Opt("MouseCoordMode", 1) ;1=absolu, 0=relatif

Opt("MustDeclareVars", 0) ;0=non, 1=requiert pré-déclaration

Opt("PixelCoordMode", 1) ;1=absolu, 0=relatif

HotKeySet("!1","start") ;changer !1 pour assigner un autre raccourci pour commencer (!1 = alt+1)

HotKeySet("!2","pause") ;changer !2 pour assigner un autre raccourci pour pause (!2 = alt+2)

HotKeySet("!3","quitter") ;changer !3 pour assigner un autre raccourci pour arrêter (!3 = alt+3)

pause() ;pause au début

Func pause()

While 1

Sleep(2000)

WEnd

EndFunc ;==>pause

Func quitter()

Exit

EndFunc ;==>quitte autoIt

func start()

Send("3")

Sleep(2000)

ToolTip("cherche le bouchon...")

$coord=PixelSearch(185,115,1080,515,14500000,50,2)

Sleep(10000)

If Not @error Then

ToolTip("bouchon trouvé !") ;X and Y are: $coord[0] , $coord[1])

wait()

Else

start()

EndIf

EndFunc

$var = PixelGetColor( $coord[0] , $coord[1])

$var1 = $var - 3000000

$var2 = $var + 3000000

Dim $x=0

Func wait()

Sleep(50)

If $var < $var1 Or $var > $var2 Then

loot()

ToolTip("ça mord!")

Else

ToolTip("attend que ça morde...")

If $x < 401 Then

wait()

Else

start()

EndIf

EndIf

EndFunc

Func loot()

ToolTip("loot le poisson...")

Sleep(500)

MouseClick("right")

Sleep(200)

MouseMove(42,215,5)

$check = PixelGetColor( 42 , 215 )

If $check = 16251456 Then

MouseClick("left")

ToolTip("c'est un poisson déviant ! ")

EndIf

start()

EndFunc

peche.au3

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I cant really check your code if it works but if you want to eliminate the errors regarding the variables then add this at the start of your program:

Dim $x = 0, $var = 0, $var1 = 0, $var2 = 0

or Dim them inside your functions....

This happens cos you use some if statements regarding these variables but before assigning value to them , or at least the program thinks so....

$var = PixelGetColor( $coord[0] , $coord[1])
$var1 = $var - 3000000
$var2 = $var + 3000000
Dim $x=0

This code is neither inside a function nor inside the main program loop (in this case Pause() ) so it is never executed (probably) or it is executed once.Assign that code to a function or put it inside an already existing one....

This code isnt right (misplaced Endif):

Func wait()
Sleep(50)
If $var < $var1 Or $var > $var2 Then 
loot()
ToolTip("ça mord!")
Else 
ToolTip("attend que ça morde...")
If $x < 401 Then 
wait()
Else 
start()
EndIf
EndIf
EndFunc

The right one is :

Func wait()
Sleep(50)
If $var < $var1 Or $var > $var2 Then 
loot()
ToolTip("ça mord!")
Else 
ToolTip("attend que ça morde...")
EndIf
If $x < 401 Then 
wait()
Else 
start()
EndIf
EndFunc

EDIT:Added some code corrections.

C ya

Edited by hgeras

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