Jump to content

simple problem simple solution


Recommended Posts

sorry stupid question and really simple answer but whats wrong with this code?

Func start

HotKeySet("c", click)

$x=-1

Func click()

$x=$x*-1

endfunc

while $x=1

MouseClick("left",740, 400, 1,1000)

Wend

EndFunc

trying to make it click rapidly when i press c and stop clicking when i press c again

Link to comment
Share on other sites

Make sure you use code \code tags when posting code.

You have a few problems. Firstly, you can't have a function within a function. Take a look at this code.

;set the hotkey so when you press c, click() is called
HotKeySet("c", "click")

;make a variable and set it to false
$x = False

;wait until x is true which means c was pressed
Do
Until $x = True

;while x is true, click in a spot on the screen
While $x = True
    MouseClick("left", 740, 400, 1, 1000)
WEnd

Func click()
    ;make x equal to the opposite of what it was
    $x = Not $x
EndFunc ;==>click
Edited by dantay9
Link to comment
Share on other sites

Make sure you use code \code tags when posting code.

You have a few problems. Firstly, you can't have a function within a function. Take a look at this code.

;set the hotkey so when you press c, click() is called
HotKeySet("c", "click")

;make a variable and set it to false
$x = False

;wait until x is true which means c was pressed
Do
Until $x = True

;while x is true, click in a spot on the screen
While $x = True
    MouseClick("left", 740, 400, 1, 1000)
WEnd

Func click()
    ;make x equal to the opposite of what it was
    $x = Not $x
EndFunc ;==>click

thanks
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...