Sign in to follow this  
Followers 0
zzxxzzxx

[help] How To Make Use Of 2 * For

6 posts in this topic

HotKeySet ("{F9}",  "AE_Pattern"     )
HotkeySet ("{F10}", "Stop"         )

Opt ("MouseClickDownDelay", 90)
Opt ("MouseClickDelay", 1    )
Opt ("SendKeyDownDelay", 50   )
Opt ("SendKeyDelay", 1      )

Dim $AE1 = 1, $Skill_Delay , $Key_Delay = 50
Dim $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10
Dim $y1, $y2, $y3, $y4, $y5, $y6, $y7, $y8, $y9, $y10

;********** AE Pattern **********
Func AE_Pattern ()
    While (1)
        $Skill_Delay = 15
        For $x1 = $x1 to $x10
        For $y1 = $y1 to $y10
            Dim $x1 = 315, $x2 = 495, $x3 = 320, $x4 = 480, $x5 = 355, $x6 = 440, $x7 = 315, $x8 = 495, $x9 = 405, $x10 = 405
            Dim $y1 = 290, $y2 = 290, $y3 = 180, $y4 = 180, $y5 = 320, $y6 = 310, $y7 = 245, $y8 = 245, $y9 = 150, $y10 = 320
        ; 1 = L, 2 = R, 3 = LUU, 4 = RUU, 5 = LD, 6 = RD, 7 = LU, 8 = RU, 9 = U, 10 = D
            Send ("5 "); Skill number.
            Sleep ($Key_Delay)
            MouseMove ($x1 ,$y1 ,1)
            Sleep ($AE1)
            MouseClick ("Right", $x1 ,$y1 ,1)
            Call ("Skill_Delay")
        Next
        Next
    WEnd
EndFunc

;********** Stop **********
Func Stop (); Stops The Program.
    While 1 = 1
        Sleep (1000)
    Wend
EndFunc

;********** Repeater **********
While (1); Continuous Loop Of Program.
    Sleep (1)
WEnd

;********** Functions: Skill_Delay **********
Func Skill_Delay (); Delay Interval In Between Skills.
    While $Skill_Delay > 0
        MouseClick ("Right")
        Send (" ", 1)
        MouseUp ("Right")
        $Skill_Delay = $Skill_Delay - 1
    WEnd
EndFunc

This is the partial code i extracted from my script. As you can see, there's 2 "For" coding used.

It's basically increase $x1 & $y1 => $x2 & $y2 and then get vaules from $x2 & $y2.

I cant seem to make it get to $x2 & $y2, i think the problem is because $x1 & $y1 gotten another vaule (315, 290).

How do i overcome this problem.

Thanks for reading.

Share this post


Link to post
Share on other sites



HotKeySet ("{F9}",  "AE_Pattern"     )
HotkeySet ("{F10}", "Stop"         )

Opt ("MouseClickDownDelay", 90)
Opt ("MouseClickDelay", 1    )
Opt ("SendKeyDownDelay", 50   )
Opt ("SendKeyDelay", 1      )

Dim $AE1 = 1, $Skill_Delay , $Key_Delay = 50
Dim $x, $xtemp, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10
Dim $y, $ytemp, $y1, $y2, $y3, $y4, $y5, $y6, $y7, $y8, $y9, $y10

;********** AE Pattern **********
Func AE_Pattern ()
    While (1)
        $Skill_Delay = 15
        For $x = $x1 to $x10
        For $y = $y1 to $y10
            [b]$xtemp = $x[/b]
            [b]$ytemp = $y[/b]
            Dim $x1 = 315, $x2 = 495, $x3 = 320, $x4 = 480, $x5 = 355, $x6 = 440, $x7 = 315, $x8 = 495, $x9 = 405, $x10 = 405
            Dim $y1 = 290, $y2 = 290, $y3 = 180, $y4 = 180, $y5 = 320, $y6 = 310, $y7 = 245, $y8 = 245, $y9 = 150, $y10 = 320
        ; 1 = L, 2 = R, 3 = LUU, 4 = RUU, 5 = LD, 6 = RD, 7 = LU, 8 = RU, 9 = U, 10 = D
            Send ("5 "); Skill number.
            Sleep ($Key_Delay)
            MouseMove ($x ,$y ,1)
            Sleep ($AE1)
            MouseClick ("Right", $x ,$y ,1)
            Call ("Skill_Delay")
            [b]$x = $xtemp[/b]
            [b]$y = $ytemp[/b]
        Next
        Next
    WEnd
