 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Anonymous Coward Guest
|
Posted: Tue Jun 21, 2005 11:34 am Post subject: FarCry - Hotkeys - HELP! |
|
|
Hi there!
Anybody been working on an AutoHotkey script for the game FarCry?
I've been trying to make it work, but somehow it doesn't...
Any tips?
| Code: | #InstallKeybdHook
$F1::
SpeakTo = a
Say = lol
GetWinAndSend(SpeakTo, Say)
return
$F2::
SpeakTo = team
Say = flag!
GetWinAndSend(SpeakTo, Say)
return
GetWinAndSend(SpeakTo, Say)
{
; SetTitleMatchMode, 1
; IfWinActive, - Far Cry -
; {
If SpeakTo = a
{
SpeakTo = z ; speak to all
}
else
SpeakTo = u ; speak to team
Send, %SpeakTo%
Sleep, 500
Send, %Say%
Sleep, 500
Send, {ENTER}
; }
}
return |
Regardless of whether I comment out the 'IfWinActive' part or not, it won't send...
Ideas? |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Jun 21, 2005 12:02 pm Post subject: |
|
|
From the FAQ:
Some games use DirectInput exclusively. As a side-effect, they might ignore all simulated keystrokes and mouse clicks. Although there is currently no workaround for this, in certain other games, increasing SetKeyDelay might help with the Send command. Try one of these:
SetKeyDelay, 10, 10
SetKeyDelay, 0, 10
(I just added the following section):
It has also been observed that the following products are able to send keystrokes and mouse clicks to a wider variety of games than other macro programs: Journal Macro, QuicKeys, KeyGO, OnHand, and Toggle Keyboard. Update: AutoHotkey now supports SendPlay, which is believed to work in a broader variety of games.
Last edited by Chris on Thu Mar 30, 2006 4:44 pm; edited 1 time in total |
|
| Back to top |
|
 |
Anonymous Coward Guest
|
Posted: Tue Jun 21, 2005 12:29 pm Post subject: |
|
|
Thank you for your swift reply!
The 'SetKeyDelay' setting did help, but I still have problems...
If I try the first hotkey (F1), it should insert 'z' (the key for 'say to all') then 'lol' and then an enter...
However, sometimes it doesn't do anything, sometimes it inserts 'lollllllllllll' and stops there (no enter), and sometimes it works...
Any thoughts?
I tried both of your suggestions... |
|
| Back to top |
|
 |
Anonymous Coward Guest
|
Posted: Tue Jun 21, 2005 12:38 pm Post subject: |
|
|
Ok, it appears to be a timing issue...
Well, atleast it 'works' somehow now
Excellent... I'll keep tweaking, and post the result here...
Thank you very much for your help sofar, this is by far the most helpful forum I ever encountered Keep up the good work! |
|
| Back to top |
|
 |
Anonymous Coward Guest
|
Posted: Tue Jun 21, 2005 1:46 pm Post subject: |
|
|
I modified the script to this version:
| Code: | #InstallKeybdHook
#SingleInstance force
SetBatchLines, -1
SetKeyDelay, 5, 15
menu, TRAY, icon, farcry.ico
;
$Numpad0::
SpeakTo = a
Say = testing... testing... $3 ... 123456
GetWinAndSend(SpeakTo, Say)
return
;
$Numpad1::
SpeakTo = team
Say = flag!
GetWinAndSend(SpeakTo, Say)
return
;
GetWinAndSend(SpeakTo, Say)
{
SetTitleMatchMode, 1
IfWinActive, - Far Cry -
{
If SpeakTo = a
{
SpeakTo = PGUP ; speak to all
}
else
SpeakTo = PGDN ; speak to team
clipboard = %Say%
Send, {%SpeakTo%}
Sleep, 50
Send, {CTRLDOWN}
Send, v
Send, {CTRLUP}
;Send, %Say%
Sleep, 50
Send, {ENTER}
}
}
return
|
I use the clipboard now to send the desired strings... However, since CONTROL is used in the game to duck, 'sometimes' the hotkey invokes this, so it ducks, instead of pasting...
What can I do to prevent/circumvent this? Sure, I could use another key for ducking, but is it possible to keep it? |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Jun 21, 2005 1:55 pm Post subject: |
|
|
| Quote: | | ...since CONTROL is used in the game to duck, 'sometimes' the hotkey invokes this, so it ducks, instead of pasting | You could try using ControlSend in its alternate mode described in the help file. But it's a long shot because ControlSend doesn't always work in games. |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Jun 21, 2005 2:19 pm Post subject: |
|
|
At the risk of sounding stupid:
Doesn't do anything...
What do I do wrong? |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Jun 21, 2005 2:32 pm Post subject: |
|
|
Found it!
(rtfm, rtfm, rtfm... ) |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Jun 21, 2005 3:55 pm Post subject: Anonymous Coward |
|
|
Still working on the 'workaround' for the control-key...
This is what I got sofar:
| Code: | | ControlSend, ahk_parent,{CTRLDOWN}v{CTRLUP}, ahk_class CryENGINE |
Doesn't work however... I suppose it's the ahk_parent part? Or maybe the ControlSend doesn't work in the game, regardless...
How can I find out if and what the ClassNN (the classname and instance number of the control) or the name/text of the control is? I cannot activate nor 'freeze' Window Spy when the game is active...
If this is not possible, any alternatives for the pasting? Since the control+v part is giving me the problems...
Or am I really forced to change the keys in the game? |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Jun 21, 2005 4:22 pm Post subject: |
|
|
Tried:
| Code: | | Control, EditPaste, test,,- Far Cry - |
Doesn't work either...
Anyone ideas on how to paste other than with control+v? |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Jun 21, 2005 4:46 pm Post subject: |
|
|
Tried:
| Code: | | ControlSetText, , test, - Far Cry - |
But this changes the title of the game/window to 'test'...
Hmpf... if I could somehow get the ClassNN of the control... |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Jun 21, 2005 5:10 pm Post subject: |
|
|
| Can somebody tell me if and how it is possible to get ClassNN with Winspector Spy? |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Wed Jun 22, 2005 10:06 pm Post subject: |
|
|
There might not be a control because most games don't use them. If neither of the following work (which you probably have tried), I think I'm out of ideas:
ControlSend, ahk_parent,{CTRLDOWN}v{CTRLUP}, ahk_class CryENGINE
ControlSend, ,{CTRLDOWN}v{CTRLUP}, ahk_class CryENGINE |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Jun 23, 2005 2:09 pm Post subject: |
|
|
Thanks for your reply, but both methods didn't work
So, I'll have to change the keybindings in the game itself I guess...
Unless someone knows a way to paste without using control+v?
Someone?
Regardless, thanks for your great help...
I'll post the result if done. |
|
| Back to top |
|
 |
Spike
Joined: 24 Jun 2005 Posts: 12
|
Posted: Fri Jun 24, 2005 1:38 am Post subject: |
|
|
Unless someone knows a way to paste without using control+v?
Someone?
Have you tried Shift Insert ??
hth
Spike |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|