BinaryDeli
Navigation
Go Back   BinaryDeli > General Access > S.W.A.T. Aftermath
Reply

  #1
Old 10-31-2009, 05:21 PM
tehMati



 
tehMati's Avatar
 
Join Date: Nov 2007
Location: Illinois
Posts: 633
tehMati is on a distinguished road
Default 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..
tehMati is online now   Reply With Quote
  #2
Old 04-28-2010, 07:06 PM
kingubu

 
kingubu's Avatar
 
Join Date: Nov 2007
Posts: 696
kingubu will become famous soon enough
Default

Another script for you mati

Code:
;
; 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

Last edited by kingubu; 04-29-2010 at 07:12 PM..
kingubu is offline   Reply With Quote
  #3
Old 04-29-2010, 07:11 PM
kingubu

 
kingubu's Avatar
 
Join Date: Nov 2007
Posts: 696
kingubu will become famous soon enough
Default

Not for everyone, this script automates using items out of the rat pack.

Moderately awkward, like the trait it's trying to automate, but it allows one-click use of items from the pack.

Requires that you hot key the backpack to '4'. Z Z your self and ctrl-4 to add the hotkey.
Added a 4th row to the scroll wheel code, tooltip "pack". Roll down to it.
Set the inventory squares with ctrl-shift-left click and right click.
Ctrl-left click or right click to use the item in the pack.
Script is slow! You wont be able to dote with it. Zombie will have moved by the time it fires.

The script is really slow! Thought I should mention this again. It's like a full second to cycle the item out, use it, and put it back.

And it occasionally misfires. Not activating the item or failing to put the item back in the pack. Making it even slower would make it fail less, but it works about 90% of the time now, and it's already slow enough.

In the future, I might make it more robust by actually checking for when the next step in the macro can fire, instead of waiting a fixed time, and hoping it's ready.

But that would require some funky image scanning, and might not make it much faster, so maņana
Code:
;
inv = 1
*WheelDown::
  inv += 1
  if(inv>=4) {
    inv := 4
    Tooltip, Pack
  }
  else
    Tooltip, %inv%
  sleep, 150
  Tooltip
  return
;
*WheelUp::
  inv -= 1
  if(inv<1)
    inv := 1
  Tooltip, %inv%
  Sleep, 150
  Tooltip
  return
;
*pgup::
  return
;
*pgdn::
  return
;
; ctrl-shift left set left pack inventory
;
^+LButton::
  MouseGetPos, xleft, yleft
return
;
; ctrl-shift right set right pack inventory
;
^+RButton::
  MouseGetPos, xright, yright
return
;
; ctrl left use inventory
;
^LButton::
  if (inv = 1) {
    Send, {Numpad7}
    Mouseclick, Left
  }
  if (inv = 2) {
    Send, {Numpad4}
    Mouseclick, Left
  }
  if (inv = 3) {
    Send, {Numpad1}
    Mouseclick, Left
  }
  if (inv = 4) {
    MouseGetPos, xhere, yhere
    Send, 4
    Sleep, 40
    Send, z
    MouseClick, Left, xleft, yleft,,2
    Send, 1
    Sleep, 240
    MouseClick, Left, xleft, yleft,,2
    Sleep, 120
    Mouseclick, Left, xhere, yhere,,2
    Sleep, 120
    Send, zz
    Sleep, 120
    MouseClick, Left, xleft, yleft,,2
    Sleep, 160
    Send, {ESC}
    MouseMove, xhere, yhere,0
  }
  return
;
; ctrl right use inventory
;
^RButton::
  if (inv = 1) {
    Send, {Numpad8}
    Mouseclick, Left
  }
  if (inv = 2) {
    Send, {Numpad5}
    Mouseclick, Left
  }
  if (inv = 3) {
    Send, {Numpad2}
    Mouseclick, Left
  }
  if (inv = 4) {
    MouseGetPos, xhere, yhere
    Send, 4
    Sleep, 40
    Send, z
    MouseClick, Left, xright, yright,,2
    Send, 1
    Sleep, 240
    MouseClick, Left, xright, yright,,2
    Sleep, 120
    Mouseclick, Left, xhere, yhere,,2
    Sleep, 120
    Send, zz
    Sleep, 120
    MouseClick, Left, xright, yright,,2
    Sleep, 160
    Send, {ESC}
    MouseMove, xhere, yhere,0
  }
  return
;

Last edited by kingubu; 04-29-2010 at 07:37 PM..
kingubu is offline   Reply With Quote
  #4
Old 04-29-2010, 09:51 PM
kingubu

 
kingubu's Avatar
 
Join Date: Nov 2007
Posts: 696
kingubu will become famous soon enough
Default

Here's a quick video of the script in action

kingubu is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:11 PM.
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.