Randomised RandomBezier's code?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Manjack40
Posts: 3
Joined: 21 Jan 2018, 11:49

Randomised RandomBezier's code?

21 Jan 2018, 16:12

Hi, I'm in the process of making a script that utilises RandomBezier's random mouse movement and I ran into a little problem whilst building it.

The script, of course, works as intended, but for the life of me I can't figure out how to have the end position of the cursor randomised instead of sitting in the same X/Y coords every single time. Beforehand I'd been playing around with the random line-
Random, a, 767,777
Random, b, 755,765

Is there a way to apply this to the end result of RandomBezier's script? Is it staring me right in the face?

Any help would be greatly appreciated.

Link to his work- https://autohotkey.com/board/topic/8504 ... zier-path/
User avatar
Spawnova
Posts: 554
Joined: 08 Jul 2015, 00:12
Contact:

Re: Randomised RandomBezier's code?

21 Jan 2018, 16:25

A simple fix would simply to add a random value to your final x/y pos

Code: Select all

RandomBezier( 0, 0, x+random(-10,10), y+random(-10,10), "" ) ;if your x was 500 this would end at 490-510, same as y

Random(min,max=100) {
   random,result,min,max
   return result
}
Manjack40
Posts: 3
Joined: 21 Jan 2018, 11:49

Re: Randomised RandomBezier's code?

21 Jan 2018, 16:33

Ahah, this is what I was looking for. The script i'm trying to make would utilise many of the RandomBezier code lines, and each one would of course need it's own random end point, or would it?

After every

Code: Select all

RandomBezier( 0, 0, x+random(-10,10), y+random(-10,10)
would there need to be a

Code: Select all

Random(min,max=100) {
   random,result,min,max
   return result
}
or does there just have to be one present in the entire script for each RandomBezier to pull from?
User avatar
Spawnova
Posts: 554
Joined: 08 Jul 2015, 00:12
Contact:

Re: Randomised RandomBezier's code?

21 Jan 2018, 16:41

Manjack40 wrote:does there just have to be one present in the entire script for each RandomBezier to pull from?
Correct, as long as it is present somewhere within your script, you can use the user defined function Random().
Manjack40
Posts: 3
Joined: 21 Jan 2018, 11:49

Re: Randomised RandomBezier's code?

21 Jan 2018, 16:43

Alright, thanks a tonne for the help so quickly. I was scratching my head at it for the longest time, I'm still a little new to AHK, but it's an amazing tool really.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Mannaia666 and 418 guests