Author Topic: Trouble with PassedText in vaProxy.Command.Execute  (Read 1231 times)

zL0ki

  • Newbie
  • *
  • Posts: 16
Trouble with PassedText in vaProxy.Command.Execute
« on: February 19, 2021, 10:06:12 AM »
In the pursuit of greater understanding I'm testing passing values and execute another command

When using 'Execute Another Command' I can output some arbitrary string value as expected from the executed command using the below:

 
Code: [Select]
Write [Blue] ''{TXT:~passedText1}' to log

However, if I try this with inline function for instance:


Code: [Select]
vaProxy.Command.Execute("fire weapons",  WaitForReturn: true, PassedText: "testing");
I get a 'Not Set'. I haven't managed to see the error in my syntax.

I've followed the various examples as below and it executes the command so the passed value is the issue.

Code: [Select]
public void MyCompletedFunction(Guid? theInternalId)
{
      VA.WriteToLog(theInternalId.ToString() + " completed", "Orange");
}

public void main()
{
    vaProxy.Command.Execute("fire weapons",true);
    vaProxy.Command.Execute("fire weapons", true, true, MyCompletedFunction);
}





Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4758
  • RTFM
Re: Trouble with PassedText in vaProxy.Command.Execute
« Reply #1 on: February 19, 2021, 10:14:28 AM »
Have you read the "Passed Values (Advanced)" section of the documentation, as is referenced in the documentation for the Command.Execute() method?

It quite explicitly states in the "Text" subsection:
Quote
Literal values MUST be enclosed in double quotes. Literal values can also contain any
number of tokens. Variable names must NOT be enclosed in double quotes

As you are not using double quotes, the value is interpreted as a variable name, so unless you happen to have a variable named "testing" set, the value returned will correctly be "Not set" (I.E. null).

zL0ki

  • Newbie
  • *
  • Posts: 16
Re: Trouble with PassedText in vaProxy.Command.Execute
« Reply #2 on: February 19, 2021, 10:56:12 AM »
I wouldn't have posted a thread if I hadn't read the documentation. Literally pouring over it for hours. What are double quotes?

These are all double quotes.
“English double quotes“, “this is some text”, "this is some text".


Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4758
  • RTFM
Re: Trouble with PassedText in vaProxy.Command.Execute
« Reply #3 on: February 19, 2021, 11:03:47 AM »
Standard double quotes, ASCII character 34 (decimal), I.E. those that a normal keyboard has a key for.

Ironically, those in the documentation are the wrong type, because Microsoft Word insists on using "Smart quotes" by default.


You'll need to escape them when used inside a C# string literal, as well.