AutoHotkey Community

It is currently May 27th, 2012, 3:40 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: help with toggle script
PostPosted: July 18th, 2010, 11:27 pm 
Offline

Joined: June 21st, 2010, 12:04 am
Posts: 6
i want a script that every time i press a key (x) it inputs either 1, 2, 3, 4, 5, or 6. Each of these numbers have a different timer on them (9, 12, 16seconds, etc.

So each time i press (x), itll send either 1, 2, 3,... depending on which timers are up atm. For example with 3 keys
1 has 3second timer
2 has 6 second timer
3 has 9 second timer
I press X, X sends 1, i mouseclick, 1 is now on timer
I press X, X sends 2, i mouseclick, 2 is now on timer
I press X, X sends 3, i mouseclick, 2 is now on timer
1 is off timer
i press x, x sends 1, i mouseclick
1 is off timer again
i press x, xsends 1, i mouseclick
2 is off timer

etc....


this is what i have so far:


Code:
high_key = 6
second_multiplier := 1000
Action1_delay := second_multiplier * 13
Action2_delay := second_multiplier * 14
Action3_delay := second_multiplier * 6
Action4_delay := second_multiplier * 14
Action5_delay := second_multiplier * 9
Action6_delay := second_multiplier * 9

return

x::
Loop %high_key% {
   ;MsgBox, %A_Index% ; A_Index is the iteration number of loop
   if ( Action%A_Index%_isset != true ) {
      if IsLabel("Action" . A_Index){
         Action%A_Index%_isset := true ;
         SetTimer, Action%A_Index%, % Action%A_Index%_delay
         break ;
      }
      }
   }
Return


Action1:

   SetTimer, %A_ThisLabel%, Off
   
   Send, +{Numpad1}
   KeyWait, Lbutton, d
   KeyWait, LButton

   %A_ThisLabel%_isset := false
   Sleep 500
return

Action2:

   SetTimer, %A_ThisLabel%, Off
   
   Send, +{Numpad2}
   KeyWait, Lbutton, d
   KeyWait, Lbutton

   %A_ThisLabel%_isset := false
   Sleep 500
return

Action3:

   SetTimer, %A_ThisLabel%, Off
   
   Send, +{Numpad3}
   KeyWait, Lbutton, d
   KeyWait, Lbutton

   %A_ThisLabel%_isset := false
   Sleep 500
return

Action4:
   
   SetTimer, %A_ThisLabel%, Off
   
   Send, +{Numpad4}
   KeyWait, Lbutton, d
   KeyWait, Lbutton

   %A_ThisLabel%_isset := false
   Sleep 500
return

Action5:
   
   SetTimer, %A_ThisLabel%, Off

   Send, +{Numpad5}
   KeyWait, Lbutton, d
   KeyWait, Lbutton

   %A_ThisLabel%_isset := false
   Sleep 500

return

Action6:
   
   SetTimer, %A_ThisLabel%, Off
   
   Send, +{Numpad6}
   KeyWait, Lbutton, d
   KeyWait, Lbutton

   %A_ThisLabel%_isset := false
   Sleep 500
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 18th, 2010, 11:30 pm 
Offline

Joined: June 21st, 2010, 12:04 am
Posts: 6
Problem with what i have is that on pressing x, it does not immediately send 1.
2nd problem is that when i dont press x, it still sometimes sends a number
3rd problem is that sometimes even when 1 is off timer, pressing x does not load 1. (not limited to 1, some of others dont load either)

4, i would also like for there to be a preference. that is if both 1 and 4 are off timer, i would prefer it to send 1 over 4. basically 1-3 are prefereed over 4-6


by 1-6 i of course mean shift + numpad 1-6

thanks in advance


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 19th, 2010, 6:32 pm 
Offline

Joined: June 21st, 2010, 12:04 am
Posts: 6
can aynone help please?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 19th, 2010, 7:08 pm 
Offline

Joined: August 3rd, 2009, 4:44 pm
Posts: 69
Location: UK
is this for a game because shift + numpad numbers does nothing


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 20th, 2010, 9:04 pm 
Offline

Joined: June 21st, 2010, 12:04 am
Posts: 6
yes it is, and i still would like some help with this


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: bobbysoon, Google Feedfetcher, Wicked and 14 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