SemlerPDX

AVCS Ready or Not SWAT Breach Command Parser v4

Jan 16th, 2022 (edited)
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.72 KB | None | 0 0
  1. ' Ready Or Not - AVCS4 SWAT Breach & Clear Command Parsing
  2. '  by SemlerPDX Dec2021
  3. '  VETERANS-GAMING.COM
  4. ' --Parses spoken commands to retrieve config variables and resolve to VoiceAttack Global Keypress Variables
  5.  
  6.  
  7. Imports Microsoft.VisualBasic
  8. Imports System
  9.  
  10. Public Class VAInline
  11.     dim replacementWords() as string
  12.     dim replacement() as string
  13.     dim breachTypes() as string
  14.     dim breachStyles() as string
  15.     dim breachType as string = ""
  16.     dim breachStyle as string = ""
  17.     dim breachTypeKey as string = ""
  18.     dim breachStyleKey as string = ""
  19.     dim swatCommand as string
  20.    
  21.    
  22.     Public Sub Main()
  23.         if ((VA.GetText("~~avcs_swat_cmd")) isNot nothing)
  24.        
  25.             swatCommand = VA.GetText("~~avcs_swat_cmd")
  26.             if (swatCommand <> "")
  27.                
  28.                 if ((VA.GetText("AVCS_RON_Breach_Types")) isNot nothing)
  29.                     breachTypes = VA.GetText("AVCS_RON_Breach_Types").Split(";")
  30.                 end if
  31.                
  32.                 if ((VA.GetText("AVCS_RON_Breach_Styles")) isNot nothing)
  33.                     breachStyles = VA.GetText("AVCS_RON_Breach_Styles").Split(";")
  34.                 end if
  35.                
  36.                 if ((VA.GetText("AVCS_RON_Breach_Replacements")) isNot nothing)
  37.                     replacementWords = VA.GetText("AVCS_RON_Breach_Replacements").Split(";")
  38.                     for each replacementSet as string in replacementWords
  39.                         if (replacementSet.Contains(","))
  40.                             replacement = replacementSet.Split(",")
  41.                             swatCommand = swatCommand.Replace(replacement(0), replacement(1))
  42.                         end if
  43.                     next
  44.                 end if
  45.                
  46.                 for i as integer = 0 to breachTypes.Length - 1
  47.                     if (swatCommand.Contains(breachTypes(i)))
  48.                         breachType = breachTypes(i)
  49.                         if ((vaProxy.ParseTokens("{TXT:{TXT:AVCS_RON_Menu1_" + breachType + "}}")) isNot nothing)
  50.                             breachTypeKey = vaProxy.ParseTokens("{TXT:{TXT:AVCS_RON_Menu1_" + breachType + "}}")
  51.                             VA.SetText("~avcs_breach_type_key", breachTypeKey)
  52.                         end if
  53.                         exit for
  54.                     end if
  55.                 next
  56.                
  57.                 for i as integer = 0 to breachStyles.Length - 1
  58.                     if (swatCommand.Contains(breachStyles(i)))
  59.                         breachStyle = breachStyles(i)
  60.                         if ((vaProxy.ParseTokens("{TXT:{TXT:AVCS_RON_Menu2_" + breachStyle + "}}")) isNot nothing)
  61.                             breachStyleKey = vaProxy.ParseTokens("{TXT:{TXT:AVCS_RON_Menu2_" + breachStyle + "}}")
  62.                         end if
  63.                         exit for
  64.                     end if
  65.                 next
  66.                
  67.                 if (breachType <> "open")
  68.                     VA.SetBoolean("~avcs_breaching", true)
  69.                 end if
  70.                
  71.                 if (breachStyle <> "")
  72.                     VA.SetText("~avcs_breach_style_key", breachStyleKey)
  73.                 else
  74.                     if ((vaProxy.ParseTokens("{TXT:{TXT:AVCS_RON_Menu2_Clear}}")) isNot nothing)
  75.                         breachStyleKey = vaProxy.ParseTokens("{TXT:{TXT:AVCS_RON_Menu2_Clear}}")
  76.                     end if
  77.                    
  78.                     VA.SetText("~avcs_breach_style_key", breachStyleKey)
  79.                 end if
  80.                
  81.             end if
  82.         end if
  83.     End Sub
  84.  
  85. End Class
Add Comment
Please, Sign In to add comment