Sign in to follow this  
Followers 0
newb_powa'

Why it doesn't work ?

7 posts in this topic

#1 ·  Posted (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 by newb_powa'

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

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 :D

Share this post


Link to post
Share on other sites

AutoIt is detectable in WoW.. Be careful

Share this post


Link to post
Share on other sites

I'm on a private server, Wow cost to much money :D

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by Choch

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 /sorry

Return 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 by SmOke_N

[center]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.[/center]

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