Advertisement
SemlerPDX

Check New Phrase for Existing Phrases already in use

Aug 14th, 2020
1,011
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.96 KB | None | 0 0
  1. ' Quick Command Creator Inline-Function for VoiceAttack -  Check for Existing Phrases already in use
  2. '  by SemlerPDX Jun2020
  3. '  VETERANS-GAMING.COM
  4.  
  5.  
  6. Imports Microsoft.VisualBasic
  7. Imports System
  8. Imports System.Collections
  9. Imports System.Collections.Generic
  10. Imports System.Data
  11. Imports System.Drawing
  12. Imports System.Diagnostics
  13. Imports System.Windows.Forms
  14. Imports System.Linq
  15. Imports System.Xml.Linq
  16. Imports System.Threading.Tasks
  17.  
  18. Public Class VAInline
  19.     dim saveFile as string = ""
  20.     dim phrase as string
  21.     dim phrases as string
  22.     dim commands as string = ""
  23.     dim phraseArray() as string
  24.     dim errorCount as integer = 0
  25.     dim errorsFinal as new list(of string) ()
  26.    
  27.     Public Sub Main()
  28.        
  29.         if (VA.GetText("~save_file") IsNot nothing)
  30.             saveFile = VA.GetText("~save_file")
  31.         end if
  32.  
  33.         if (VA.GetText("AVCS_QCC_COMMANDS") IsNot nothing)
  34.             commands = VA.GetText("AVCS_QCC_COMMANDS")
  35.         end if
  36.        
  37.         if (VA.GetText("AVCS_QCC_MACROS") IsNot nothing)
  38.             commands = VA.GetText("AVCS_QCC_MACROS") + ";" + commands
  39.         end if
  40.        
  41.         if (VA.GetText("AVCS_QCC_LISTEN") IsNot nothing)
  42.             commands = VA.GetText("AVCS_QCC_LISTEN") + ";" + commands
  43.         end if
  44.        
  45.         if (VA.GetText("AVCS_QCC_LISTEN_TOGGLE") IsNot nothing)
  46.             commands = VA.GetText("AVCS_QCC_LISTEN_TOGGLE") + ";" + commands
  47.         end if
  48.        
  49.         if (VA.GetText("~avcs_qcc_phrase") IsNot nothing)
  50.            
  51.             phrases = (VA.GetText("~avcs_qcc_phrase"))
  52.             phraseArray = vaProxy.Utility.ExtractPhrases(phrases, true, true)
  53.            
  54.             for each phrase in phraseArray
  55.                 if ((not(phrase = "")) and (not(errorsFinal.Contains(phrase))))
  56.                     if ((commands.Contains(phrase)) or (saveFile.Contains(phrase)) or(vaProxy.Command.Exists(phrase)))
  57.                         errorsFinal.Add(phrase)
  58.                         errorCount = errorCount + 1
  59.                         VA.SetText("~avcs_qcc_error_" + errorCount.ToString(), phrase)
  60.                     end if
  61.                 end if
  62.             next
  63.         end if
  64.        
  65.         if(errorCount > 0)
  66.             VA.SetInt("~avcs_qcc_error_count", errorCount)
  67.         end if
  68.        
  69.     End Sub
  70. End Class
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement