Jump to content

Script stop and beep


 Share

Recommended Posts

I am not going to write the code for you, but I will help point you in the right direction. While there are a few areas in which this script should be improved, if you made this by yourself than it is evident that a lot of effort went into it and for that I commend you. there are a few suggestions that I would make, but first lets look at your immediate concern.

You say that when the website performs the security test, the pixels that your script is looking for are no longer there. Now I will appeal to your logic. If, in the first place, the script knows to click the mouse when a certain pixel is a certain color, it would also stand to reason that you can check to see if that pixel is NOT that color. Here is a brief example of what I am talking about

If Pixelgetcolor(272,405) = 0xff9966 Then ; this check for a specific pixel, and verifies if it is a specific color.

Now how about this

if not(Pixelgetcolor(272,405) = 0xff9966) Then ; This will check and see if a particular pixel is NOT a specific color. Please note that an if-then statement can have multiple conditions, so that it could be like this

if not(Pixelgetcolor(272,405) = 0xff9966) and not(Pixelgetcolor(358,386) = 0x009966) then ; This will only be true if both conditions are met.

I hope that this is making sense. Basicly, using a statement similar to the one I 've shown you, you can do what you are attempting. This is only a part of it, though.

OK, while I am willing to help you on this, I need you to try and work this into your code first.

One other suggestion - replace your initial for-next loop with a while-wend loop. For-next loops should really only be used when you have a particular number of times that you want your loop to be processed.

Edited by improbability_paradox
Link to comment
Share on other sites

Ok, I checked out the game, it's actually a pretty neat game, I might start playing it myself :P. Anyways, I only got knocked out once and it timed out, so I haven't done that part yet, but this works pretty good so far (can't seem to make another security test come up, so that part is untested, although i'm pretty confident it will work alright). After the security test the script will have to be restarted, but that shouldn't be too much of a hastle. Feel free to comment this so I know if there is something wrong (oh yeah, resolution 1024 x 768, coord mode is screen so if you move the game windows at all it will not work correctly). Enjoy!

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
WinActivate("http://www.eternalwars.com - Eternal Wars! - Mozilla Firefox")
$attack_clicked = 0
$continue_clicked = 0

While 1

    ;Window Inactive
    If Not WinActive("http://www.eternalwars.com - Eternal Wars! - Mozilla Firefox") Then
        While 1
            Beep(800, 500)
            Sleep(50)
            Beep(600, 500)
            Sleep(50)
        WEnd
    Endif
    
    ;Security Check
    If (Pixelgetcolor(404, 418) = 0x666666) Then
        While 1
            Beep(800, 500)
            Sleep(50)
            Beep(600, 500)
            Sleep(50)
        WEnd
    EndIf

    ;Attack
    If (Pixelgetcolor(338, 405) = 0xf5f4eb) And $attack_clicked = 0 Then
        MouseClick("left", 360, 405, 1, 0)
        $attack_clicked = 1
        $continue_clicked = 0
    EndIf

    ;Contimue slaying monsters MIDDLE
    If (Pixelgetcolor(470, 380) = 0x666666) And $continue_clicked = 0 Then
        MouseClick("left", 470, 370, 1, 0)
        $attack_clicked = 0
        $continue_clicked = 1
    EndIf

WEnd

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        Sleep(100)
        ToolTip('Paused...', 339, 397)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit
EndFunc

- Dan [Website]

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