ok rly need help not sure if the scripting im using is correct.
basicaly im trying to make the macro create a random position click within a set of coords would this be the correct scripting to use?
X = Algorithms.randomInteger(59,226)
Y = Algorithms.randomInteger(603,742)
XY = new Point(X, Y)
Click, (XY) Left, 1
or would it be somthing more like this
X = (59,226)
Y = (603,742)
XY = random(X, Y)
making random movements
Re: making random movements
The help file that comes with AutoHotkey shows the syntax to use and has examples. There is also a link at the top of this page to a list of commands and their documentation.
Code: Select all
; CoordMode, Mouse, Screen ; Optional
#a:: ; Win+A hotkey
Random, xpos, 59, 226
Random, ypos, 603, 742
Click %xpos%, %ypos%
return
Re: making random movements
well that aint workin for me or im doing it wrong to to me that looks lick ure tring to make it click 2 different positionsnot only that its just making me fly down the screen
wouldnt you be better
Random := "xpos, 59, 226"
Random := "ypos, 603, 742"
xypos := xpos " " ypos
Click := xypos " Left 1"
here ill show you where its supposed to be
FindsBB:
CoordMode, Pixel, Window
ImageSearch, FoundX, FoundY, 8, 71, 1373, 775, C:\Users\UKSAS\AppData\Roaming\MacroCreator\Screenshots\Screen_20140707122608.png
If ErrorLevel = 0
{
Goto, ShipStability
}
If ErrorLevel
{
Goto, Movement
}
ShipStability:
Click, 677, 570 Left, 1
Sleep, 10
Sleep, 800
VerificationOfBB:
CoordMode, Pixel, Window
ImageSearch, FoundX, FoundY, 8, 71, 1373, 775, C:\Users\UKSAS\AppData\Roaming\MacroCreator\Screenshots\Screen_20140707122608.png
If ErrorLevel = 0
Click, %FoundX%, %FoundY% Left, 1
Sleep, 1650
Goto, PauseToSearchForMoreBB
Movement:
//heres where it goes in
Random := "xpos, 59, 226"
Random := "ypos, 603, 742"
xypos := xpos " " ypos
Click := xypos " Left 1"
//rest of code
Sleep, 1000
Goto, FindsBB
PauseToSearchForMoreBB:
Sleep, 50
CoordMode, Pixel, Screen
ImageSearch, FoundX, FoundY, 8, 71, 1373, 775, *15 C:\Users\UKSAS\AppData\Roaming\MacroCreator\Screenshots\Screen_20140707122608.png
If ErrorLevel = 0
{
Goto, FindsBB
}
If ErrorLevel
{
Goto, CantFindBB
}
CantFindBB:
MsgBox, 16, Dumbass, "OMFG commander I cant find the BB RTFM"
i need the script to click random locations ithing a target area
wouldnt you be better
Random := "xpos, 59, 226"
Random := "ypos, 603, 742"
xypos := xpos " " ypos
Click := xypos " Left 1"
here ill show you where its supposed to be
FindsBB:
CoordMode, Pixel, Window
ImageSearch, FoundX, FoundY, 8, 71, 1373, 775, C:\Users\UKSAS\AppData\Roaming\MacroCreator\Screenshots\Screen_20140707122608.png
If ErrorLevel = 0
{
Goto, ShipStability
}
If ErrorLevel
{
Goto, Movement
}
ShipStability:
Click, 677, 570 Left, 1
Sleep, 10
Sleep, 800
VerificationOfBB:
CoordMode, Pixel, Window
ImageSearch, FoundX, FoundY, 8, 71, 1373, 775, C:\Users\UKSAS\AppData\Roaming\MacroCreator\Screenshots\Screen_20140707122608.png
If ErrorLevel = 0
Click, %FoundX%, %FoundY% Left, 1
Sleep, 1650
Goto, PauseToSearchForMoreBB
Movement:
//heres where it goes in
Random := "xpos, 59, 226"
Random := "ypos, 603, 742"
xypos := xpos " " ypos
Click := xypos " Left 1"
//rest of code
Sleep, 1000
Goto, FindsBB
PauseToSearchForMoreBB:
Sleep, 50
CoordMode, Pixel, Screen
ImageSearch, FoundX, FoundY, 8, 71, 1373, 775, *15 C:\Users\UKSAS\AppData\Roaming\MacroCreator\Screenshots\Screen_20140707122608.png
If ErrorLevel = 0
{
Goto, FindsBB
}
If ErrorLevel
{
Goto, CantFindBB
}
CantFindBB:
MsgBox, 16, Dumbass, "OMFG commander I cant find the BB RTFM"
i need the script to click random locations ithing a target area
- Blackholyman
- Posts: 1293
- Joined: 29 Sep 2013, 22:57
- Location: Denmark
- Contact:
Re: making random movements
kon is just showing you the right syntex to use aka the way to write it to make it work...
the way you are trying to write it will not work
maybe you can try and do the Tutorial it just may help.
the way you are trying to write it will not work
maybe you can try and do the Tutorial it just may help.
Courses on AutoHotkey
My Autohotkey Blog
![Yay! Dance! Yay! :dance:](./images/smilies/dance.gif)
Re: making random movements
Yes, syntEx is really important. ![Wink ;)](./images/smilies/icon_e_wink.gif)
![Wink ;)](./images/smilies/icon_e_wink.gif)
![Image](https://joedf.github.io/assets/img/user/ahkneedhelp.gif)
![Image](https://joedf.github.io/assets/img/user/ahkfoundation.gif)
![Image](https://joedf.github.io/assets/img/user/mitlicense.gif)
![Image](https://joedf.github.io/assets/img/user/+greenpeace.gif)
![Image](https://joedf.github.io/assets/img/user/githubahkscript.gif)
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
- Blackholyman
- Posts: 1293
- Joined: 29 Sep 2013, 22:57
- Location: Denmark
- Contact:
Re: making random movements
Yes, yes thank you for that ![Smile :)](./images/smilies/icon_e_smile.gif)
![Smile :)](./images/smilies/icon_e_smile.gif)
Courses on AutoHotkey
My Autohotkey Blog
![Yay! Dance! Yay! :dance:](./images/smilies/dance.gif)
Re: making random movements
well i tryed that sytanx and it didnt work XD
Re: making random movements
Try something like this instead...
Code: Select all
FindsBB:
CoordMode, Pixel, Window
ImageSearch, FoundX, FoundY, 8, 71, 1373, 775, C:\Users\UKSAS\AppData\Roaming\MacroCreator\Screenshots\Screen_20140707122608.png
If(ErrorLevel = 0)
Goto, ShipStability
Goto, Movement
Return
ShipStability:
Click, 677, 570 Left, 1
Sleep, 10
Sleep, 800
Return
VerificationOfBB:
CoordMode, Pixel, Window
ImageSearch, FoundX, FoundY, 8, 71, 1373, 775, C:\Users\UKSAS\AppData\Roaming\MacroCreator\Screenshots\Screen_20140707122608.png
If ErrorLevel = 0
Click, %FoundX%, %FoundY% Left, 1
Sleep, 1650
Goto, PauseToSearchForMoreBB
Return
Movement:
xpos := rnd(59,226)
ypos := rnd(603,742)
MouseMove, %xpos%, %ypos%
Click
Sleep, 1000
Goto, FindsBB
Return
PauseToSearchForMoreBB:
Sleep, 50
CoordMode, Pixel, Screen
ImageSearch, FoundX, FoundY, 8, 71, 1373, 775, *15 C:\Users\UKSAS\AppData\Roaming\MacroCreator\Screenshots\Screen_20140707122608.png
If(ErrorLevel = 0)
Goto, FindsBB
Goto, CantFindBB
Return
CantFindBB:
MsgBox, 16, Dumbass, "OMFG commander I cant find the BB RTFM"
Return
;FUNCTIONS
/* RND()
Rnd() ; - A random float between 0.0 and 1.0 (many uses)
Rnd(6) ; - A random integer between 1 and 6 (die roll)
Rnd("") ; - New random seed (selected randomly)
Rnd("", 12345) ; - New random seed (set explicitly)
Rnd(50, 100) ; - Random integer between 50 and 100 (typical use)
*/
Rnd(a=0.0,b=1) {
IfEqual,a,,Random,,% r := b = 1 ? Rnd(0,0xFFFFFFFF) : b ;%
Else Random,r,a,b
Return r
}
Re: making random movements
now see thats how i see it grendal both the xpos and ypos should be seen as a veriable to which calls a random integer between the set numbers where as the mouse should call the variable itself.
ive still not gotten it to work lol altough im trying to work out where im going wrong
ive still not gotten it to work lol altough im trying to work out where im going wrong
Who is online
Users browsing this forum: slowwd and 83 guests