Author Topic: Better structure in commands - using names of datarefs in variables  (Read 1257 times)

jannik

  • Newbie
  • *
  • Posts: 5
Hi all!

I am using VoiceAttack in connection with the SpadNext plugin in order to execude comands to a "programmed" 2. pilot in x-plane.

Everything works very well, but I have experienced, that I get a lot of commands in VoiceAttack that is almost identical except for the adressed DataRef in SpadNext / x-plane.

Therefore (and for other reasons as well) I want to structure my commands in the way that I would like
to save the NAME of the DataRef in a variable and then reference this in the following lines in the command definition.
An example, where the DataRef a320/Pedestal/ParkBrake is a decimal variable:

Set Text [StatusDataRefName] to 'a320/Pedestal/ParkBrake'
Write 'Got value on StatusDataRef = {TXT:StatusDataRefName}' to log
>>>> this shows following info in the log: Got value on StatusDataRef = a320/Pedestal/ParkBrake

And then in an "execute external plugin" i fill out the following fields:

Plugin:   SPAD.neXt VoiceAttack Plugin
Plugin Context:   GetValue
Decimal Variables: XPLANE!{TXT:StatusDataRefName}


This gives the following error in the log file:
SPAD.neXt: GetValue: Failed to get XPLANE!{TXT:StatusDataRefName}: Variable 'XPLANE!{TXT:StatusDataRefName}' not found

In other words - the plugin does not "substitute" the {TXT:StatusDataRefName} token with the contents of the StatusDataRefName

Can anyone help me?

Kind regards
Jannik

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Better structure in commands - using names of datarefs in variables
« Reply #1 on: February 23, 2020, 06:54:45 AM »
The legacy fields in the "Variables to pass to the plugin function (semicolon-delimited):" section of the "Execute an External Plugin Function" action do not parse tokens in variable names.

The plugin itself can work around this by using the "vaProxy.Utility.ParseTokens()" method, or it could be upgraded to use plugin interface V4, as the "Plugin Context" field used by that interface does parse tokens.

jannik

  • Newbie
  • *
  • Posts: 5
Re: Better structure in commands - using names of datarefs in variables
« Reply #2 on: February 23, 2020, 04:11:33 PM »
Hi Pfeil!

Thanks for your quick answer.

Since I am not a programmer, I read and understand your answer in the following way:

1) the SpadNext plugin as is, is not able to support tokens as I hoped it would be able to do.

2) using the vaProxy.Utility.ParseTokens() method would mean a change in the SpadNext plugin module.

3) the interface V4 would likewise mean an upgrade or new release of the SpadNext plugin.

Unfortunately I am not a programmer and even if I was, I do not have access to the source code for the SpadNext plugin, so all in all I stay at a dead end.

Could you please give your comments on this?

Kind regards
Jannik

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Better structure in commands - using names of datarefs in variables
« Reply #3 on: February 23, 2020, 04:26:33 PM »
That's pretty much it.

As SPAD.neXt expects variables of a specific type, and uses the name of those variables as input as well, there is no workaround like setting an intermediate value.


You could contact the author of SPAD.neXt; They appear to have a support ticket system and a forum.