Advertisement
SemlerPDX

AVCS QCC Decrement Macro Step Actions in List

Aug 14th, 2020
998
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 7.02 KB | None | 0 0
  1. ' Quick Command Creator Inline-Function for VoiceAttack -  Decrement All Actions following Insert Step Choice
  2. '  by SemlerPDX Jun2020
  3. '  VETERANS-GAMING.COM
  4.  
  5.  
  6. Imports Microsoft.VisualBasic
  7. Imports System
  8. Imports System.Text
  9. Imports System.Collections
  10. Imports System.Collections.Generic
  11. Imports System.Data
  12. Imports System.Drawing
  13. Imports System.Diagnostics
  14. Imports System.Windows.Forms
  15. Imports System.Linq
  16. Imports System.Xml.Linq
  17. Imports System.Threading.Tasks
  18.  
  19. Public Class VAInline
  20.     dim stepIndex as Int32 = 1
  21.     dim nextIndex as Int32 = 1
  22.     dim moveIndex as Int32 = 1
  23.     dim stepCount as Int32 = 1
  24.     dim allSteps as string = ""
  25.     dim lastStep as string
  26.     dim lastSteps() as string
  27.     dim macroSteps() as string
  28.     dim macroData() as string
  29.     dim thisStep() as string
  30.     dim thisFormat as string
  31.     dim thisAction as string   
  32.     dim thisFunc as string
  33.     dim debugCheck as boolean
  34.     dim debugCount as integer = 0
  35.     dim debugColor as integer = 3
  36.     dim debugText as string = ""
  37.    
  38.    
  39.     Public Sub Main()
  40.        
  41.         if (VA.GetBoolean("AVCS_Debug_ON") IsNot nothing)
  42.             debugCheck = VA.GetBoolean("AVCS_Debug_ON")
  43.         end if
  44.        
  45.         if (VA.GetInt("~avcs_qcc_adv_step_move") IsNot nothing)
  46.             moveIndex = VA.GetInt("~avcs_qcc_adv_step_move") + 1
  47.             stepCount = moveIndex
  48.         end if
  49.        
  50.         while ((VA.GetText("~avcs_qcc_action_step_" + stepCount.ToString())) IsNot nothing)
  51.             stepCount += 1
  52.         end while
  53.         stepCount -= 1
  54.        
  55.         for stepIndex = moveIndex to stepCount
  56.             if ((VA.GetText("~avcs_qcc_action_step_" + stepIndex.ToString()))  IsNot nothing)
  57.                 lastSteps = (VA.GetText("~avcs_qcc_action_step_" + stepIndex.ToString()).Replace("[(2)]", "→")).Split("→")
  58.                 nextIndex = stepIndex - 1
  59.                 lastStep = nextIndex.ToString() + "[(2)]" + lastSteps(1).ToString()
  60.                
  61.                 VA.SetText("~avcs_qcc_action_step_" + nextIndex.ToString(), lastStep.ToString())
  62.                
  63.                 if (debugCheck)
  64.                     debugText = "DecrementSteps LOOP " + stepIndex.ToString() + ": " + lastStep.ToString()
  65.                     debugCount += 1
  66.                     debugColor = 10
  67.                     VA.SetText("~avcs_qcc_debug_" + debugCount.ToString(), debugText)
  68.                     VA.SetInt("~avcs_qcc_debug_wclr_" + debugCount.ToString(), debugColor)
  69.                 end if
  70.                
  71.                 VA.SetText("~avcs_qcc_action_step_" + stepIndex.ToString(), nothing)
  72.                 VA.SetText("~avcs_qcc_actions_final_" + stepIndex.ToString(), nothing)
  73.                 VA.SetText("~avcs_qcc_button_choice_" + stepIndex.ToString(), nothing)
  74.                 VA.SetText("~avcs_qcc_exe_cmd_" + stepIndex.ToString(), nothing)
  75.                 VA.SetText("~avcs_qcc_exe_type_choice_" + stepIndex.ToString(), nothing)
  76.                 VA.SetText("~avcs_qcc_keypress_choice_" + stepIndex.ToString(), nothing)
  77.                 VA.SetText("~avcs_qcc_keys_" + stepIndex.ToString(), nothing)
  78.                 VA.SetText("~avcs_qcc_last_step_" + stepIndex.ToString(), nothing)
  79.                 VA.SetText("~avcs_qcc_listening_choice_" + stepIndex.ToString(), nothing)
  80.                 VA.SetText("~avcs_qcc_mouse_choice_" + stepIndex.ToString(), nothing)
  81.                 VA.SetText("~avcs_qcc_pause_type_choice_" + stepIndex.ToString(), nothing)
  82.                 VA.SetText("~avcs_qcc_sound_" + stepIndex.ToString(), nothing)
  83.                 VA.SetText("~avcs_qcc_speech_type_choice_" + stepIndex.ToString(), nothing)
  84.                 VA.SetText("~avcs_qcc_speech_" + stepIndex.ToString(), nothing)
  85.                 VA.SetText("~avcs_qcc_step_" + stepIndex.ToString(), nothing)
  86.                 VA.SetText("~avcs_qcc_stop_choice_" + stepIndex.ToString(), nothing)
  87.                 VA.SetText("~avcs_qcc_wins_switch_" + stepIndex.ToString(), nothing)
  88.                 VA.SetText("~avcs_qcc_wins_" + stepIndex.ToString(), nothing)
  89.                
  90.             end if
  91.         next
  92.        
  93.         stepCount = 1
  94.         while ((VA.GetText("~avcs_qcc_action_step_" + stepCount.ToString())) IsNot nothing)
  95.             stepCount += 1
  96.         end while
  97.         stepCount -= 1
  98.        
  99.         if (moveIndex > 1)
  100.             stepIndex = moveIndex - 1
  101.         else
  102.             stepIndex = 0
  103.         end if
  104.        
  105.         VA.SetInt("~avcs_qcc_step_count", stepCount.ToString())
  106.         VA.SetInt("~avcs_qcc_adv_step", moveIndex.ToString())
  107.         VA.SetInt("~avcs_qcc_lst_step", stepIndex.ToString())
  108.        
  109.         for stepIndex = 1 to stepCount
  110.             if ((VA.GetText("~avcs_qcc_action_step_" + stepIndex.ToString()))  IsNot nothing)
  111.                 lastStep = VA.GetText("~avcs_qcc_action_step_" + stepIndex.ToString())
  112.                
  113.                 if not (lastStep.EndsWith("[(3)]"))
  114.                     allSteps = allSteps + lastStep + "[(3)]"
  115.                 else
  116.                     allSteps = allSteps + lastStep
  117.                 end if
  118.                
  119.                 if (debugCheck)
  120.                     debugText = "INSERT STEP - " + lastStep.ToString()
  121.                     debugCount += 1
  122.                     debugColor = 3
  123.                     VA.SetText("~avcs_qcc_debug_" + debugCount.ToString(), debugText)
  124.                     VA.SetInt("~avcs_qcc_debug_wclr_" + debugCount.ToString(), debugColor)
  125.                 end if
  126.  
  127.             end if
  128.         next
  129.        
  130.         if (debugCheck)
  131.             debugText = "STEPS FINAL - " + allSteps.ToString()
  132.             debugCount += 1
  133.             debugColor = 2
  134.             VA.SetText("~avcs_qcc_debug_" + debugCount.ToString(), debugText)
  135.             VA.SetInt("~avcs_qcc_debug_wclr_" + debugCount.ToString(), debugColor)
  136.         end if
  137.  
  138.        
  139.         if not (allSteps = "")
  140.            
  141.             VA.SetText("~avcs_qcc_allsteps", allSteps.ToString())
  142.            
  143.             macroSteps = (allSteps.Replace("[(1)]", "↑").Replace("[(2)]", "→").Replace("[(3)]", "↓").Replace("[(4)]", "←")).Split("↓")
  144.            
  145.             if (macroSteps) IsNot nothing
  146.                 for each macroStep as string in macroSteps
  147.                     if not (macroStep = "")
  148.                    
  149.                         macroData = macroStep.Split("←")
  150.                         thisStep = macroData(0).Split("→")
  151.                         stepIndex = Convert.ToInt32(thisStep(0))
  152.                         thisAction = thisStep(1)
  153.                         thisFunc = macroData(1)
  154.                         thisFormat = macroStep.Replace("→", "[(2)]").Replace("←", "[(4)]")
  155.                        
  156.                         if not (thisFormat.EndsWith("[(3)]"))
  157.                             thisFormat = thisFormat + "[(3)]"
  158.                         end if
  159.                        
  160.                         VA.SetText("~avcs_qcc_step_type_" + stepIndex.ToString(), thisAction.ToString())
  161.                         VA.SetText("~avcs_qcc_step_func_" + stepIndex.ToString(), thisFunc.ToString())
  162.                         VA.SetText("~avcs_qcc_action_step_" + stepIndex.ToString(), thisFormat.ToString())
  163.                        
  164.                         if (debugCheck)
  165.                             debugText = "STEP INDEX - " + stepIndex.ToString()
  166.                             debugCount += 1
  167.                             debugColor = 4
  168.                             VA.SetText("~avcs_qcc_debug_" + debugCount.ToString(), debugText)
  169.                             VA.SetInt("~avcs_qcc_debug_wclr_" + debugCount.ToString(), debugColor)
  170.                             debugText = "THIS ACTION - " + thisAction.ToString()
  171.                             debugCount += 1
  172.                             debugColor = 7
  173.                             VA.SetText("~avcs_qcc_debug_" + debugCount.ToString(), debugText)
  174.                             VA.SetInt("~avcs_qcc_debug_wclr_" + debugCount.ToString(), debugColor)
  175.                             debugText = "THIS FUNCTION - " + thisFunc.ToString()
  176.                             debugCount += 1
  177.                             debugColor = 3
  178.                             VA.SetText("~avcs_qcc_debug_" + debugCount.ToString(), debugText)
  179.                             VA.SetInt("~avcs_qcc_debug_wclr_" + debugCount.ToString(), debugColor)
  180.                             debugText = "THIS FORMAT - " + thisFormat.ToString()
  181.                             debugCount += 1
  182.                             debugColor = 2
  183.                             VA.SetText("~avcs_qcc_debug_" + debugCount.ToString(), debugText)
  184.                             VA.SetInt("~avcs_qcc_debug_wclr_" + debugCount.ToString(), debugColor)
  185.                         end if
  186.                    
  187.                     end if
  188.                 next
  189.            
  190.             end if
  191.         end if
  192.        
  193.         if (debugCount > 0)
  194.             VA.SetInt("~avcs_qcc_debug_count", debugCount)
  195.         end if
  196.        
  197.     End Sub
  198.  
  199. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement