AutoHotkey Community

It is currently May 27th, 2012, 12:08 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 91 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7  Next
Author Message
 Post subject:
PostPosted: January 24th, 2012, 4:40 pm 
Vote-------- and just to be sure I'll quote Mr Horse: "No, sir I don't like it"


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 25th, 2012, 4:21 pm 
Offline

Joined: January 29th, 2009, 9:50 pm
Posts: 483
Location: Belgium
instead of:
Code:
i:=0 ; you dont need this line
F7::SetTimer, Spam, % (i:=!i) ? "100" : "Off" ; uses ternary
Spam:
   Click
   Send a
   return
i use:
Code:
F7::SetTimer, F8, % (i:=!i) ? "100" : "Off" ; Press F7 to do the action repeatedly or to turn the repead off
F8::Send,{Click}a                           ; Pres F8 to do the action once
same result, exept i can still triger it once at the time.

_________________
Stopwatch emdkplayer
the code i post falls under the: WTFYW-WTFPL license


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 25th, 2012, 4:49 pm 
Offline

Joined: January 29th, 2009, 9:50 pm
Posts: 483
Location: Belgium
petur170 wrote:
Hi there, thanks for the scripts, but can you make a code where you press ctrl and then whenever your hold down left button you rapid fire (1 per 30 milliseconds until you press ctrl again (ctrl is a toggle). I'm not really a coder and i'm a bit lazy so,

Thanks alot!
Code:
~ctrl::Toggle := !Toggle
~lbutton::
    If Toggle
      while GetKeyState("LButton","P")
         Send a
   returna
happy testing
you might want to add sleep,30 ore something

_________________
Stopwatch emdkplayer
the code i post falls under the: WTFYW-WTFPL license


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Toggle Key
PostPosted: March 24th, 2012, 1:13 am 
Offline

Joined: October 16th, 2007, 1:14 pm
Posts: 20
It would really awesome if you could comment the scripts in the first post.

For example, in The Toggle, it starts with F8, sends an A and also a click.
Why the click?

The click caused a runaway condition which was a bit difficult to break from. I was able to break using task manager.

Anyway, I wanted a key to toggle when pressed, so pressing once would keep it down, and pressing again would stop pressing down - the purpose to always-run in Diablo II.

I figured it out and posted here:
http://www.autohotkey.com/forum/viewtopic.php?p=523325#523325


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Toggle Key
PostPosted: March 24th, 2012, 1:41 am 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
CoreTwo wrote:
Why the click?

So that the area which you can edit is more recognizable.

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 8th, 2012, 5:28 pm 
hello, i'm trying to work a custom autofire (with several time interval to choose from), based on the hold down type, which worked pretty fine at first.

but, while modifying it, i encountered a problem : it doesn't stop even when releasing the key.
since i don't know precisely what caused this (i think it was when i started to try using Input to choose the interval from a pool), i simply decided to start over from scratch.

so now, here is my new base script, which still has the same problem:
Code:
EnableAutoFire = 0

~WheelDown::
KeyWait, WheelDown, D
If EnableAutoFire = 0
   EnableAutoFire = 1
else
   EnableAutoFire = 0
return

~$LButton::
While (GetKeyState ("LButton", "P") && EnableAutoFire) {
   Click
   Sleep 180
}
return


here is what it should do:
1) enabling / disabling autofire with mouse wheel down
2) repeatedly send a click event as long as autofire is on and the left mouse button is pressed

1) works just fine
2) doesn't work. it starts sending clicks when the left button is pressed, but doesn't stop when the button is released.
using the mouse wheel down stop the firing just fine though. this behaviour is the same in the game, in notepad++, firefox or just any software in Windows

apparently, the problem comes from the GetKeyState ("LButton", "P") which doesn't return the right value.
in fact, adding MsgBox % GetKeyState ("LButton", "P") in the loop will pop up a message box saying LButton instead of 1 or 0 whether the button is still pressed or not.


any idea?

i already tried reinstalling autohotkey, didn't solve anything.


Report this post
Top
  
Reply with quote  
PostPosted: May 8th, 2012, 5:40 pm 
Guest wrote:
apparently, the problem comes from the GetKeyState ("LButton", "P")

ok, my bad.
bad habits getting the worst of me, i've put an extra space between the function name and its arguments for better readability.
how come i notice this just now?
sorry.


Report this post
Top
  
Reply with quote  
PostPosted: May 22nd, 2012, 6:22 am 
Offline
User avatar

Joined: February 17th, 2011, 6:48 pm
Posts: 427
Location: peering out from behind my favorite rock
I suggest altering the code for "The Toggle" in your original post. As it is:
Code:
toggle = 0
#MaxThreadsPerHotkey 2

F8::
    Toggle := !Toggle
     While Toggle{
        Click
        Send a
        sleep 100
    }
return

it will not behave in a desirable fashion when it's hotkey is held longer than Window's repeat delay. You can eliminate this issue by changing the Sleep time from 100 to 1.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 22nd, 2012, 7:35 pm 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
The sleep time is intentionally 100 - that means 10 clicks and A's per second.

Would KeyWait work?

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 22nd, 2012, 7:56 pm 
Offline
User avatar

Joined: February 17th, 2011, 6:48 pm
Posts: 427
Location: peering out from behind my favorite rock
The problem is not affected by the presence or absence of KeyWait. It arises (as Leef_me explained) because hotkeys are being pressed faster (via Windows' key repeat) than the hotkey code is processing them. Sleeping 100ms slows processing to the point that this situation occurs.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 22nd, 2012, 8:55 pm 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
In that case, the only solutions are to either use the SetTimer toggle method instead, or to press the key for a period of time shorter than the key-repeat wait time. I'll update the OP.

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 23rd, 2012, 2:52 pm 
Offline
User avatar

Joined: February 17th, 2011, 6:48 pm
Posts: 427
Location: peering out from behind my favorite rock
nimda wrote:
In that case, the only solutions are to either use the SetTimer toggle method instead, or to press the key for a period of time shorter than the key-repeat wait time.

Another solution worked for me; did you try it?

Code:
toggle = 0
#MaxThreadsPerHotkey 2

F8::
    Toggle := !Toggle
     While Toggle{
        Click
        Send a
        sleep 1
    }
return

nimda wrote:
I'll update the OP.

I'm looking forward to that. :)


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 23rd, 2012, 7:52 pm 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
Quote:
Another solution worked for me; did you try it?

Quote:
The sleep time is intentionally 100 - that means 10 clicks and A's per second.

There should be another solution though: using e.g. F8 Up:: instead of F8::

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 23rd, 2012, 10:31 pm 
Offline
User avatar

Joined: February 17th, 2011, 6:48 pm
Posts: 427
Location: peering out from behind my favorite rock
nimda wrote:
There should be another solution though: using e.g. F8 Up:: instead of F8::

Yes--that prevents the problem from occurring, but it also requires both the press and release of the hotkey, which may be less desirable to someone looking to use automation to provide faster key input.

nimda wrote:
Quote:
The sleep time is intentionally 100 - that means 10 clicks and A's per second.

If I wanted faster input, I would be more interested in "as fast as possible" than the arbitrary and relatively slow repeat rate of 10 keys per second. I think you could increase your already significant :D contribution with this thread by providing examples that approach maximum performance. (I hope to find such examples here instead of in someone else's "Definitive Autofire: Maximum Speed" thread. :P)


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 23rd, 2012, 11:38 pm 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
That is a good idea; I'll see what I can do when I have the time. IIRC, SendPlay, {LButton 2000} was as fast as clicks got (unless mouse_event exceeded it?)

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 91 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group