SemlerPDX icon

AVCS Ready or Not SWAT Target Command Parser v4

SemlerPDX | PRO | 01/17/22 04:34:15 AM UTC (Edited) | 0 ⭐ | 735 👁️ | Never ⏰ | []
VB.NET |

2.56 KB

|

None

|

0 👍

/

0 👎

' Ready Or Not - AVCS4 SWAT Standard & Target Command Parsing
'  by SemlerPDX Dec2021
'  VETERANS-GAMING.COM
' --Parses spoken commands to retrieve config variables and resolve to VoiceAttack Global Keypress Variables
 
 
Imports Microsoft.VisualBasic
Imports System
 
Public Class VAInline
    dim replacementWords() as string
    dim replacement() as string
    dim actionTypes() as string
    dim deployOptions() as string
    dim targeting as string = ""
    dim actionType as string = ""
    dim deployOption as string = ""
    dim actionTypeKey as string = ""
    dim deployOptionKey as string = ""
    dim swatCommand as string
    
    
    Public Sub Main()
        if ((VA.GetText("~~avcs_swat_cmd")) isNot nothing)
        
            swatCommand = VA.GetText("~~avcs_swat_cmd")
            if (swatCommand <> "")
                
                if ((VA.GetText("AVCS_RON_Action_Types")) isNot nothing)
                    actionTypes = VA.GetText("AVCS_RON_Action_Types").Split(";")
                end if
                
                if ((VA.GetText("AVCS_RON_Deploy_Options")) isNot nothing)
                    deployOptions = VA.GetText("AVCS_RON_Deploy_Options").Split(";")
                end if
                
                if (swatCommand.Contains("target"))
                    targeting = " Target"
                end if
                
                if ((VA.GetText("AVCS_RON_Target_Replacements")) isNot nothing)
                    replacementWords = VA.GetText("AVCS_RON_Target_Replacements").Split(";")
                    for each replacementSet as string in replacementWords
                        if (replacementSet.Contains(","))
                            replacement = replacementSet.Split(",")
                            swatCommand = swatCommand.Replace(replacement(0), replacement(1))
                        end if
                    next
                end if
                
                for i as integer = 0 to actionTypes.Length - 1
                    if (swatCommand.Contains(actionTypes(i)))
                        actionType = actionTypes(i)
                        if ((vaProxy.ParseTokens("{TXT:{TXT:AVCS_RON_Menu1_" + actionType + targeting + "}}")) isNot nothing)
                            actionTypeKey = vaProxy.ParseTokens("{TXT:{TXT:AVCS_RON_Menu1_" + actionType + targeting + "}}")
                            VA.SetText("~avcs_action_type_key", actionTypeKey)
                        end if
                        exit for
                    end if
                next
                
                for i as integer = 0 to deployOptions.Length - 1
                    if (swatCommand.Contains(deployOptions(i)))
                        deployOption = deployOptions(i)
                        if ((vaProxy.ParseTokens("{TXT:{TXT:AVCS_RON_Menu2_Deploy_" + deployOption + "}}")) isNot nothing)
                            deployOptionKey = vaProxy.ParseTokens("{TXT:{TXT:AVCS_RON_Menu2_Deploy_" + deployOption + "}}")
                            VA.SetText("~avcs_deploy_option_key", deployOptionKey)
                            VA.SetBoolean("~avcs_deploying", true)
                        end if
                        exit for
                    end if
                next
                
            end if
        end if
    End Sub
 
End Class

Comments