Thank you! Sorry for not posting the solution sooner, had some RSI issues! The solution was I overcomplicated things! VoiceAttack actually has an 'Enqueue Command' feature that is perfect for this type of script. Here's the new code that takes advantage of this:
Swiftcast, a single weave:
Play sound, 'internal:Fwip' # Gives audio feedback to user, letting them know it's queued or pressed #
Begin Boolean Compare : [isCheckingForWeave] Equals True # Checks if the commands are looking for weaves, otherwise executes keybind by voice. #
Enqueue command, '.KB Hotbar | Swiftcast' into [weaveQueue]
Else
Execute command, '.KB Hotbar | Swiftcast' (and wait until it completes)
End Condition
Keybind code invoked by Swiftcast:
Begin Text Compare: [{QUEUEACTIVECMD:weaveQueue}] Equals '{CMD}' # A neat trick to get a command to act differently if it's executing in queue! In this case it informs commands that the next cast is instant. #
Set Boolean [swiftcastActive] to True
End Condition
Press down Left Shift + = keys
Pause a variable number of seconds [keyPressDelay] # A variable set by user voice, allows them to adjust for their liking. #
Release Left Shift + = keys
SwiftDream, a double-weave of Swiftcast and Lucid Dreaming:
Play sound, 'internal:Fwip'
Begin Boolean Compare : [isCheckingForWeave] Equals True
Enqueue command, '.KB Hotbar | Swiftcast' into [weaveQueue] # It's as simple as adding more things to the queue! #
Enqueue command, '.KB Hotbar | Lucid Dreaming' into [weaveQueue]
Else
Execute command, '.KB Hotbar | Swiftcast' (and wait until it completes)
Pause 0,7 seconds
Execute command, '.KB Hotbar | Lucid Dreaming' (and wait until it completes)
End Condition
Trigger section of .Function Weave Queue:
Set integer [weavesInQueue] value to the converted value of {QUEUECMDCOUNT:weaveQueue}
Begin Integer Compare : [weavesInQueue] Is Greater Than 0 # Executes if there are any weaves queued, otherwise skips. #
Start queue [weaveQueue] # Starts the queue, executing the first weave in order, and then the next on the next iteration of the loop, and so on. #
Pause 0,05 seconds
Pause queue [weaveQueue] # Done to prevent all the weaves executing at once, pausing it ensures it only executes the one it needs. #
Begin Boolean Compare : [~canDoubleWeave] Equals True # If an ability is used that can double-weave, it executes two in the iteration instead of one, in the order they're received. #
Pause 0,65 seconds
Start queue [weaveQueue]
Pause 0,05 seconds
Pause queue [weaveQueue]
Set decimal [~postWeaveCooldown] to [~postWeaveCooldown] minus 0,7
End Condition
Set Boolean [~canDoubleWeave] to False
End Condition
As you can see, much simpler! Hope anyone who comes across this finds this useful! ♥