Sign in to follow this  
Followers 0
ntsmarkv

Need Help with looping?

3 posts in this topic

#1 ·  Posted (edited)

OK, so I'm sorta new to this language, I know PHP so it's kind of a derivative.

What I'm doing is making a basic hotkey bot (till I find out how to create a GUI and have the hotkey cmd in the button once clicked).

Here's what I have so far, it's crappy, but doesn't work either. (well half works)

While 1
    sleep(10)
    Send("{right}")
    Send("{left}")
    WEnd

While 2
     Sleep(250)
    MouseClick("left", 338, 300)
    Sleep(250)
    MouseClick("left", 686, 400)
    WEnd

Now I searched the forums didn't finsd alot of examples using double loops. I'd like to progress this to GETPIXELCOLOR but I just need a basic loop for this.

That code should hit left/right one after each other as fast at it can without skipping one of the buttons

Then it will send the MouseClick() every half second for each click.

Still looking on forums (on 48th or 72nd hour now)

but if you can guide me in the right direction, I would be most grateful

Edited by ntsmarkv

Share this post


Link to post
Share on other sites



Answer to first Question:

GuiCreate("Example", 220, 75, -1, -1) ;~    Create the GUI
$Button1 = GuiCtrlCreateButton("Button 1", 20, 20, 80, 25) ;~   Create the Button
$Button2 = GuiCtrlCreateButton("Button 2", 120, 20, 80, 25) ;~  Create Second Button
GuiSetState()

While 1 ;~ While nothing is happening
    $Msg = GUiGetMsg() ;~ Get Msg from GUI
    Switch $Msg
        Case $Button1 ;~ When Button1 is pressed
            sleep(10)
            Send("{right}")
            Send("{left}")
        Case $Button2 ;~ When Button2 is pressed
            Sleep(250)
            MouseClick("left", 338, 300)
            Sleep(250)
            MouseClick("left", 686, 400)
    EndSwitch
WEnd

There are plenty of useful posts for GETPIXELCOLOR on these forums

it took me at most 5 minutes to find a useful post, just keep looking

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

ok, so I do appreciate the button GUI, looking more and more like VB with a twist.

This is what I have so far, to instead of having in multiple functions (found out it won't work, I add them in call the hotkey and fails.)

Here's what I have so far.

While 1
    
    send("{right}")
    sleep(1)
    send("{left}")
    
    
    send("{space}")
    send("{space}")
    send("{space}")
    send("{space}")
    send("{space}")
    send("{space}")
    
MouseClick("left", 668, 570, 1, 5)
MouseClick("left", 674, 521, 1, 5)  
    ;MouseClick("left", 566, 567, 1, 5)
;MouseClick("left", 567, 522, 1, 5)
WEnd

What I want it to do is:

go back and forth left/right (this will go back and forth like 1 time a second and every 3 seconds skips a second.)

always send the space button as many times as it can ^ this works perfect so far.

clicks the mouse in these two spots over and over.

Right now it will go back and forth as proposed but not fast enough, it send the space like I need it to, and it will click the mouse where I need it to. But the left/right, need to be faster. how can I speed this up?

I tried breaking it all in 3 functions then calling the hotKey by Send() command but won't work.

Any guidance will help

Edited by ntsmarkv

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