Sign in to follow this  
Followers 0
E1M1

why dynamic code is buggy but same satic code isn't?

2 posts in this topic

#1 ·  Posted (edited)

If i change $multiy and $starty manually (every time script finishes I change these 2 numbers and then press f5 again) then it works fine but if I use $n = 1 To 3 to update these variables then it turns buggy. I debbugged with msgbox, it showd that i get same numbers as I get with static code, but some reason it's not same.

Here's my dynamic code.

Opt("MouseClickDelay", 0) ;10 milliseconds
Opt("MouseClickDownDelay", 0) ;10 milliseconds
Opt("MouseClickDragDelay", 0) ;250 milliseconds

Sleep(1000)
$startx = 1050
$starty = 485
$multy = 22
$multx = 40
For $n = 1 To 3
    $starty = 500 + ($n * 10)
    $x = 1050
    $y = $starty
    $multy -= 2
    MsgBox(0, $starty, $multy)

    For $i = 1 To 8 Step 0.08
;~ Circle
        $y += Sin($i) * $multy
        $x += Cos($i) * $multx
;~ Wave
;~ $y +=1
;~ $x +=(sin($i)*3)+0
        If $x > 1200 Or $y > 1000 Then Exit
        ToolTip($x & @LF & $starty & @LF & $multy, 0, 0)


        MouseClickDrag("left", $startx, $starty, $x, $y, 0)
        $startx = MouseGetPos(0)
        $starty = MouseGetPos(1)
    Next

    Sleep(500)
Next

Here's pic made with dynamic code. If you look this pic close you can see that this picture has 2 lines out of ellipse.

here's my static code

Opt("MouseClickDelay", 0) ;10 milliseconds
Opt("MouseClickDownDelay", 0) ;10 milliseconds
Opt("MouseClickDragDelay", 0) ;250 milliseconds

Sleep(1000)
$startx = 1050
$starty = 515
$multy = 18
$multx = 40
;~ For $n = 1 To 3
;~  $starty = 500 + ($n * 10)
    $x = 1050
    $y = $starty
;~  $multy -= 2
;~  MsgBox(0, $starty, $multy)

    For $i = 1 To 8 Step 0.08
;~ Circle
        $y += Sin($i) * $multy
        $x += Cos($i) * $multx
;~ Wave
;~ $y +=1
;~ $x +=(sin($i)*3)+0
        If $x > 1200 Or $y > 1000 Then Exit
        ToolTip($x & @LF & $starty & @LF & $multy, 0, 0)


        MouseClickDrag("left", $startx, $starty, $x, $y, 0)
        $startx = MouseGetPos(0)
        $starty = MouseGetPos(1)
    Next

;~  Sleep(500)
;~ Next

and here's the static image

Any Ideas why this pics are diferent or why 1st picture have these 2 lines out of ellipse?

Edited by E1M1

edited

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You didn't reset coords properly.

Opt("MouseClickDelay", 0) ;10 milliseconds
Opt("MouseClickDownDelay", 0) ;10 milliseconds
Opt("MouseClickDragDelay", 0) ;250 milliseconds

Sleep(1000)

$multy = 22
$multx = 40

For $n = 1 To 3
    $startx = 1050
    $starty = 485
    $x = $startx
    $y = $starty

    $multy -= 2
    MsgBox(0, $starty, $multy)

    For $i = 1 To 8 Step 0.08
;~ Circle
        $y += Sin($i) * $multy
        $x += Cos($i) * $multx
;~ Wave
;~ $y +=1
;~ $x +=(sin($i)*3)+0
        If $x > 1200 Or $y > 1000 Then Exit
        ToolTip($x & @LF & $starty & @LF & $multy, 0, 0)

        MouseClickDrag("left", $startx, $starty, $x, $y, 0)
        $startx = MouseGetPos(0)
        $starty = MouseGetPos(1)
    Next

    Sleep(500)
Next
Edited by KaFu

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