I tried to add MicroTimer to FC, but for some reason I could not get it to work.
FC is one of my very early scripts and it shows - it is quite the tangled mess (As well as the ADHD engine it uses).
I since wrote a new engine called UCR, and had always intended to implement FC as a plugin for that, but never got around to it.
I am now moving from UCR to yet another engine, where I am off-loading a lot of the stuff to C# code which is either difficult to implement in AHK, or CPU intensive.
So recently I wrote a "UCR Lite" which is basically the same idea as ADHD that powers FC, but done a lot better.
It's called AppFactory, and it uses Autohotkey_H (Which is what all my AHK code since FC days has used - it's identical to regular AHK, with some extra commands)
So I wrote a quick implementation of the core feature of FC, but using AppFactory.
All it does is send the fire sequence at the specified rate.
There is a "Key Delay" setting - I suspect this can maybe go lower than 50ms, but unless you are trying to send at those kind of rates, I doubt it will make a difference.
I just need people to tell me how well it works - I am suspecting that you will now have finer control over your timings and things should just generally work better.
For those of you who were having problems binding LMB etc, then this *may* help you as the binding code is different.
https://github.com/e...ire-Control.zip
For reference - here is the script:
#SingleInstance force
#NoEnv
;~ OutputDebug DBGVIEWCLEAR
#Include ..\AppFactory\Source\AppFactory.ahk
#include CLR.ahk
Version := "4.0.2"
; Load MicroTimer Lib
dllname := "MicroTimer.dll"
if (!FileExist(dllname)){
MsgBox % dllname " Not found"
ExitApp
}
asm := CLR_LoadLibrary(dllname)
; Use CLR to instantiate a class from within the DLL
MicroTimer := asm.CreateInstance("MicroTimer")
Factory := new AppFactory()
w1 := 90, w2 := 200
Gui, Add, Text, % "xm y+10 w" w1, Fire Button
Factory.AddInputButton("HK1", "x+5 yp-3 w" w2, Func("InputEvent"))
Gui, Add, Text, % "xm y+10 w" w1, Fire Sequence
Factory.AddControl("FireSequence", "Edit", "x+5 yp-3 w" w2, "1,2,3,4", Func("SeqChanged"))
Gui, Add, Text, % "xm y+10 w" w1, Fire Rate
Factory.AddControl("FireRate", "Edit", "x+5 yp-3 w200", "500", Func("RateChanged"))
Gui, Add, Text, % "xm y+10 w" w1, Key Press Duration
Factory.AddControl("KeyDelay", "Edit", "x+5 yp-3 w200", "50", Func("KeyDelayChanged"))
SequencePos := 1
Gui, Show, , % "Fire Control v" Version
return
GuiClose:
ExitApp
InputEvent(state){
Global Factory, MicroTimer, FireRate
static FireTimer := 0
if (state){
if (FireTimer != 0)
return
FireTimer := MicroTimer.Create(Func("DoFire"), FireRate)
res := FireTimer.SetState(1)
;~ OutputDebug % "AHK| Timer Started, result: " res
} else {
res := FireTimer.SetState(0)
FireTimer := 0
;~ OutputDebug % "AHK| Timer Stopped, result: " res
}
}
SeqChanged(state){
global Factory, FireSequence
FireSequence := StrSplit(state, ",", A_Space)
}
KeyDelayChanged(state){
SetKeyDelay, 0, % state
}
RateChanged(state){
global FireRate
FireRate := state
}
DoFire(){
global FireSequence, SequencePos
Send % "{Blind}{" FireSequence[SequencePos] "}"
;~ OutputDebug % "AHK| Fired - Sent key : " FireSequence[SequencePos] " (seq = " SequencePos " / " FireSequence.Length() ")"
SequencePos++
if (SequencePos > FireSequence.Length())
SequencePos := 1
}