Left and right click key auto cycle

Ask gaming related questions
Minrah
Posts: 4
Joined: 09 Jan 2019, 12:50

Left and right click key auto cycle

09 Jan 2019, 12:54

hey guys im trying to figure out how to have left click cycle 1 2 3keys with a break and continue if i click and let go. samething for left click with 4 5 6 any help would be much appreciated.
mast4rwang
Posts: 115
Joined: 19 Jul 2017, 09:59

Re: Left and right click key auto cycle

09 Jan 2019, 16:32

Try to describe your idea clearly before asking. You didn't even include an example
Minrah
Posts: 4
Joined: 09 Jan 2019, 12:50

Re: Left and right click key auto cycle

10 Jan 2019, 12:05

left click of mouse cycles in loop of keys 1 2 3

right click of mouse cycles in loop of keys 4 5 6

if let go of click it stops, hold click it continues.
Minrah
Posts: 4
Joined: 09 Jan 2019, 12:50

Re: Left and right click key auto cycle

11 Jan 2019, 11:59

forgive me if i dont seem to make sense just got back from a 26 hour drive none stop

cy·cle
/ˈsīk(ə)l/Submit
noun
plural noun: cycles
1.
a series of events that are regularly repeated in the same order.


yeah im sure thats what i put down, cycles =)
mast4rwang
Posts: 115
Joined: 19 Jul 2017, 09:59

Re: Left and right click key auto cycle

11 Jan 2019, 12:52

It i still very complicated... Cycles in loop is basically as saying loops in a loop and it makes no sense.
If you could write down exact steps you need to accomplish I might be able to help you :D

Example of a script:
1.I press the number 1 key.
2.AHK sends left button down repeatedly in specific intervals.
3.I unpress the number 1 key.
4.AHK stops sending left button repeatedly.
Minrah
Posts: 4
Joined: 09 Jan 2019, 12:50

Re: Left and right click key auto cycle

11 Jan 2019, 15:45

yeah not sure if I can.

Left mouse click = loop of keys 1 2 3

Right mouse click = loop of keys 4 5 6

while in loop if stopped, holds then continues when clicking again.

meaning if I hold the loop and stop at 2 in the loop when i reclick it will continue from 2 in the loop.

not sure how else i can explain =(
User avatar
Masonjar13
Posts: 1407
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: Left and right click key auto cycle

12 Jan 2019, 17:45

It's explained quite clearly. You just need to have a loop that checks if the particular key is still being held, along with a hotkey.

Code: Select all

$LButton::
while(getKeyState("LButton","P"))
    send 123
return
$RButton::
while(getKeyState("RButton","P"))
    send 456
return
As it's written here, it won't work if both are held at the same time. That can be changed though, if you want it to work like that.
mast4rwang
Posts: 115
Joined: 19 Jul 2017, 09:59

Re: Left and right click key auto cycle

12 Jan 2019, 17:58

It is not clear at all @Masonjar13, what you wrote will not work 9 times out of 10 because you have no context (it will only work in notepad for testing and if lucky, in web browser game chat?). For example OP said he needs to memorize last button and continue the loop from the button it last stopped. This means he most likely needs a physical button press simulation, with delays, maybe to use in a game? What if it's not a chat window? Your script will not register at all in that case.

At OP: while you hold left button the program must send 1, wait, send 2, wait, send 3, wait, send 1, etc... ? and when you release the button it stops but the next time you hold left button it continues from the number it stopped at previously?
mast4rwang
Posts: 115
Joined: 19 Jul 2017, 09:59

Re: Left and right click key auto cycle

12 Jan 2019, 18:18

Here's a test script to see if it does what you want. Press "A" to try:
Spoiler
User avatar
Masonjar13
Posts: 1407
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: Left and right click key auto cycle

14 Jan 2019, 03:46

.. I'll just blatantly ignore your response, seeing as it makes no sense and that code is.. pretty bad. Though, yes, I did miss where OP asked to keep the cycle when stopped. Easy fix.

Code: Select all

setKeyDelay,25,25 ; good starting point for games
arr1:=[1,2,3]
arr2:=[4,5,6]
arr1L:=arr2L:=1

$^F1::t:=!t

#if t
$LButton::
while(getKeyState("LButton","P") && t){
    send % arr1[arr1L]
    arr1L:=++arr1L>arr1.maxIndex()?1:arr1L
}
return
$RButton::
while(getKeyState("RButton","P") && t){
    send % arr2[arr2L]
    arr2L:=++arr2L>arr2.maxIndex()?1:arr2L
}
return
I also added a toggle so it won't effectively disable the mouse buttons (Ctrl+F1).
mast4rwang
Posts: 115
Joined: 19 Jul 2017, 09:59

Re: Left and right click key auto cycle

14 Jan 2019, 05:34

You didn't ignore my response and just made a fool out of yourself once again :D

Also did you even test your "pretty good" code? It is nowhere near applicable. But you got to love that "good starting point for games" comment. Maybe after a year of trial and error learning from that starting point you might produce something which actually works? :bravo:
WarnerLok
Posts: 10
Joined: 21 Dec 2018, 06:20
GitHub: WarnerLok
Location: Panama
Contact:

Left and right click key auto cycle

Yesterday, 07:31

I think this has expired before I could check it out . . .

If it has not expired, will you point me to the correct information?

Thanks
mast4rwang
Posts: 115
Joined: 19 Jul 2017, 09:59

Re: Left and right click key auto cycle

Yesterday, 15:47

mast4rwang wrote:
12 Jan 2019, 18:18
Here's a test script to see if it does what you want. Press "A" to try:
Spoiler

This code will never expire because it simulates physical button press. You can test it and edit as you like

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 12 guests