Jump to content

Automating Blosics 2 as a test of theory


Recommended Posts

Hi, essentially what I'm doing is finding two pixels based on color, and having the mouse click on one and drag in the opposite direction of the other.

I can get the slope between the two pixels but I still can't think of how to drag away from the other.

So I have been testing this in Blosics 2

So here is what I have so far.

#include <Array.au3>
Global $greenloc
Global $orangeloc
Global $winhandle = WinGetHandle("Play Blosics 2, a free online game on Kongregate - Mozilla Firefox")
If @error Then MsgBox(4096, "Error", "Could not find the correct window")



HotKeySet("{F2}", "Display_Arrays")
HotKeySet("{F3}", "Green_Finder")
HotKeySet("{F4}", "Orange_Finder")
HotKeySet("{F5}", "Clickndrag")
;~ HotKeySet("{F6}", "")
HotKeySet("{ESC}", "Exiter")


While 1
    Sleep(100)
WEnd

Func Clickndrag()


    MouseMove($orangeloc[0],$orangeloc[1], 0)
    MouseClickDrag("primary",
EndFunc   ;==>Clickndrag

Func Green_Finder()
    $greenloc = PixelSearch(160, 185, 960, 790, 0xcda780, 0, "", $winhandle)
    ConsoleWrite("Green Finder has been completed")
EndFunc   ;==>Green_Finder

Func Orange_Finder()
    $orangeloc = PixelSearch(160, 185, 960, 790, 0xcda780, 0, "", $winhandle)
    ConsoleWrite("Orange Finder has been completed")
EndFunc   ;==>Orange_Finder

Func Display_Arrays()
    _ArrayDisplay($greenloc)
    If @error = 1 Then MsgBox(0, "Error", "$greenloc is not an array")
    If @error = 2 Then MsgBox(0, "Error", "$greenloc has too many dimensions")
    _ArrayDisplay($orangeloc)
    If @error = 1 Then MsgBox(0, "Error", "$orangeloc is not an array")
    If @error = 2 Then MsgBox(0, "Error", "$orangeloc has too many dimensions")
EndFunc   ;==>Display_Arrays

Func Exiter()
    Exit
EndFunc   ;==>Exiter

Anybody?

I have already verified this to not be against the TOS and it has no multiplayer functionality.

Edited by blckpythn
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...