newb_powa' Posted July 22, 2006 Posted July 22, 2006 (edited) Hi guys, sorry if I ask a dumb question but i'm pretty new to autoIt ... So, what i'm doing is a bot for a game you probably know, world of warcraft. What i want with my func is that see if the monster is alive (that's work) and then, when he is dead the attack loop stop(problem). I wish i well explain my problem. There is my script. Func _Deadchecker() Local $Monsterdead PixelSearch( 195, 30, 200, 35, 0x00A800, 50 ) If Not @error = 1 Then $Monsterdead=0;vie EndIf If Not $Monsterdead=0 Then $Monsterdead=1 EndIf Return $Monsterdead EndFunc ;==>_Deadchecker ; ---------------------------------------------------------------------------- Func _Attack() Sleep(250) Send("1") Sleep(250) Send("2") Sleep(2300) If _Deadchecker() = 0 Then Do Sleep(250) Send("3") Sleep(6500) Until _Deadchecker() = Not 0 EndIf EndFunc ;==> _Attack ; ---------------------------------------------------------------------------- Edited July 22, 2006 by newb_powa'
Moderators SmOke_N Posted July 22, 2006 Moderators Posted July 22, 2006 (edited) Func _Deadchecker() PixelSearch(195, 30, 200, 35, 0x00A800, 50) If Not @error Then Return 0 Return 1 EndFunc ;==>_Deadchecker ; ---------------------------------------------------------------------------- Func _Attack() Sleep(250) Send("1") Sleep(250) Send("2") Sleep(2300) If Not _Deadchecker() Then Do Sleep(250) Send("3") Sleep(6500) Until _Deadchecker() EndIf EndFunc ;==> _Attack Edited July 22, 2006 by SmOke_N 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.
newb_powa' Posted July 22, 2006 Author Posted July 22, 2006 Thank you for help, i will test it after supper. I'm not sure to understand what you did, but i will look at it latter. Thank you an other time
newb_powa' Posted July 22, 2006 Author Posted July 22, 2006 I'm on a private server, Wow cost to much money
Choch Posted July 23, 2006 Posted July 23, 2006 (edited) [autoit]Func _Deadchecker() PixelSearch(195, 30, 200, 35, 0x00A800, 50) If Not @error Then Return 0 Return 1 EndFunc ;==>_Deadchecker I've been struggling with conceptualizing the actual usage of the "return" function, even after going through the manual, and I figure this is a simple enough example to learn from. In this situation, "Return 1" is after the "If Not @error Then Return 0" - So how can return ever be viewed as zero? Is return like a variable, that should only have 1 value at any given time? Furthermore, when "_Deadchecker" is referenced later on in the script, what value does it have? Is it the last value 'returned'? /hijack /sorry Edited July 23, 2006 by Choch
Moderators SmOke_N Posted July 23, 2006 Moderators Posted July 23, 2006 (edited) I've been struggling with conceptualizing the actual usage of the "return" function, even after going through the manual, and I figure this is a simple enough example to learn from.In this situation, "Return 1" is after the "If Not @error Then Return 0" - So how can return ever be viewed as zero? Is return like a variable, that should only have 1 value at any given time? Furthermore, when "_Deadchecker" is referenced later on in the script, what value does it have? Is it the last value 'returned'?/hijack /sorryReturn 0 is only returned if the If/Then (Conditional) statement is "True" in this situation. Return 1 returns if it is "False" because the conditional statement never made it past the "Then". Now in actuallity, it should be Return 1 if True and Return 0 if False, but I was following his original Code style. Edited July 23, 2006 by SmOke_N 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.
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