AutoHotkey Community

It is currently May 26th, 2012, 11:58 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: October 1st, 2009, 4:13 pm 
Hello,

trying to solve goal for Age of Conan. MMO.
U have to Select party man. (F1 - F5) then press assist to take his target.

I would like to have only one button.

Idea : I will press Fx button twice as pre-select. Then only press {f} when i wnat to asit my mate.

Code:

~F1::
~F2::
~F3::
~F4::
~F5::
if u_tankpress > 0 ; SetTimer already started, so we log the keypress instead.
{
    u_tankpress += 1
    return
}
; Otherwise, this is the first press of a new series. Set count to 1 and start
; the timer:
u_tankpress = 1
SetTimer, u_SpankAction, 300 ; Wait for more presses within a 500 millisecond window.
return

u_SpankAction:
if  u_tankpress>1
 u_tank={F1}
return

$f:: Send %u_tank%{f}


Problem is red line. Would like to know how to save "Actual_Keypress" to u_tank variable.

possible solution is create 5 similar block of code with one line diferent but its ugly.

Thx a lot for any advice.


Report this post
Top
  
Reply with quote  
PostPosted: October 1st, 2009, 4:48 pm 
Offline

Joined: July 5th, 2007, 6:30 pm
Posts: 65
Location: www.newfreethinker.com
I don't understand why you want the pre-select to be two of the same keys. Why not just work with ONE? You will simply send the last F1-F5 selected. In any event, I hope this helps =)

Code:
$f::Send %keytosend%

$F1::
$F2::
$F3::
$F4::
$F5::
keytosend := A_ThisHotkey
stringtrimleft, keytosend, keytosend, 1
keytosend = {%keytosend%}f
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 2nd, 2009, 4:09 pm 
Thx Rad777 for tip!
A_ThisHotkey was the system variable i was looking for.
The final script is:
Code:
; ********************************************************************
; ****************** Spank Asistent **********************************
; ********************************************************************
$f::
   Send %u_SpankAssist%A_ThisHotkey
   return

~F1::
~F2::
~F3::
~F4::
~F5::
if (u_TankPress > 0) ; SetTimer already started, so we log the keypress instead.
  {
  u_TankPress += 1
  return
  }
; Otherwise, this is the first press of a new series. Set count to 1 and start
; the timer
u_TankPress = 1
SetTimer, u_SpankAction, 300 ; Wait for more presses within a 300ms window.
return

u_SpankAction:
  if (u_TankPress > 1){ ;* On multiple press preselect new Tank
   
   u_SpankAssist := A_ThisHotkey
   stringtrimleft, u_SpankAssist, u_SpankAssist, 1
  }
  u_TankPress = 0 ;* dont forget reset counter in all cases
return


Reason to pre-select is:
Tank asist is used in battle -- fast reaction is needed. But tank position in group can change. Thats i need one button for battle, just press and assist. But have a time before battle to choose which of ma friend will act as tank. More over controll toselect party man have same function like before. :-]


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 2nd, 2009, 5:07 pm 
Advanced Version
extensively using build-in Variables

Code:
; ********************************************************************
; ****************** Spank Asistent **********************************
; ********************************************************************
$f::
   Send %u_SpankAssist%f
   return

~F1::
~F2::
~F3::
~F4::
~F5::
;* If Double press same key in 400ms
if (A_ThisHotkey = A_PriorHotkey and A_TimeSincePriorHotkey < 400) {
    u_SpankAssist := A_ThisHotkey   ;* get SpankAsist
    stringtrimleft, u_SpankAssist, u_SpankAssist, 1 ;* substract "~"
   }
return


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, Google [Bot], hyper_, Leef_me, Pulover, RaptorX, rbrtryn, XstatyK, Yahoo [Bot] and 17 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