 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Sun Mar 30, 2008 4:20 am Post subject: |
|
|
| Can someone please help me and tell me where I enter scripts in Auto Hot Key, i don't understand it. |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Apr 01, 2008 3:35 pm Post subject: |
|
|
I cut and paste some parts to get a script for the medic (my first try). It works well exept of the part with the pressed Shift Button. It doesn't wait for walking and than throwing. Instead it changes to the primary weapon while runnig.
Where is the fault?
| Code: |
; AutoHotkey Version: 1.0.47.06
; Language: English
; Platform: WIN XP
;
;
; Only run this script when bf2.exe is running in the foreground
;
#SingleInstance force
#InstallKeybdHook
#InstallMouseHook
SetTimer, KeepRunning
return
KeepRunning:
; Get the process name of the active window (i.e. Notepad.exe)
WinGet, szProcessName, ProcessName, A
if szProcessName = bf2.exe
{
Suspend, off
}
else
{
Suspend, on
}
return
;
; Disable the Window's keys so they don't switch to desktop while in-game
;
$LWin:: ; Left Windows Button
$RWin:: ; Right Windows Button
; Do nothing
return
$^CapsLock::
ExitApp
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Pressing Ctrl+V while BF2 is active
;
$^v::
Sleep 200
SetKeyDelay, 40
Send, {Space}%clipboard%
SetKeyDelay, 0
return
$XButton2::
Defibrilator()
return
Defibrilator()
{
Send, {6 down}
Sleep 60
Send, {6 up}
Sleep 100
MouseClick, Left, , , , , D
sleep 400
MouseClick, Left, , , , , U
sleep 300
Send, {3 down}
Sleep 40
Send, {3 up}
}
return
$c::
$+C:: ; Shift + c (must depress Shift briefly - can't use kit while
sprinting)
ThrowMediPack()
return
ThrowMediPack()
{
Send, {5 down}
Sleep 60
Send, {5 up}
Sleep 100
MouseClick, Left, , , , , D
sleep 400
MouseClick, Left, , , , , U
Send, {3 down}
Sleep 40
Send, {3 up}
}
return
|
|
|
| Back to top |
|
 |
AZA
Joined: 10 Mar 2008 Posts: 139 Location: USA
|
Posted: Tue Apr 01, 2008 8:19 pm Post subject: |
|
|
| Anonymous wrote: | I cut and paste some parts to get a script for the medic (my first try). It works well exept of the part with the pressed Shift Button. It doesn't wait for walking and than throwing. Instead it changes to the primary weapon while runnig.
Where is the fault?
| Code: |
; AutoHotkey Version: 1.0.47.06
; Language: English
; Platform: WIN XP
;
;
; Only run this script when bf2.exe is running in the foreground
;
#SingleInstance force
#InstallKeybdHook
#InstallMouseHook
SetTimer, KeepRunning
return
KeepRunning:
; Get the process name of the active window (i.e. Notepad.exe)
WinGet, szProcessName, ProcessName, A
if szProcessName = bf2.exe
{
Suspend, off
}
else
{
Suspend, on
}
return
;
; Disable the Window's keys so they don't switch to desktop while in-game
;
$LWin:: ; Left Windows Button
$RWin:: ; Right Windows Button
; Do nothing
return
$^CapsLock::
ExitApp
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Pressing Ctrl+V while BF2 is active
;
$^v::
Sleep 200
SetKeyDelay, 40
Send, {Space}%clipboard%
SetKeyDelay, 0
return
$XButton2::
Defibrilator()
return
Defibrilator()
{
Send, {6 down}
Sleep 60
Send, {6 up}
Sleep 100
MouseClick, Left, , , , , D
sleep 400
MouseClick, Left, , , , , U
sleep 300
Send, {3 down}
Sleep 40
Send, {3 up}
}
return
$c::
$+C:: ; Shift + c (must depress Shift briefly - can't use kit while
sprinting)
ThrowMediPack()
return
ThrowMediPack()
{
Send, {5 down}
Sleep 60
Send, {5 up}
Sleep 100
MouseClick, Left, , , , , D
sleep 400
MouseClick, Left, , , , , U
Send, {3 down}
Sleep 40
Send, {3 up}
}
return
|
|
Yea i guess you got the shift hold idea from me, but your going about the implementation all wrong. first off you don't need to define 2 hotkeys to pick up the throw action. almost all new scripters do this but its bad coding. if you use $*c: it catch all combinations of the c key being pressed. you dont need to define the the key twice. second to check if your running use getkeystate and keywait for the key being released. if you need more help PM me. If your just wondering why its not working while your running its because you cant throw items while running in BF2. you must release the shift key briefly while running to throw a item. you can do this fast enough that it doesn't look like you stopped running. |
|
| Back to top |
|
 |
