Sign in to follow this  
Followers 0
Mikeywarren

my finished script? (is it right?)

4 posts in this topic

well ive done soem work on a script i have made earlier to make it more functional, im just looking for some input here and if it is set out correctly and will work :) many thanks

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
WinWait("Monster&Me - MythOfOrient","")
If Not WinActive("Monster&Me - MythOfOrient","") Then WinActivate("Monster&Me - MythOfOrient","")
WinWaitActive("Monster&Me - MythOfOrient","")
HotKeySet( "{Esc}", "exit_now" )
while 1
MouseMove(317,489)
MouseDown("left")
MouseUp("left")
Sleep(7000)
MouseMove(318,488)
MouseDown("left")
MouseUp("left")
Sleep(7000)
If ( PixelGetColor(380,745) = 335636 ) Or ( PixelGetColor(580,745) = 270356 ) Then
        heal()
        EndIf
    
    Sleep(500)
WEnd
Func exit_now()
     Exit
 EndFunc
 
 Func heal()
     If ( PixelGetColor(380,745) = 335636 ) Then
         sleep(4000)
         send("^i")
         sleep(4000)
         MouseMove(,)
         sleep(4000)
         MouseDown("left")
         MouseUp("left")
         sleep(4000)
         Send("r")
         sleep(4000)
         send("o")
         sleep(4000)
         MouseMove(,)
         sleep(4000)
         MouseDown("left")
         MouseUp("left")
         Endif
         Or
         if ( PixelGetColor(580,745) = 270356 ) Then
          
          sleep(4000)
         send("^i")
         sleep(4000)
         MouseMove(,)
         sleep(4000)
         MouseDown("left")
         MouseUp("left")
         sleep(4000)
         Send("p")
         sleep(4000)
         MouseMove(,)
         sleep(4000)
         MouseDown("left")
         MouseUp("left")
         Endif
         EndFunc

any comments are greatly appreciated

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I don't see your pixelgetcolor working (look at operators in the help file "==" vs "=") and the "Or" in your function will not work the way you have it. For MouseMove/Down/Up just look at MouseClick()

Edit:

I didn't notice you were using Decimal with your PixelGetColor() vs Hex.

@4got1 - the tidy helped me see it clearer :)

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

#3 ·  Posted (edited)

im not sure if it * works * or not, but i tidied up your code some :(

Global $GetColor_1, $GetColor_2, $GetColor_3

Opt("WinWaitDelay", 100)
Opt("WinTitleMatchMode", 4)
Opt("WinDetectHiddenText", 1)
Opt("MouseCoordMode", 0)
HotKeySet( "{Esc}", "exit_now")

WinWait("Monster&Me - MythOfOrient", "")
If Not WinActive("Monster&Me - MythOfOrient", "") Then WinWaitActive("Monster&Me - MythOfOrient", "")

While 1
    $GetColor_1 = PixelGetColor(380, 745)
    $GetColor_2 = PixelGetColor(580, 745)
    MouseMove(317, 489)
    MouseClick("Left")
    Sleep(7000)
    MouseMove(318, 488)
    MouseClick("Left")
    Sleep(7000)
    If $GetColor_1 = 335636 Or $GetColor_2 = 270356 Then
        heal()
    EndIf
    Sleep(500)
WEnd

Func exit_now()
    Exit
EndFunc; => exit_now()

Func heal()
    $GetColor_3 = PixelGetColor(380, 745)
    If $GetColor_3 = 335636 Then
        Sleep(4000)
        Send("^i")
        Sleep(4000)
        MouseMove(,)
        Sleep(4000)
        MouseClick("Left")
        Sleep(4000)
        Send("r")
        Sleep(4000)
        Send("o")
        Sleep(4000)
        MouseMove(,)
        Sleep(4000)
        MouseClick("Left")
    Elseif (PixelGetColor(580, 745) = 270356) Then
        Sleep(4000)
        Send("^i")
        Sleep(4000)
        MouseMove(,)
        Sleep(4000)
        MouseClick("Left")
        Sleep(4000)
        Send("p")
        Sleep(4000)
        MouseMove(,)
        Sleep(4000)
        MouseClick("Left")
    EndIf
EndFunc; => heal()

-edit- i read Smoke N 's post and changed it up again :)

Edited by 4gotn1

Share this post


Link to post
Share on other sites

I don't see your pixelgetcolor working (look at operators in the help file "==" vs "=") and the "Or" in your function will not work the way you have it. For MouseMove/Down/Up just look at MouseClick()

ahh thanks, ill start fixing it :)

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