Author Topic: Debug mode  (Read 5711 times)

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Debug mode
« on: February 03, 2017, 02:10:42 AM »
Couple of request from the motley crew...

Could we have a debug mode which outputs all variables and their state when started and then whilst on, a variable and it's state when it gets altered and a cmd when it gets ran and what ran it.

Either the ability to open a 2nd edit window to "view" another profile or a copy of the same one being edited, with the ability to copy n paste from it. Or, the ability to have more than one va open at once.

and lastly,

a command context so that you can pass variables to a command and they become local variables in that command only. Would save setting umpteen variables prior to running a command.

Thanks :)
« Last Edit: February 03, 2017, 02:14:34 AM by TheThingIs »
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.

Antaniserse

  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 87
    • My VA plugins
Re: Debug mode
« Reply #1 on: February 03, 2017, 05:11:59 AM »
a command context so that you can pass variables to a command and they become local variables in that command only. Would save setting umpteen variables prior to running a command.
If I understand this correctly, you can to it with a small Inline function:

This is the command
Code: [Select]
Set Text [CreateLocalText] to 'Var1|AAA;Var2|BBB;Var3|;Var4|something else'
Set Text [CreateLocalInt] to 'Var1|12;Var2|0;Var3|1;Var4|987'
Inline VB Function: Set local vars from list
Write '[Orange] {TXT:~Var1}, {TXT:~Var2}, {TXT:~Var3}, {TXT:~Var4}' to log
Write '[Purple] {INT:~Var1}, {INT:~Var2}, {INT:~Var3}, {INT:~Var4}' to log

and this is the inline function to put at line 3:
Code: [Select]

Public Class VAInline
    Dim variables() As String
    Dim variable() As String

    Public Sub Main()
        If VA.GetText("CreateLocalText") IsNot Nothing
            variables = VA.GetText("CreateLocalText").Split(";")
            For each s As String in variables
                variable = s.Split("|")
                VA.SetText("~" & variable(0),variable(1))
            Next
        End If
        If VA.GetText("CreateLocalInt") IsNot Nothing
            variables = VA.GetText("CreateLocalInt").Split(";")
            For each s As String in variables
                variable = s.Split("|")
                VA.SetInt("~" & variable(0),Convert.ToInt32(variable(1)))
            Next
        End If
    End Sub
End Class
... expand at will with other data types

Note that you could also replace the two initial "Set Text [CreateXXX]"" with two "Read File" actions, and you will obtain a way to quickly initialize your local variables from simple text files

As for the debug mode, it would be nice if instead Gary could extend a bit the VA proxy object... what I'm thinking is simply a set of functions to return existing variable names, so that one could use the list to iterate and call the relevant GetXXX(name) functions... bonus point if the proxy could also expose a VariableChanged event that one could listen to from inline/plugin code

With this, it would be pretty easy to code your own debug windows as Inline Functions as well
"I am not perfect and neither was my career. In the end tennis is like life, messy."
Marat Safin