SemlerPDX icon

AVCS Ready or Not SWAT Breach Command Parser v4

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

2.72 KB

|

None

|

0 👍

/

0 👎

' Ready Or Not - AVCS4 SWAT Breach & Clear 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 breachTypes() as string
    dim breachStyles() as string
    dim breachType as string = ""
    dim breachStyle as string = ""
    dim breachTypeKey as string = ""
    dim breachStyleKey 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_Breach_Types")) isNot nothing)
                    breachTypes = VA.GetText("AVCS_RON_Breach_Types").Split(";")
                end if
                
                if ((VA.GetText("AVCS_RON_Breach_Styles")) isNot nothing)
                    breachStyles = VA.GetText("AVCS_RON_Breach_Styles").Split(";")
                end if
                
                if ((VA.GetText("AVCS_RON_Breach_Replacements")) isNot nothing)
                    replacementWords = VA.GetText("AVCS_RON_Breach_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 breachTypes.Length - 1
                    if (swatCommand.Contains(breachTypes(i)))
                        breachType = breachTypes(i)
                        if ((vaProxy.ParseTokens("{TXT:{TXT:AVCS_RON_Menu1_" + breachType + "}}")) isNot nothing)
                            breachTypeKey = vaProxy.ParseTokens("{TXT:{TXT:AVCS_RON_Menu1_" + breachType + "}}")
                            VA.SetText("~avcs_breach_type_key", breachTypeKey)
                        end if
                        exit for
                    end if
                next
                
                for i as integer = 0 to breachStyles.Length - 1
                    if (swatCommand.Contains(breachStyles(i)))
                        breachStyle = breachStyles(i)
                        if ((vaProxy.ParseTokens("{TXT:{TXT:AVCS_RON_Menu2_" + breachStyle + "}}")) isNot nothing)
                            breachStyleKey = vaProxy.ParseTokens("{TXT:{TXT:AVCS_RON_Menu2_" + breachStyle + "}}")
                        end if
                        exit for
                    end if
                next
                
                if (breachType <> "open")
                    VA.SetBoolean("~avcs_breaching", true)
                end if
                
                if (breachStyle <> "")
                    VA.SetText("~avcs_breach_style_key", breachStyleKey)
                else
                    if ((vaProxy.ParseTokens("{TXT:{TXT:AVCS_RON_Menu2_Clear}}")) isNot nothing)
                        breachStyleKey = vaProxy.ParseTokens("{TXT:{TXT:AVCS_RON_Menu2_Clear}}")
                    end if
                    
                    VA.SetText("~avcs_breach_style_key", breachStyleKey)
                end if
                
            end if
        end if
    End Sub
 
End Class

Comments