AutoHotkey Community

It is currently May 27th, 2012, 1:12 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: script for a game
PostPosted: January 9th, 2010, 11:44 am 
Offline

Joined: January 9th, 2010, 2:45 am
Posts: 11
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 9th, 2010, 7:07 pm 
Offline

Joined: November 1st, 2007, 10:03 pm
Posts: 885
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: right mouse
PostPosted: January 9th, 2010, 8:21 pm 
Offline

Joined: January 9th, 2010, 2:45 am
Posts: 11
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!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 11th, 2010, 12:14 am 
Offline

Joined: November 1st, 2007, 10:03 pm
Posts: 885
If your crouch button is control, add a sleep 4 and sendinput {lcontrol}.

Code:
sleep4
sendinput {lcontrol}


Report this post
Top
 Profile  
Reply with quote  
 Post subject: key remapping
PostPosted: May 17th, 2011, 12:48 pm 
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.


Report this post
Top
  
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: Leef_me, Ohnitiel 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