AutoHotkey Community

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: help with loop?
PostPosted: June 16th, 2005, 10:54 am 
ok im a total noob, so please dont flame.

i have looked and i still couldnt find what i waslooking for.

i play an online game that demands a key to be pressed for continueous action.

so what i was needing was something that would give the notion of me pushing down the shift key over and over, but while i hold it down.

i know this isnt very clear, but i was wondering if there is a loop command that would allow me to just hold down the shift key, and it would simulate me pushing it over and over, but when i let up off the shift key it would stop.

any help would be greatly appreciated.

thank you ahead of time.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 16th, 2005, 12:40 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Try the following left-Shift hotkey. It might need some refinement:
Code:
*LShift::
SetStoreCapslockMode off
SetKeyDelay -1
Loop
{
   Send {LShift down}
   Sleep 40
   Send {LShift up}
   GetKeyState, LShift, LShift, P
   if LShift = U
      break
   Sleep 40
}
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2005, 6:20 am 
thanx man, i'll giver a try :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2005, 6:37 am 
didnt work :/ anyone got any suggestions?


Report this post
Top
  
Reply with quote  
 Post subject: For over-18 gamers -
PostPosted: June 17th, 2005, 7:30 pm 
Offline

Joined: June 1st, 2005, 11:09 am
Posts: 54
Location: Scotland
You could prod the keyboard with some kind of battery-operated adult toy... (These go quite cheap in some stores - made in China?)

Some games bypass AutoHotkey, at least unless you get creative...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2005, 10:50 pm 
Offline

Joined: April 16th, 2005, 1:05 am
Posts: 28
The script above might have worked but this one may be a bit cleaner:
Code:
LShift::
Loop
{
   ;sleep, 100 ;you can have the sleep if you want a delay between firing
   GetKeyState, LState, LShift, P
   If LState = U
   {
      Send, {LShiftUp}
      break
   }
   else
   {
      Send, {LShift}
   }
}
exit

_________________
cstone


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 19th, 2005, 8:04 pm 
ok i tried it and it worked, except it didnt press it fast enough.

is there anyway to speed the loop up? or is that as fast as it gets?

btw, thank you for your help, it is greatly appreciated.

u guys pawn.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 19th, 2005, 8:16 pm 
Offline

Joined: April 16th, 2005, 1:05 am
Posts: 28
there is no way to speed up the loop unless you take the Sleep, 100 out. though i think that line is commened out. if not take it out and if it still isn't has fast enough, then there is nothing that can be done other then increase the speed of you computer.

increaseing the speed of your computer only only speeds up the time it takes your computer to read, evaluate, and exacute each line of the code.

_________________
cstone


Last edited by cstone on June 20th, 2005, 9:00 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 20th, 2005, 2:02 pm 
Offline

Joined: June 1st, 2005, 11:09 am
Posts: 54
Location: Scotland
cstone wrote:
there is no way to speed up the loop unless you take the Sleep, 100 out. though i think that line is commened out. if not take it out and if it still isn't has fast enough, then there is nothing that can be done other then increase the speed of you computer.

Well, there are several performance controls in AHk that by default protect your computer from being crashed by a script; about half a dozen options are described in online help under "Performance". However, on the face of it, the script does nothing but flip Shift up and down with no delay. I suggest it runs /too/ fast; I can press Shift around 65 times in 10 seconds, I think, and no sensible game action will be much faster than that. Try Sleep, 150; also, perhaps, try the on-screen keyboard (under Accessories/Accessibility in Windows XP and earlier) and see how fast you can get it to respond to Shift down or up... I haven't yet checked that that works.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 23rd, 2005, 5:25 am 
once again thank you, i will try and let you know what im comming up with.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: chaosad, Exabot [Bot], Google Feedfetcher, jrav and 19 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