Jump to content

Recommended Posts

Posted (edited)

I have created a script that using a game, and i want to record the mouse clicks.

It's works too record and all that stuffs. But when i play the record.

It's just got messed up, and looks bad. How can i fix so it doesn't look messed up?

Here is the code. Maybe it's a lot messy.

The program is not destroying the game.

The keys

F2 - Auto-Click the tools or bricks

Insert - Change tools or bricks

Delete - Delete the recent clicks

End - Change to the Black brick

Right CTRL - Record the clicks

Home - Play the recent recording

Here is the mouse-clicks for mario

http://paste2.org/p/829506

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=C:\hbey.ico
#AutoIt3Wrapper_outfile=everybodyedit2.exe
#AutoIt3Wrapper_Compression=3
#AutoIt3Wrapper_Res_Comment=wut
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=wut
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#Include <GuiStatusBar.au3>
#include <IE.au3>
#include <Misc.au3>
#Include <File.au3>


;Options
Opt("MouseCoordMode", 2)
Opt("WinTitleMatchMode", 4)
Opt("TrayMenuMode",1)
Opt("MouseClickDelay", 9)
Opt("MouseClickDownDelay", 9)

$dll = DllOpen("user32.dll")
filedelete("delete.log")
dircreate("recorded")

;Set variables
global $ho, $noh, $w, $h, $rec, $filez, $files

$exit = TrayCreateItem("Exit")
TraySetState()


_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()
$window = GUICreate("Everybody Edits", 639, 539,-1,-1,bitor($WS_VISIBLE,$WS_CLIPSIBLINGS,$WS_CLIPCHILDREN,$WS_BORDER,$WS_MINIMIZEBOX,$WS_MAXIMIZEBOX))
guisetbkcolor(0x242424)
$Ac = GUICtrlCreateObj($oIE, 0, 0, 640, 520)
GUICtrlSetBkColor($Ac,0x242424)
GUISetState()

;Navigate to the flash
_IENavigate ($oIE, "http://static.jesper.nu/games/action/everybody-edits.swf")



While 1
    $msg = GUIGetMsg()
    $msg1 = TrayGetMsg()

    if $msg = $GUI_EVENT_CLOSE or $msg1 = $exit then
        ExitLoop
    EndIf
    if WinActive("Everybody Edits","") and $noh == 1 Then
        $ho = mousegetpos()
        mouseclick("left",$ho[0],$ho[1])
    EndIf

if WinActive("Everybody Edits","") then
    
    ;If Insert is pressed, go + color. Till end.
    if _IsPressed("2D", $dll) Then
        $pos = mousegetpos()
        if $w = 22 Then
            mouseclick("left",439,496)
            mousemove($pos[0],$pos[1],0)
            $h = 1
            $hh = 110 + $h
            $w = 1
        Else
            $h += 15
            $w += 1
            $hh = 110 + $h
            mouseclick("left",$hh,496)
            mousemove($pos[0],$pos[1],0)
        EndIf

        While _IsPressed("2D", $dll)
            Sleep(10)
        WEnd
    EndIf

        ;If End is pressed, get the colour Black
        if _IsPressed("23", $dll) Then
            $pos = mousegetpos()
            mouseclick("left",440,496)
            mousemove($pos[0],$pos[1],0)

            While _IsPressed("23", $dll)
                Sleep(10)
            WEnd
        EndIf

        ;If F2 is pressed, set the variable to 1.
        if _IsPressed("71", $dll) Then
            if $noh = 1 then
                $noh = 0
            Else
                $noh = 1
                $ho = mousegetpos()
            EndIf

            While _IsPressed("71", $dll)
                Sleep(10)
            WEnd
        EndIf

        ;If mouse is pressed save the mouseclicks to delete.log
        ;If record is activated, record the mouseclicks.
        if _IsPressed("01", $dll) Then
                $pos = mousegetpos()
                if $rec = 1 Then
                    filewrite(@scriptdir & "\recorded\record" & $filez & ".log",$pos[0] & " " & $pos[1] & @crlf)
                EndIf
                if $pos[1] < 487 then
                    filewrite("delete.log",$pos[0] & " " & $pos[1] & @crlf)
                EndIf

                While _IsPressed("01", $dll)
                WEnd
        EndIf

        ;If Delete key is pressed, Clear the recent painting.
        if _IsPressed("2E", $dll) Then
                $lines = _FileCountLines("delete.log")
                mouseclick("left",135,496,1,0)
                for $i = 1 to $lines
                    $post = stringsplit(filereadline("delete.log",$i)," ")
                    mousemove($post[1],$post[2],0)
                    mouseclick("left",$post[1],$post[2],1,2)
                Next
                filedelete("delete.log")

            While _IsPressed("2E", $dll)
                Sleep(10)
            WEnd
        EndIf

        ;If right CTRL is pressed, record or stop the recording.
        if _IsPressed("A3", $dll) Then
                if $rec = 1 Then
                    $rec = 0
                    winsettitle("Everybody Edits","","Everybody Edits - Recording Stopped. Press Home too create it.")
                else
                    winsettitle("Everybody Edits","","Everybody Edits - Recording..")
                    $rec = 1
                    $Files = _FileListToArray(@scriptdir & "\recorded\", "record*.log", 1)

                    If not @Error Then
                        $filez = $files[0] + 1
                    Else
                        $filez = 1
                    EndIf
                EndIf

            While _IsPressed("A3", $dll)
                Sleep(10)
            WEnd
        EndIf

            ; If Home is pressed, play the recent recording.
            if _IsPressed("24", $dll) Then
                $Files = _FileListToArray(@scriptdir & "\recorded\", "record*.log", 1)

                If not @Error Then
                    $filez = $files[0]
                Else
                    $filez = 1
                EndIf
                $lines = _FileCountLines(@scriptdir & "\recorded\record" & $filez & ".log")
                for $i = 1 to $lines
                    $post = stringsplit(filereadline(@scriptdir & "\recorded\record" & $filez & ".log",$i)," ")
                    mousemove($post[1],$post[2],0)
                    mouseclick("left",$post[1],$post[2],1,8)
                Next

            While _IsPressed("24", $dll)
                sleep(10)
            WEnd
        EndIf

EndIf
WEnd
GUIDelete()
Exit
Edited by bobbby

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...