EndFunc

;********** Stop **********
Func Stop (); Stops The Program.
    While 1 = 1
        Sleep (1000)
    Wend
EndFunc

;********** Repeater **********
While (1); Continuous Loop Of Program.
    Sleep (1)
WEnd

;********** Functions: Skill_Delay **********
Func Skill_Delay (); Delay Interval In Between Skills.
    While $Skill_Delay > 0
        MouseClick ("Right")
        Send (" ", 1)
        MouseUp ("Right")
        $Skill_Delay = $Skill_Delay - 1
    WEnd
EndFunc

Does adding those in bold helps? there's still something i dun understand :think:

Share this post


Link to post
Share on other sites

.... definatly not how u use for :think:

Share this post


Link to post
Share on other sites

to lazy to edit the other post but maybe u should use an array instead of a bunch of variables...

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

This example of using an array will need beta

Opt ("MouseClickDownDelay", 90)
Opt ("MouseClickDelay", 1    )
Opt ("SendKeyDownDelay", 50   )
Opt ("SendKeyDelay", 1      )

Dim $AE1 = 1, $Skill_Delay , $Key_Delay = 50
Dim $x[11] = ['', 315, 495, 320, 480, 355, 440, 315, 495, 405, 405], $xtemp
Dim $y[11] = ['', 290, 290, 180, 180, 320, 310, 245, 245, 150, 320], $ytemp

;********** AE Pattern **********
Func AE_Pattern ()
    While (1)
        $Skill_Delay = 15
        For $z = 1 To 10
            Send ("5"); Skill number.
            Sleep ($Key_Delay)
            MouseClick ("Right", $x[$z] ,$y[$z] , 1)
            Skill_Delay()
        Next
    WEnd
EndFunc

;********** Stop **********
Func Stop (); Stops The Program.
    While 1 = 1
        Sleep (1000)
    Wend
EndFunc

;********** Repeater **********
While (1); Continuous Loop Of Program.
    Sleep (1)
WEnd

;********** Functions: Skill_Delay **********
Func Skill_Delay (); Delay Interval In Between Skills.
    While $Skill_Delay > 0
        MouseClick ("Right")
        Send (" ", 1)
        $Skill_Delay = $Skill_Delay - 1
    WEnd
EndFunc
Edit: I had read the $Skill_Delay and $Key_Delay incorrectly.

I might also suggest you taking a look at HotKeySet() to do your function Pause.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

HotKeySet ("{F9}",  "AE_Pattern")
HotkeySet ("{F10}", "Stop"    )

Opt ("MouseClickDownDelay", 55)
Opt ("MouseClickDelay", 1    )
Opt ("SendKeyDownDelay", 10   )
Opt ("SendKeyDelay", 1      )

Dim $x[11], $y[11], $Skill_Delay , $Key_Delay = 1

Func AE_Pattern (); Skills In Fixed Pattern (L, R, LUU, RUU, LD, RD, LU, RU, U, D).
    Dim $x[11] = ['', 315, 495, 320, 480, 355, 440, 315, 495, 405, 405]
    Dim $y[11] = ['', 290, 290, 180, 180, 320, 310, 245, 245, 150, 320]
    While (1)
        For $z = 1 To 10
            $Skill_Delay = 25; Change Here For Skill Delay.
            Send ("5 "); Skill number.
            Sleep ($Key_Delay)
            MouseClick ("Right", $x[$z] ,$y[$z] , 1)
            Skill_Delay ()
        Next
    WEnd
EndFunc

Func Stop (); Stops The Program.
    While 1 = 1
        Sleep (1000)
    Wend
EndFunc

While (1); Continuous Loop Of Bot.
    Sleep (1)
WEnd

Func Skill_Delay (); Delay Interval In Between Skills.
    While $Skill_Delay > 0
        MouseClick ("Right")
        Send (" ", 1)
        $Skill_Delay = $Skill_Delay - 1
    WEnd
EndFunc

Well, its working now, thanks for the help.

Have to use "Dim" in the function even when i've already used "Dim" to the array...

Changed "$Skill_Delay = 25" and brought it down into the "For" function so that the delay is reset back to 25 for every "For"

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