Advertisement
SemlerPDX

AVCS QCC Find all Command Phrases for When I Say

Aug 14th, 2020
1,200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 3.44 KB | None | 0 0
  1. ' Quick Command Creator Inline-Function for VoiceAttack -  Find available QCC Commands and set to Master Command Variables
  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 cmdIndex as Int32
  20.     dim cmdMax as Int32 = 25
  21.     dim phrase as string
  22.     dim phrases as string
  23.     dim phraseDataCheck as string
  24.     dim phrasesUnique as string = ""
  25.     dim macrosUnique as string = ""
  26.     dim listenUnique as string = ""
  27.     dim toggleUnique as string = ""
  28.     dim phraseArray() as string
  29.     dim phrasesFinal as new list(of string) ()
  30.    
  31.    
  32.     Public Sub Main()
  33.        
  34.         if ((VA.GetInt("AVCS_QCC_COMMAND_MAX")) IsNot nothing)
  35.             cmdMax = Convert.ToInt32(VA.GetInt("AVCS_QCC_COMMAND_MAX"))
  36.         end if
  37.        
  38.         'Load all QCC Commands to main phrase(s) variable
  39.         for cmdIndex = 1 to cmdMax
  40.        
  41.             if (((VA.GetText("AVCS_QCC_COMMAND_" + cmdIndex.ToString())) IsNot nothing) and ((VA.GetText("AVCS_QCC_DATA_COMMAND_" + cmdIndex.ToString())) IsNot nothing))
  42.                 phrases = (VA.GetText("AVCS_QCC_COMMAND_" + cmdIndex.ToString()))
  43.                 phraseArray = vaProxy.Utility.ExtractPhrases(phrases, true, true)
  44.                 for each phrase in phraseArray
  45.                     if ((not(phrase = "")) and (not(phrasesFinal.Contains(phrase))))
  46.                         phrasesFinal.Add(phrase)
  47.                         phrasesUnique = phrasesUnique + phrase + ";"
  48.                         VA.SetText(phrase, cmdIndex.ToString())
  49.                     end if
  50.                 next
  51.             end if
  52.            
  53.             if (((VA.GetText("AVCS_QCC_MACROS_" + cmdIndex.ToString())) IsNot nothing) and ((VA.GetText("AVCS_QCC_DATA_MACROS_" + cmdIndex.ToString())) IsNot nothing))
  54.                 phraseDataCheck = VA.GetText("AVCS_QCC_DATA_MACROS_" + cmdIndex.ToString())
  55.                 phrases = (VA.GetText("AVCS_QCC_MACROS_" + cmdIndex.ToString()))
  56.                 phraseArray = vaProxy.Utility.ExtractPhrases(phrases, true, true)
  57.                 for each phrase in phraseArray
  58.                     if ((not(phrase = "")) and (not(phrasesFinal.Contains(phrase))))
  59.                         phrasesFinal.Add(phrase)
  60.                         'Check for commands with Start/Toggle VoiceAttack listening
  61.                         if ((not(phraseDataCheck.Contains("1[(2)]VALB"))) and (not(phraseDataCheck.Contains("1[(2)]VALT"))))
  62.                             macrosUnique = macrosUnique + phrase + ";"
  63.                         else
  64.                             if (phraseDataCheck.Contains("1[(2)]VALB"))
  65.                                 listenUnique = listenUnique + phrase + ";"
  66.                             else if (phraseDataCheck.Contains("1[(2)]VALT"))
  67.                                 toggleUnique = toggleUnique + phrase + ";"
  68.                             end if
  69.                         end if
  70.                         'Set Key Data Variable Name to Variable Name including each Quick Command Phrase
  71.                         VA.SetText(phrase, cmdIndex.ToString())
  72.                     end if
  73.                 next
  74.  
  75.             end if
  76.         next
  77.        
  78.         'Create Variables for 'When I Say' Tokens containing all QCC phrases
  79.         if not (phrasesUnique = "")
  80.             VA.SetText("AVCS_QCC_COMMANDS", phrasesUnique)
  81.         else
  82.             VA.SetText("AVCS_QCC_COMMANDS", nothing)
  83.         end if
  84.         if not (macrosUnique = "")
  85.             VA.SetText("AVCS_QCC_MACROS", macrosUnique)
  86.         else
  87.             VA.SetText("AVCS_QCC_MACROS", nothing)
  88.         end if
  89.         if not (listenUnique = "")
  90.             VA.SetText("AVCS_QCC_LISTEN", listenUnique)
  91.         else
  92.             VA.SetText("AVCS_QCC_LISTEN", nothing)
  93.         end if
  94.         if not (toggleUnique = "")
  95.             VA.SetText("AVCS_QCC_LISTEN_TOGGLE", toggleUnique)
  96.         else
  97.             VA.SetText("AVCS_QCC_LISTEN_TOGGLE", nothing)
  98.         end if
  99.        
  100.     End Sub
  101. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement