|
War3 Windowed: The Swat Version
Ok, this script combines two of Ubu's finest scripts. It has the mouse-locking power of the first, with the super-doting, no-zooming awesomeness of the second. Run it once, then any time you use Ctrl-Shift-s to lock your mouse, the wonders of the superdote script kick in. Then, when you're finished swatting it up, Ctrl-Shift-q unlocks your mouse, and gives you your mouse-wheel back!
Code:
#UseHook On
inv = 1
*WheelDown::
inv += 1
if(inv>3)
inv := 1
Tooltip, %inv%
sleep, 200
Tooltip
return
;
*WheelUp::
inv -= 1
if(inv<1)
inv := 3
Tooltip, %inv%
Sleep, 200
Tooltip
return
;
*pgup::
useitemleft:
if inv = 1
Send, {Numpad7}
if inv = 2
Send, {Numpad4}
if inv = 3
Send, {Numpad1}
return
;
*pgdn::
useitemright:
if inv = 1
Send, {Numpad8}
if inv = 2
Send, {Numpad5}
if inv = 3
Send, {Numpad2}
return
;
return
^LButton::
Gosub useitemleft
Mouseclick, Left
return
;
^RButton::
Gosub useitemright
Mouseclick, Left
return
;
^`::
{
Send {Enter}{Ctrl down}v{Ctrl up}{Enter} ; Paste character code from clipboard
Sleep, 100
Send {Enter}-view 60{Enter} ; Enter view angle defined in options
Sleep, 100
Send {Enter}-pool 0{Enter} ; Enter pool value
Sleep, 100
Send {Enter}-perfect{Enter}
}
Return
^z::
SetTimer, beep, -89000
Soundplay *64
return
;
beep:
Soundplay *64
return
;
; drop trick ctrl-middle mouse
;
^MButton::
MouseGetPos, xhere, yhere
MouseClick, Right, xdrop, ydrop,,0
MouseClick, Left, xhere, yhere,,2
return
;
; set drop trick slot ctrl-shift-middle mouse
; use on the inventory slot to set what to drop
;
^+MButton::
MouseGetPos, xdrop, ydrop
return
Hotkey,^RButton,Off
Hotkey,*WheelDown,Off
Hotkey,*WheelUp,Off
Hotkey,*pgup,Off
Hotkey,*pgdn,Off
Hotkey,^LButton,Off
Hotkey,^``,Off
Hotkey,^mbutton,Off
Hotkey,^z,Off
!x::
WinSet, Style, +0xC00000, A
LockMouseToWindow()
ExitApp
return
;
; ctrl-shift-s
; remove title bar
; lock mouse movement to current window
;
^+q::
WinSet, Style, +0xC00000, A
LockMouseToWindow()
Hotkey,*WheelDown,Off
Hotkey,*WheelUp,Off
Hotkey,*pgup,Off
Hotkey,*pgdn,Off
Hotkey,^LButton,Off
Hotkey,^RButton,Off
Hotkey,^``,Off
Hotkey,^mbutton,Off
Hotkey,^z,Off
return
;
; ctrl-shift-q
; restore title bar
; unlock mouse movement
;
^+s::
WinSet, Style, -0xC00000, A
WinGetTitle,wintitle,A
LockMouseToWindow(wintitle)
Hotkey,*WheelDown,On
Hotkey,*WheelUp,On
Hotkey,*pgup,On
Hotkey,*pgdn,On
Hotkey,^LButton,On
Hotkey,^RButton,On
Hotkey,^``,On
Hotkey,^mbutton,On
Hotkey,^z,On
return
;
LockMouseToWindow(llwindowname="")
{
VarSetCapacity(llrectA, 16)
WinGetPos, llX, llY, llWidth, llHeight, %llwindowname%
If (!llWidth AND !llHeight)
{
DllCall("ClipCursor")
Return, False
}
; fudge factor for borders
llx += 4
llwidth -= 8
lly +=4
llheight -= 8
;
Loop, 4
{
DllCall("RtlFillMemory", UInt,&llrectA+0+A_Index-1, UInt,1, UChar,llX >> 8*A_Index-8)
DllCall("RtlFillMemory", UInt,&llrectA+4+A_Index-1, UInt,1, UChar,llY >> 8*A_Index-8)
DllCall("RtlFillMemory", UInt,&llrectA+8+A_Index-1, UInt,1, UChar,(llWidth + llX)>> 8*A_Index-8)
DllCall("RtlFillMemory", UInt,&llrectA+12+A_Index-1, UInt,1, UChar,(llHeight + llY) >> 8*A_Index-8)
}
DllCall("ClipCursor", "UInt", &llrectA)
Return, True
}
Copy into notepad, save as something.ahk, and run for great justice!
__________________
Last edited by tehMati; 05-17-2010 at 10:10 PM..
|