Eublefar
Joined: 07 Apr 2008 Posts: 3
|
Posted: Mon Apr 07, 2008 12:47 am Post subject: Overlook in aircraft |
|
|
Hey guys, is there a script which allows to slowly look left, right, up and then to center view in any moment? Cuz I really need it when im flying with joystick. I have an idea like:
Activate mouse look (default Lctrl), use dllcall to move mouse left, right, up, then press key and Lctrl is up.
Is it posiible to do such a thing? I`m not in short with autokey so if smn can help me it would be great! Thanks in advance. |
|
| Back to top |
|
 |
AZA
Joined: 10 Mar 2008 Posts: 139 Location: USA
|
Posted: Mon Apr 07, 2008 2:25 am Post subject: Re: Overlook in aircraft |
|
|
| Eublefar wrote: | Hey guys, is there a script which allows to slowly look left, right, up and then to center view in any moment? Cuz I really need it when im flying with joystick. I have an idea like:
Activate mouse look (default Lctrl), use dllcall to move mouse left, right, up, then press key and Lctrl is up.
Is it posiible to do such a thing? I`m not in short with autokey so if smn can help me it would be great! Thanks in advance. |
I had nothing better to do so here you go.
| Code: | ;#######################################################
; TEAMWEEDNZ BATTLE MACROS BY AZA
;#######################################################
v_Version_Number = 0.1
v_Movement_Speed = 10
v_Look_Around_key = xbutton1
;#######################################################
; PROGRAM SETUP SECTION
;#######################################################
#Persistent
#NoEnv
#SingleInstance Ignore
#InstallKeybdHook
#InstallMouseHook
Hotkey $*%v_Look_Around_key%, LOOK_AROUND, On
SetTimer KEEP_RUNNING, 3000
RETURN
;##################################################
;##################################################
KEEP_RUNNING:
WinGet , szProcessName, ProcessName, A
If szProcessName = bf2.exe
Suspend Off
Else
Suspend On
RETURN
;##################################################
;##################################################
MOUSE_MOVE(X,Y)
{
DllCall("mouse_event", uint, 1, int, X, int, Y, uint, 0, int, 0)
}
RETURN
;##################################################
;##################################################
LOOK_AROUND:
Send {LCtrl Down}
Loop
{
Loop 70
{
GetKeyState KeyDown, %v_Look_Around_key%, P
If KeyDown = U
Break
MOUSE_MOVE(-10,0)
Sleep %v_Movement_Speed%
}
Loop 140
{
GetKeyState KeyDown, %v_Look_Around_key%, P
If KeyDown = U
Break
MOUSE_MOVE(10,0)
Sleep %v_Movement_Speed%
}
Loop 70
{
GetKeyState KeyDown, %v_Look_Around_key%, P
If KeyDown = U
Break
MOUSE_MOVE(-10,0)
Sleep %v_Movement_Speed%
}
Loop 25
{
GetKeyState KeyDown, %v_Look_Around_key%, P
If KeyDown = U
Break
MOUSE_MOVE(0,-10)
Sleep %v_Movement_Speed%
}
Loop 25
{
GetKeyState KeyDown, %v_Look_Around_key%, P
If KeyDown = U
Break
MOUSE_MOVE(0,10)
Sleep %v_Movement_Speed%
}
GetKeyState KeyDown, %v_Look_Around_key%, P
If KeyDown = U
Break
}
Send {LCtrl Up}
RETURN
;################################################## |
Change v_Look_Around_key = at the top of the script to the key you want to use. You can change the speed that it moves with v_Movement_Speed = . It will keep looking as long as you hold down the key.
Check out my BF2 scripts http://www.autohotkey.com/forum/viewtopic.php?t=29706  |
|
| Back to top |
|
 |
Eublefar
Joined: 07 Apr 2008 Posts: 3
|
Posted: Mon Apr 07, 2008 9:59 am Post subject: |
|
|
Thanks AZA its really awesome!
And what I should change in ure script in order to use 3 buttons instead 1, like 1st=look left, 2nd=look right, 3rd=look up.
Thanks again for fast reply. |
|
| Back to top |
|
 |
AZA
Joined: 10 Mar 2008 Posts: 139 Location: USA
|
Posted: Mon Apr 07, 2008 11:07 pm Post subject: |
|
|
Ok, Small change to make that work
| Code: | ;#######################################################
; TEAMWEEDNZ BATTLE MACROS BY AZA
;#######################################################
v_Version_Number = 0.2
v_Movement_Speed = 10
v_Look_Around_Key = xbutton1
v_Look_Left_Key = c
v_Look_Right_Key = b
v_Look_Up_Key = v
;#######################################################
; PROGRAM SETUP SECTION
;#######################################################
#Persistent
#NoEnv
#SingleInstance Ignore
#InstallKeybdHook
#InstallMouseHook
Hotkey $*%v_Look_Around_Key%, LOOK_AROUND, On
Hotkey $*%v_Look_Left_Key%, LOOK_LEFT, On
Hotkey $*%v_Look_Right_Key%, LOOK_RIGHT, On
Hotkey $*%v_Look_Up_Key%, LOOK_UP, On
SetTimer KEEP_RUNNING, 3000
RETURN
;##################################################
;##################################################
KEEP_RUNNING:
WinGet , szProcessName, ProcessName, A
If szProcessName = bf2.exe
Suspend Off
Else
Suspend On
RETURN
;##################################################
;##################################################
MOUSE_MOVE(X,Y)
{
DllCall("mouse_event", uint, 1, int, X, int, Y, uint, 0, int, 0)
}
RETURN
;##################################################
;##################################################
LOOK_AROUND:
Send {LCtrl Down}
Loop
{
Loop 70
{
GetKeyState KeyDown, %v_Look_Around_Key%, P
If KeyDown = U
Break
MOUSE_MOVE(-10,0)
Sleep %v_Movement_Speed%
}
Loop 140
{
GetKeyState KeyDown, %v_Look_Around_Key%, P
If KeyDown = U
Break
MOUSE_MOVE(10,0)
Sleep %v_Movement_Speed%
}
Loop 70
{
GetKeyState KeyDown, %v_Look_Around_Key%, P
If KeyDown = U
Break
MOUSE_MOVE(-10,0)
Sleep %v_Movement_Speed%
}
Loop 25
{
GetKeyState KeyDown, %v_Look_Around_Key%, P
If KeyDown = U
Break
MOUSE_MOVE(0,-10)
Sleep %v_Movement_Speed%
}
Loop 25
{
GetKeyState KeyDown, %v_Look_Around_Key%, P
If KeyDown = U
Break
MOUSE_MOVE(0,10)
Sleep %v_Movement_Speed%
}
GetKeyState KeyDown, %v_Look_Around_Key%, P
If KeyDown = U
Break
}
Send {LCtrl Up}
RETURN
;##################################################
;##################################################
LOOK_LEFT:
Send {LCtrl Down}
Loop
{
GetKeyState KeyDown, %v_Look_Left_Key%, P
If KeyDown = U
Break
MOUSE_MOVE(-10,0)
Sleep %v_Movement_Speed%
}
Send {LCtrl Up}
;##################################################
;##################################################
LOOK_RIGHT:
Send {LCtrl Down}
Loop
{
GetKeyState KeyDown, %v_Look_Right_Key%, P
If KeyDown = U
Break
MOUSE_MOVE(10,0)
Sleep %v_Movement_Speed%
}
Send {LCtrl Up}
;##################################################
;##################################################
LOOK_UP:
Send {LCtrl Down}
Loop
{
GetKeyState KeyDown, %v_Look_Up_Key%, P
If KeyDown = U
Break
MOUSE_MOVE(0,-10)
Sleep %v_Movement_Speed%
}
Send {LCtrl Up}
;################################################## |
Again just change the keys at the top of the script to the ones you want to use. You can use more than one at once too. Hope that helps. |
|
| Back to top |
|
 |
Eublefar
Joined: 07 Apr 2008 Posts: 3
|
Posted: Tue Apr 08, 2008 12:59 pm Post subject: |
|
|
| Thanks Aza, I really appreciate this. |
|
| Back to top |
|
 |
icecreammerk Guest
|
Posted: Fri Apr 11, 2008 3:49 pm Post subject: |
|
|
I have the old version of the G15 keyboard. Am I able to do these scripts?
Ive never used macros before so any help would be appreciated.
you can xfire me @ icecreammerk
I really have no clue what Im doing. |
|
| Back to top |
|
 |
96896987 Guest
|
Posted: Fri Apr 11, 2008 3:52 pm Post subject: |
|
|
| icecreammerk wrote: | I have the old version of the G15 keyboard. Am I able to do these scripts?
Ive never used macros before so any help would be appreciated.
you can xfire me @ icecreammerk
I really have no clue what Im doing. |
you dont need a special keyboard for using ahk scripts
g15 macros are totally different
read this to get started : http://www.autohotkey.com/docs/Tutorial.htm |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Apr 11, 2008 4:43 pm Post subject: |
|
|
| I already dont understand even the first step. I cant find Windows explorer anywhere . |
|
| Back to top |
|
 |
icecreammerk Guest
|
Posted: Fri Apr 11, 2008 4:52 pm Post subject: |
|
|
| An also how do I assign a script to one of the macro keys. Its going to take me a while to get used to doing all this |
|
| Back to top |
|
 |
Dynamic Guest
|
Posted: Sat Apr 12, 2008 6:03 pm Post subject: |
|
|
Could someone make a macro like the one shown in this video : http://www.wipido.com/video/473
i already tried and made this :
| Code: |
$v::
Send, {q Down}
Sleep 200
DllCall("mouse_event", uint,0, int,0, int,10, uint,0, int,0 )
Sleep 40
MouseClick, Left, , , , , D
sleep 40
MouseClick, Left, , , , , U
Send, {q Up}
return
|
but it doesnt work that good |
|
| Back to top |
|
 |
AZA
Joined: 10 Mar 2008 Posts: 139 Location: USA
|
Posted: Sat Apr 12, 2008 9:35 pm Post subject: |
|
|
| Dynamic wrote: | Could someone make a macro like the one shown in this video : http://www.wipido.com/video/473
i already tried and made this :
| Code: |
$v::
Send, {q Down}
Sleep 200
DllCall("mouse_event", uint,0, int,0, int,10, uint,0, int,0 )
Sleep 40
MouseClick, Left, , , , , D
sleep 40
MouseClick, Left, , , , , U
Send, {q Up}
return
|
but it doesnt work that good |
O.K. First thing you need to realize is that in the video you linked too he spots a million red ? (question marks) not actual enemy spotted (circles) That macro while looking impressive is not working in a useful manor. Second of all have you ever played on a server when the command is spamming like that, OMG does it ever suck. You can't even hear the game anymore. I personally have gone on a commander TK'ing mission because of this macro.
Second and ill give this to you for free, You don't need the Dll call in your script. Enemy spoted is in the middle of your screen, so why move the mouse?
Third I could write this macro in 3 lines, but i won't  |
|
| Back to top |
|
 |
Regnaw
Joined: 16 Apr 2008 Posts: 1
|
Posted: Wed Apr 16, 2008 3:32 am Post subject: |
|
|
Lanser!
The idea of using Speech Recognition to issue Cammo Rose commands is awesome. I seen it around page 2 and 3 but couldn't find out how you did it? I made it to page 30'something but my eyes started to bleed =)
I dont know if what I'm asking is related to this topic anymore because I think I remember you saying you tried to phase out AHK from it? If so maybe take it to PMs or start me a new thread regarding it.
Thanks!!
P.S. if Lanser isnt active anymore, maybe someone else can point me in the right direction? |
|
| 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
|