Announcement - Utility BuoyBlaster
Posted: Fri Dec 21, 2007 1:44 am
Do you ever get tired of tapping to lay down a field of buoys? Well, I have implemented a hot key utility that drops a series of buoys. The initial starting rate can be set. Additionally, the rate can be increased or decreased while the utility is running. The H363/ANW version allows one or both type of buoys to be selected. The utility needs to be bound to a programmable function key, mouse button, or some other hot facility. I am using a programmable gaming keyboard.
I have implemented this in WinBatch which is a Window's scripting language. WinBatch is not freeware. However, this could easily be converted to Visual Basic which could then be freely distributed along with the Visual Basic runtime.
The code for the H363/ANW version follows below along with a sample screenshot.
WinTitle(WinName(), "BuoyBlaster")
; Mark Kratzer 12/20/07
;
; Utility to feed buoy drop characters into H363 at a steady
; rate. It will be activated via the G15 keyboard as G15 macro
; key.
;
; Usage is to plot a path for a helo and then start this macro.
;
; It will prompt for an initial frequency, but also use a default.
;
; It will prompt for buoy types.
;
; Hold SHIFT key down to increase delay. Hold CTRL key down to decrease delay.
;
; To terminate select an area the taskbar to cause H363 to lose focus.
; ----- Definitions ------
GameWindowName="harpoon3"
BuoyDefaultInterval=5
BuoyDefaultType=1
AckSound="AckSound.wav"
; ----- Initialize -----
; ----- Drop Buoys -----
WindowName=WinGetActive() ; get a custom frequency
BuoyInterval=AskLine("BuoyBlaster", "Enter seconds (wall clock) between buoys?", BuoyDefaultInterval)
PromptString=""
PromptString=StrCat(PromptString,"Select Buoy Types:",@CRLF)
PromptString=StrCat(PromptString,"1 - Passive",@CRLF)
PromptString=StrCat(PromptString,"2 - Active",@CRLF)
PromptString=StrCat(PromptString,"3 - Both")
BuoyType=AskLine("BuoyBlaster", PromptString, BuoyDefaultType)
If BuoyType<>1 && BuoyType<>2 && BuoyType<>3 Then Exit ; invalid type
Delay(1)
WinActivate(WindowName) ; return focus to H363
While @True
Delay(BuoyInterval) ; wait for next buoy drop
If IsKeyDown(@SHIFT) Then
BuoyInterval=BuoyInterval+2 ; increase by two seconds
Beep() ; two beeps for longer delay
Delay(1)
Beep()
End If
If IsKeyDown(@CTRL) Then
BuoyInterval=BuoyInterval-2 ; decrease by two seconds
If BuoyInterval<1 Then BuoyInterval=1 ; cannot go negative
Beep() ; one beep for shorter delay
End If
If WinGetActive()==GameWindowName Then ; Does H363 have focus?
Switch BuoyType
Case 1
SendKey("[") ; emit passive buoy
break
Case 2
SendKey("]") ; emit active buoy
break
Case 3
SendKey("[") ; emit passive buoy
delay(1)
SendKey("]") ; emit active buoy
break
EndSwitch
PlayWaveForm(AckSound, 0) ; play sound for buoy drop
Else
Exit ; if lose focus, then terminate
End If
End While

I have implemented this in WinBatch which is a Window's scripting language. WinBatch is not freeware. However, this could easily be converted to Visual Basic which could then be freely distributed along with the Visual Basic runtime.
The code for the H363/ANW version follows below along with a sample screenshot.
WinTitle(WinName(), "BuoyBlaster")
; Mark Kratzer 12/20/07
;
; Utility to feed buoy drop characters into H363 at a steady
; rate. It will be activated via the G15 keyboard as G15 macro
; key.
;
; Usage is to plot a path for a helo and then start this macro.
;
; It will prompt for an initial frequency, but also use a default.
;
; It will prompt for buoy types.
;
; Hold SHIFT key down to increase delay. Hold CTRL key down to decrease delay.
;
; To terminate select an area the taskbar to cause H363 to lose focus.
; ----- Definitions ------
GameWindowName="harpoon3"
BuoyDefaultInterval=5
BuoyDefaultType=1
AckSound="AckSound.wav"
; ----- Initialize -----
; ----- Drop Buoys -----
WindowName=WinGetActive() ; get a custom frequency
BuoyInterval=AskLine("BuoyBlaster", "Enter seconds (wall clock) between buoys?", BuoyDefaultInterval)
PromptString=""
PromptString=StrCat(PromptString,"Select Buoy Types:",@CRLF)
PromptString=StrCat(PromptString,"1 - Passive",@CRLF)
PromptString=StrCat(PromptString,"2 - Active",@CRLF)
PromptString=StrCat(PromptString,"3 - Both")
BuoyType=AskLine("BuoyBlaster", PromptString, BuoyDefaultType)
If BuoyType<>1 && BuoyType<>2 && BuoyType<>3 Then Exit ; invalid type
Delay(1)
WinActivate(WindowName) ; return focus to H363
While @True
Delay(BuoyInterval) ; wait for next buoy drop
If IsKeyDown(@SHIFT) Then
BuoyInterval=BuoyInterval+2 ; increase by two seconds
Beep() ; two beeps for longer delay
Delay(1)
Beep()
End If
If IsKeyDown(@CTRL) Then
BuoyInterval=BuoyInterval-2 ; decrease by two seconds
If BuoyInterval<1 Then BuoyInterval=1 ; cannot go negative
Beep() ; one beep for shorter delay
End If
If WinGetActive()==GameWindowName Then ; Does H363 have focus?
Switch BuoyType
Case 1
SendKey("[") ; emit passive buoy
break
Case 2
SendKey("]") ; emit active buoy
break
Case 3
SendKey("[") ; emit passive buoy
delay(1)
SendKey("]") ; emit active buoy
break
EndSwitch
PlayWaveForm(AckSound, 0) ; play sound for buoy drop
Else
Exit ; if lose focus, then terminate
End If
End While
