AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

script for a game

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
sijek



Joined: 09 Jan 2010
Posts: 11

PostPosted: Sat Jan 09, 2010 10:44 am    Post subject: script for a game Reply with quote

hey!
i wanna make an ahk script for a game..
the script will be activated if scroll lock is down.
and Lbutton is autofire and antirecoil. Right mouse is shoot and Crouching.
i made it so, but don't know the next step:
Code:
gActivateScript = 0

~ScrollLock::
KeyWait, ScrollLock
GetKeyState, ScrollLockState, ScrollLock, T
If ScrollLockState = D
{
gActivateScript = 1
}
else
{
gActivateScript = 0
}
return

~LButton::
if gActivateScript = 1
{
Loop {
MouseClick, left,,, 1, D
Sleep, 5
MouseClick, left,,, 1, U
DllCall("mouse_event", uint, 1, int, -1, int, 1, uint, 0, int, 0)
GetKeyState, LButtonState, LButton, P
If LButtonState = U
break
Sleep, 5
}
}
return

~RButton::
if gActivateScript = 1
{
Loop {
MouseClick, Right,,, 2, D
Sleep, 4
MouseClick, Right,,, 0, U
GetKeyState, RButtonState, RButton, P
If RButtonState = U
break
Sleep, 4
}
}
return

pls help me.
Thanx.
Back to top
View user's profile Send private message
Fry



Joined: 01 Nov 2007
Posts: 885

PostPosted: Sat Jan 09, 2010 6:07 pm    Post subject: Reply with quote

Hello Sijek, it appears you copy 'n pasted this. no?

To make the script work, press scrolllock, it should be autofire and antirecoil. If not, try my code and do the same.

Code:
#Persistent
gActivateScript = 0
return

~ScrollLock::
KeyWait, ScrollLock
GetKeyState, ScrollLockState, ScrollLock, T
If ScrollLockState = D
{
gActivateScript = 1
}
else
{
gActivateScript = 0
}
return

~LButton::
if gActivateScript = 1
{
Loop {
MouseClick, left,,, 1, D
Sleep, 5
MouseClick, left,,, 1, U
DllCall("mouse_event", uint, 1, int, -1, int, 1, uint, 0, int, 0)
GetKeyState, LButtonState, LButton, P
If LButtonState = U
break
Sleep, 5
}
}
return

~RButton::
if gActivateScript = 1
{
Loop {
MouseClick, Right,,, 2, D
Sleep, 4
MouseClick, Right,,, 0, U
GetKeyState, RButtonState, RButton, P
If RButtonState = U
break
Sleep, 4
}
}
return
Back to top
View user's profile Send private message
sijek



Joined: 09 Jan 2010
Posts: 11

PostPosted: Sat Jan 09, 2010 7:21 pm    Post subject: right mouse Reply with quote

hey Fry!
my autofire and antirecoil script worked well.
i just wanna make it so the right mouse is shoot and crouching without clicking.
ty Fry!
Back to top
View user's profile Send private message
Fry



Joined: 01 Nov 2007
Posts: 885

PostPosted: Sun Jan 10, 2010 11:14 pm    Post subject: Reply with quote

If your crouch button is control, add a sleep 4 and sendinput {lcontrol}.

Code:

sleep4
sendinput {lcontrol}
Back to top
View user's profile Send private message
Slavka850
Guest





PostPosted: Tue May 17, 2011 11:48 am    Post subject: key remapping Reply with quote

how can i realise this idea:
Code:
If ScrollLockState = D
{
Numpad0::RControl
}
else
{
RControl::RControl
}

?

and one more question:
this script needed in
Code:
~ScrollLock::
KeyWait, ScrollLock
GetKeyState, ScrollLockState, ScrollLock, T

construction?

thx.
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group