Advertisement
SemlerPDX

AVCS QCC Insert New Action Before and Increment all Macro Steps

Aug 14th, 2020
1,520
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 5.67 KB | None | 0 0
  1. ' Quick Command Creator Inline-Function for VoiceAttack -  Increment 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")
  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 = stepCount to moveIndex step -1
  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 = "IncrementSteps 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.             end if
  72.         next
  73.        
  74.         stepCount = 1
  75.         while ((VA.GetText("~avcs_qcc_action_step_" + stepCount.ToString())) IsNot nothing)
  76.             stepCount += 1
  77.         end while
  78.         stepCount -= 1
  79.        
  80.         if (moveIndex > 1)
  81.             stepIndex = moveIndex - 1
  82.         else
  83.             stepIndex = 0
  84.         end if
  85.        
  86.         VA.SetInt("~avcs_qcc_step_count", stepCount.ToString())
  87.         VA.SetInt("~avcs_qcc_adv_step", moveIndex.ToString())
  88.         VA.SetInt("~avcs_qcc_lst_step", stepIndex.ToString())
  89.        
  90.         for stepIndex = 1 to stepCount
  91.             if ((VA.GetText("~avcs_qcc_action_step_" + stepIndex.ToString()))  IsNot nothing)
  92.                 lastStep = VA.GetText("~avcs_qcc_action_step_" + stepIndex.ToString())
  93.                
  94.                 if not (lastStep.EndsWith("[(3)]"))
  95.                     allSteps = allSteps + lastStep + "[(3)]"
  96.                 else
  97.                     allSteps = allSteps + lastStep
  98.                 end if
  99.                
  100.                 if (debugCheck)
  101.                     debugText = "INSERT STEP - " + lastStep.ToString()
  102.                     debugCount += 1
  103.                     debugColor = 3
  104.                     VA.SetText("~avcs_qcc_debug_" + debugCount.ToString(), debugText)
  105.                     VA.SetInt("~avcs_qcc_debug_wclr_" + debugCount.ToString(), debugColor)
  106.                 end if
  107.            
  108.             end if
  109.         next
  110.        
  111.         if (debugCheck)
  112.             debugText = "STEPS FINAL - " + allSteps.ToString()
  113.             debugCount += 1
  114.             debugColor = 2
  115.             VA.SetText("~avcs_qcc_debug_" + debugCount.ToString(), debugText)
  116.             VA.SetInt("~avcs_qcc_debug_wclr_" + debugCount.ToString(), debugColor)
  117.         end if
  118.        
  119.         if not (allSteps = "")
  120.            
  121.             VA.SetText("~avcs_qcc_allsteps", allSteps.ToString())
  122.            
  123.             macroSteps = (allSteps.Replace("[(1)]", "↑").Replace("[(2)]", "→").Replace("[(4)]", "←")).Split("↓")
  124.            
  125.             if (macroSteps) IsNot nothing
  126.                 for each macroStep as string in macroSteps
  127.                     if not (macroStep = "")
  128.                         macroData = macroStep.Split("←")
  129.                         thisStep = macroData(0).Split("→")
  130.                         stepIndex = Convert.ToInt32(thisStep(0))
  131.                         thisAction = thisStep(1)
  132.                         thisFunc = macroData(1)
  133.                         thisFormat = macroStep.Replace("→", "[(2)]").Replace("←", "[(4)]")
  134.                         if not (thisFormat.EndsWith("[(3)]"))
  135.                             thisFormat = thisFormat + "[(3)]"
  136.                         end if
  137.                         VA.SetText("~avcs_qcc_step_type_" + stepIndex.ToString(), thisAction.ToString())
  138.                         VA.SetText("~avcs_qcc_step_func_" + stepIndex.ToString(), thisFunc.ToString())
  139.                         VA.SetText("~avcs_qcc_action_step_" + stepIndex.ToString(), thisFormat.ToString())
  140.                        
  141.                         if (debugCheck)
  142.                             debugText = "STEP INDEX - " + stepIndex.ToString()
  143.                             debugCount += 1
  144.                             debugColor = 4
  145.                             VA.SetText("~avcs_qcc_debug_" + debugCount.ToString(), debugText)
  146.                             VA.SetInt("~avcs_qcc_debug_wclr_" + debugCount.ToString(), debugColor)
  147.                             debugText = "THIS ACTION - " + thisAction.ToString()
  148.                             debugCount += 1
  149.                             debugColor = 7
  150.                             VA.SetText("~avcs_qcc_debug_" + debugCount.ToString(), debugText)
  151.                             VA.SetInt("~avcs_qcc_debug_wclr_" + debugCount.ToString(), debugColor)
  152.                             debugText = "THIS FUNCTION - " + thisFunc.ToString()
  153.                             debugCount += 1
  154.                             debugColor = 3
  155.                             VA.SetText("~avcs_qcc_debug_" + debugCount.ToString(), debugText)
  156.                             VA.SetInt("~avcs_qcc_debug_wclr_" + debugCount.ToString(), debugColor)
  157.                             debugText = "THIS FORMAT - " + thisFormat.ToString()
  158.                             debugCount += 1
  159.                             debugColor = 2
  160.                             VA.SetText("~avcs_qcc_debug_" + debugCount.ToString(), debugText)
  161.                             VA.SetInt("~avcs_qcc_debug_wclr_" + debugCount.ToString(), debugColor)
  162.                         end if
  163.                    
  164.                     end if
  165.                 next
  166.            
  167.             end if
  168.         end if
  169.        
  170.         if (debugCount > 0)
  171.             VA.SetInt("~avcs_qcc_debug_count", debugCount)
  172.         end if
  173.    
  174.     End Sub
  175.  
  176. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement