AutoHotkey Community

It is currently May 27th, 2012, 12:17 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Mouse Gearbox
PostPosted: September 18th, 2008, 2:22 pm 
Offline

Joined: August 20th, 2008, 4:25 pm
Posts: 256
I'm not sure if this has been posted already. This script will make your MButton, combined with a scroll up or down, influence your cursor speed. This is handy for computergames. I was inspired by a buddy of mine that has a button on his mouse that enables him to shift his DPI at any time. My mouse however, only has 3... :roll:

Code:
SysGet, VirtualScreenWidth, 78
Half = %VirtualScreenWidth%
EnvDiv, Half, 2

Menu, Tray, Icon , %SystemRoot%\system32\SHELL32.dll, 15
Menu, Tray, NoStandard
Menu, Tray, Add, Exit, Exit

Gui +AlwaysOnTop +LastFound -Caption +ToolWindow
Gui, Color, 000000
Gui, Font, C09FF00
Gui, Font,, Arial
Gui, Font, s35
Gui, Add, Progress, xCenter yCenter h10 W100 c09FF00 Background000000 vIndicator -smooth Range0-30
Gui, Show, x%half% y0 h10 w100, Gear Indicator
GuiControl,, Indicator, 10

DllCall("SystemParametersInfo", Int,113, Int,0, UInt,10, Int,2)
Speed = 2
return

MButton & WheelUp::
If Speed > 20
{
return
}
Else
{
EnvAdd, %Speed%, 2
GuiControl,, Indicator, +1
DllCall("SystemParametersInfo", Int,113, Int,0, UInt,%Speed%, Int,2)
}
return

MButton & WheelDown::
If Speed < 1
{
return
}
Else
{
EnvSub, %Speed%, 2
GuiControl,, Indicator, +-1
DllCall("SystemParametersInfo", Int,113, Int,0, UInt,%Speed%, Int,2)
}
return

Exit:
ExitApp



Hope this helped a few people!

_________________
-Chavez.


Last edited by Chavez on September 19th, 2008, 2:00 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 19th, 2008, 1:56 pm 
Offline

Joined: August 20th, 2008, 4:25 pm
Posts: 256
Updated the code: Now it has an indicator, showing how much you have accelerated your mouse.

_________________
-Chavez.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 21st, 2008, 9:15 am 
Offline

Joined: August 8th, 2008, 7:26 pm
Posts: 117
Location: Raahe, Finland
I've ben thinkng of making something like this because I need one

But now I dont have to

Thank you man :lol:

_________________
Hezzu - excuse the english!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 7th, 2010, 4:45 am 
Offline

Joined: March 3rd, 2010, 4:08 pm
Posts: 2
Hey this is great stuff. I can get this to work on Call of Duty but for some reason it doesn't work on battlefield games (i.e. bad company 2, etc). Do any of you have this issue as well?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 21st, 2010, 9:07 pm 
The issue is (In ultra-compact version, couse i dont wanna waste time with something so long known):
Bad Company 2, as well as other games, get acess to the input before AHK does...basicaly, your clicks, hotkeys, and even mouse sensivity sent thru AHK wont reach the game, becouse it reacts "directly to the physical mouse & keyboard"...

the only ways to bypass this issue is either having the keyboard+mouse input forced to pass thru AHK before they go to the game, this might be possible (i have no idea how) by a hook instaled in your windows private files(window's protected files)...with i believe is almost impossible

OR

To "make the game believe what it is receiving is what it would receive"...with means to hack the game undetected (search for "code injection" on google...you would need to do that...its the same method actual game-hacks use, and i doubt you could manage do it within the next 3 years...it is well beyond "harder" to aply code injection, or in other words to make a hack, than it is to code anything else, for example a program like AHK)

Code Injection:
its one of the hardest, if not THE hardest things in programming.
it consists in:
1-Disasembling the game memory and code.
2-Finding a weakness in the code.
3-Coding an injection method, with needs to be compatible with the weakness.
4-Coding the code to be injected.
5-Inject the code.

And since we are talking about a game protected by an external program (PunkBuster), a final step before playing with it anywere near a PB-protected server:

6-Make the last step (5) undetectable thru multiple layers of "hard-to-decode-but-even-harder-to-code" protection.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 28th, 2010, 3:50 pm 
Offline

Joined: August 24th, 2005, 5:17 pm
Posts: 1237
I liked the idea of using the mouse wheel and displaying the speed in this way. I had some issues with the code above and ended up making my own modified version (which doesn't disable the middle button):

Code:
SysGet, VirtualScreenWidth, 78
Half := VirtualScreenWidth / 2

Menu, Tray, Icon , %A_WinDir%\system32\SHELL32.dll, 15

Gui +AlwaysOnTop +LastFound -Caption +ToolWindow
Gui, Color, 000000
Gui, Add, Progress, xCenter yCenter h10 W100 c09FF00 Background000000 vIndicator -smooth Range0-20


; GET INTIAL MOUSE SPEED:
; 0x70 (SPI_GETMOUSESPEED), third parameter is the speed (range is 1-20, 10 is default)
DllCall("SystemParametersInfo", UInt, 0x70, UInt, 0, UIntP, Mouse_Speed_Original, UInt, 0)
Speed := Mouse_Speed_Original
GuiControl,, Indicator, %Speed%
Gui, Show, Hide x%Half% y0 h10 w100, MouseGear Indicator
Return

~MButton & WheelUp::
Speed := Speed + 1
If Speed > 20
  Speed = 20
Gosub, Speed_Change
Return

~MButton & WheelDown::
Speed := Speed - 1
If Speed < 1
  Speed = 1
Gosub, Speed_Change
Return

Speed_Change:
; 0x71 (SPI_SETMOUSESPEED), third parameter is the speed (range is 1-20, 10 is default)
DllCall("SystemParametersInfo", UInt, 0x71, UInt, 0, UInt, Speed, UInt, 0)
GuiControl,, Indicator, %Speed%
Gui, Show, NoActivate
SetTimer, Progress_Hide, -1000
Return

Progress_Hide:
Gui, Show, Hide
Return

Exit:
; Set original mouse speed again:
; DllCall("SystemParametersInfo", UInt, 0x71, UInt, 0, UIntP, Mouse_Speed_Original, UInt, 0)
ExitApp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2010, 8:54 pm 
o|-< (A person) wrote:
The issue is (In ultra-compact version, couse i dont wanna waste time with something so long known):
Bad Company 2, as well as other games, get acess to the input before AHK does...basicaly, your clicks, hotkeys, and even mouse sensivity sent thru AHK wont reach the game, becouse it reacts "directly to the physical mouse & keyboard"...

the only ways to bypass this issue is either having the keyboard+mouse input forced to pass thru AHK before they go to the game, this might be possible (i have no idea how) by a hook instaled in your windows private files(window's protected files)...with i believe is almost impossible

OR

To "make the game believe what it is receiving is what it would receive"...with means to hack the game undetected (search for "code injection" on google...you would need to do that...its the same method actual game-hacks use, and i doubt you could manage do it within the next 3 years...it is well beyond "harder" to aply code injection, or in other words to make a hack, than it is to code anything else, for example a program like AHK)

Code Injection:
its one of the hardest, if not THE hardest things in programming.
it consists in:
1-Disasembling the game memory and code.
2-Finding a weakness in the code.
3-Coding an injection method, with needs to be compatible with the weakness.
4-Coding the code to be injected.
5-Inject the code.

And since we are talking about a game protected by an external program (PunkBuster), a final step before playing with it anywere near a PB-protected server:

6-Make the last step (5) undetectable thru multiple layers of "hard-to-decode-but-even-harder-to-code" protection.


Thats all fine and dandy or you could create a virtual mouse driver that uses AHK output as its input


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 18th, 2011, 4:06 pm 
Is this changing the windows dpi or the mouse dpi?
i have razer naga; the windows sensitivy doesnt affect my game sens tho


Report this post
Top
  
Reply with quote  
 Post subject: Re: Mouse Gearbox
PostPosted: March 28th, 2011, 2:23 pm 
what do u do with the code to make it work. i want to use it for halo combat evolved.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 6 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