Jump to content

Help debugging code


BALA
 Share

Recommended Posts

I have a program here that will record mouse click then play it back for you. Here's the code that works:

#include <Misc.au3>

Dim $Position, $i = 0, $Record[1]
$score = 0
While 1
    If _IsPressed("09") Then
        $score = 1
    EndIf
   
    If $score = 1 Then
        If _IsPressed("01") Then
            $Position = MouseGetPos()
            $x = $Position[0]
            $y = $position[1]
            ReDim $Record[$i + 2]
            $Record[$i] = $x
            $Record[$i + 1] = $y
            $i += 2
        EndIf
    EndIf

    If $score = 0 Then
        If _IsPressed("12") Then
            MouseClick("left", $x, $y, 1)
        EndIf
    EndIf
    
    If _IsPressed("0D") Then
        $score = 0
    EndIf
    sleep(10)
WEndoÝ÷ ØÛhºÇ¡¢ÙÊȧ²×vÊr^vØb±«­¢+Ø¥¹±Õ±Ðí5¥Í¹ÔÌÐì()!½Ñ-åMÐ ÅÕ½ÐííÅôÅÕ½Ðì°ÅÕ½Ðí=¸ÅÕ½Ðì¤)!½Ñ-åMÐ ÅÕ½ÐííÉôÅÕ½Ðì°ÅÕ½Ðí=ÅÕ½Ðì¤)!½Ñ-åMÐ ÅÕ½ÐííÍôÅÕ½Ðì°ÅÕ½ÐíA±äÅÕ½Ðì¤()¥´ÀÌØíA½Í¥Ñ¥½¸°ÀÌØí¤ôÀ°ÀÌØíI½ÉlÅt(ÀÌØíͽÉôÀ)]¡¥±Ä(Õ¹=¸ ¤($$ÀÌØíͽÉôÄ(%¹Õ¹((%ÀÌØíͽÉôÄQ¡¸(%}%ÍAÉÍÍ ÅÕ½ÐìÀÄÅÕ½Ðì¤Q¡¸(ÀÌØíA½Í¥Ñ¥½¸ô5½ÕÍÑA½Ì ¤(ÀÌØíàôÀÌØíA½Í¥Ñ¥½¹lÁt(ÀÌØíäôÀÌØíÁ½Í¥Ñ¥½¹lÅt(I¥´ÀÌØíI½ÉlÀÌØí¤¬Ét(ÀÌØíI½ÉlÀÌØí¥tôÀÌØíà(ÀÌØíI½ÉlÀÌØí¤¬ÅtôÀÌØíä(ÀÌØí¤¬ôÈ(¹%(¹%((Õ¹A±ä ¤($%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÀÌØíà°ÀÌØíä°Ä¤(%¹Õ¹($(%Õ¹= ¤($$ÀÌØíͽÉôÀ(%¹Õ¹(ͱÀ ÄÀ¤)]¹

There's seems to be a problem with that one and I can't figure it out. Any ideas?

Edited by BALA
[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Link to comment
Share on other sites

I tried it like this:

#include <Misc.au3>

HotKeySet("{F1}", "On")
HotKeySet("{F2}", "Off")
HotKeySet("{F3}", "Play")

Dim $Position, $i = 0, $Record[1]
$score = 0
While 1
    sleep(10)
WEnd
Func On()
    $score = 1
EndFunc
   
If $score = 1 Then
    If _IsPressed("01") Then
        $Position = MouseGetPos()
        $x = $Position[0]
        $y = $position[1]
        ReDim $Record[$i + 2]
        $Record[$i] = $x
        $Record[$i + 1] = $y
        $i += 2
    EndIf
EndIf

Func Play()
    MouseClick("left", $x, $y, 1)
EndFunc

Func Off()
    $score = 0
EndFunc

It comes up with a new error though:

"Line 29

MouseClick("left", $x, $y, 1)

MouseClick("left", ^ERROR

Error: Variable used without being declared."

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
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...