Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

randomly counted loop


  • Please log in to reply
5 replies to this topic
kubakiermasz
  • New members
  • 2 posts
  • Last active: Sep 01 2015 05:43 PM
  • Joined: 31 Aug 2015

Hello guys!
I need loop in that script randomly counted. Can u help me :D?
 

#w::
Random, rand, 100, 1000
send {space down}
 
Loop
{
send {w down}
send {e down}
send {3 down}
send {3 up}
}
 
Esc::ExitApp
return


kon
  • Members
  • 1652 posts
  • Last active:
  • Joined: 04 Mar 2013

I need loop in that script randomly counted.

If you mean the number of loops is random:

Loop, %rand%



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

Once you make kon's change, do note that when the Loop does it's 100, 1000, or anywhere in between number of times sending those keys, it will run whatever line comes after that closing bracket }. This will be the ExitApp line with your given code.

 

Additionally, why do you need to keep sending w and e into down states? Once you send them down, you need to send an up stroke to release them. When you send {w down} after w is already down, it's like trying to press a key that is stuck on your keyboard. It's already there doing it's job.



kubakiermasz
  • New members
  • 2 posts
  • Last active: Sep 01 2015 05:43 PM
  • Joined: 31 Aug 2015

I just need to hold it down, all the time, but, when i made this like "send {space down} it doesn't work.

Do you know how can i hold w, e and space all the time down and randomly clicking "3" ?

Once you make kon's change, do note that when the Loop does it's 100, 1000, or anywhere in between number of times sending those keys, it will run whatever line comes after that closing bracket }. This will be the ExitApp line with your given code.

 

Additionally, why do you need to keep sending w and e into down states? Once you send them down, you need to send an up stroke to release them. When you send {w down} after w is already down, it's like trying to press a key that is stuck on your keyboard. It's already there doing it's job.



Masonjar13
  • Members
  • 1517 posts
  • Last active:
  • Joined: 16 Sep 2012

Cleaned it up a bit. Since there's no delay between 3-down and 3-up, there's not really a point it separating them. This will send space, w, and e down, while sending 3 as fast as possible for 100-1000 iterations. Inserting a sleep would probably be better for what you want. If you want the 3 to be randomly clicked (timing), you need to sleep for rand with Random being inside the loop.

#w::
Random, rand, 100, 1000
send {space down}{w down}{e down}
Loop %rand%
{
    send {3}
    ;sleep 10
}
;send {space up}{w up}{e up}
return

Esc::ExitApp

OS: Windows 7 Ultimate / Windows 8.1 Pro | Editor: Notepad++


Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012


I just need to hold it down, all the time,

 


and randomly clicking "3" ?

 

Taking MAsonjar13's code (note that any line that starts with a semicolon is a comment and is not an executed code)

 

#w::
send {space down}{w down}{e down}
Loop
{
    send {3}
    Random, rand, 100, 1000
    sleep %rand%
}
;send {space up}{w up}{e up}
return

Esc::ExitApp

 

Based on the quotes from what you said in the follow up reply, this sounded more like what you wanted.

 

This code will make it so repeatedly a random value of 100 through 1000 is chosen and the script will wait that many milliseconds between {3} keystrokes. This will always hold down Space, W, and E, and then randomly send the 3 key and each lag time between {3} keystrokes will be different than the previous.

 

I left that one comment line there because I made the Loop an indefinite loop - you'll only ever get it to stop when you press Esc.