Jump to content
AC Tool Forums

Set random number of loops?

Recommended Posts

Sorry if this is a stupid question but I havent found my answer yet.

Im wondering if there is a way to set a random number of loops - say between 1 and 100 loops

I have a script that clicks two buttons with a random delay between but im not sure how to apply that to the loop condition.

This is what i have currently but would like to change to random loops as well

loop 200
keys `
 RandomInteger = 0
 Maxval = 0
 Minval = 0

SetConst Maxval = 800
Setconst Minval = 150

Compute RandomInteger = int(($Maxval - $Minval + 1) * rnd(1)) + $Minval
Delay $RandomInteger
keys 1

Share this post

Link to post
Share on other sites

There is/was something in the forums, Bear, I think, wrote a random loop generator script somewhere, I recall seeing it a while ago.

I will see if I can find it


Share this post

Link to post
Share on other sites

rnd = 0

Procedure RANDOM using LO, HI
Compute rnd = INT(($HI - $LO + 1) * rnd(1) + $LO)

Call RANDOM 10,200 //could be any minimum and maximum number range you wish.

loop $rnd
// do stuff

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use and to our Privacy Policy.