Author Topic: VAExtensions, a general purpose plugin  (Read 78822 times)

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: VAExtensions, a general purpose plugin
« Reply #30 on: March 29, 2017, 08:20:26 AM »
This plugin can read and write data to and from VoiceAttack values/variables. It does not make profiles or commands.

In a way, it's a more advanced version of the "Value from file/URI" feature built into VoiceAttack's "Set a Text Value" action.

Antaniserse

  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 87
    • My VA plugins
Re: VAExtensions, a general purpose plugin
« Reply #31 on: March 30, 2017, 08:20:33 AM »
This plugin can read and write data to and from VoiceAttack values/variables. It does not make profiles or commands.

In a way, it's a more advanced version of the "Value from file/URI" feature built into VoiceAttack's "Set a Text Value" action.
Yes, pretty much this... it gives you a finer control over what format and what chunks of data you can extract from those files, compared to the built in "Value from file" action
"I am not perfect and neither was my career. In the end tennis is like life, messy."
Marat Safin

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: VAExtensions, a general purpose plugin
« Reply #32 on: May 01, 2017, 02:38:53 PM »
I tried out the VAExtensions plugin and the CSV Sample. For ease of viewing as of this writing, the CSV example file contains:

Code: [Select]
Ship            System        Station
Asp Explorer    Caledo        Jael Port
Sidewinder BD-02 5286     Borlaug Dock

...and the spoken output from running the "load file" command from the CSV Sample profile is: "file loaded, 2 rows and 3 columns."

The "read value" command from the CSV Sample profile contains:

Code: [Select]
Set Text [VxFile] to 'TestData\testcsv.csv'
Set integer [VxRow] value to 1
Set integer [VxColumn] value to 2
Execute external plugin, 'VA Extensions 2.0' and wait for return
Begin Small Integer Compare : [VxError] Equals 0
    Say, '{TXT:VxResult}'  (and wait until it completes)
End Condition
Begin Small Integer Compare : [VxError] Does Not Equal 0
    Write '[Red] {TXT:VxResult}' to log
End Condition - Exit when condition met
Pause 1 second
Set integer [VxRow] value to 2
Set Text [VxColumn] to 'Ship'
Execute external plugin, 'VA Extensions 2.0' and wait for return
Begin Small Integer Compare : [VxError] Equals 0
    Say, '{TXT:VxResult}'  (and wait until it completes)
End Condition
Begin Small Integer Compare : [VxError] Does Not Equal 0
    Write '[Red] {TXT:VxResult}' to log
End Condition - Exit when condition met

...and the spoken output for this command is: "Caledo" (pause) "BD-02 5286"

What I don't quite understand is how the "BD-02 5286" was returned when I'm sending VxColumn as 'Ship' (which would technically be the first column). I was expecting the output to be "Sidewinder" for the second spoken phrase (VxRow = 2 and VxColumn = Ship).

Am I mistaken here or does the "read_csv" plugin context not accept text variables for referencing rows or columns?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: VAExtensions, a general purpose plugin
« Reply #33 on: May 01, 2017, 02:47:41 PM »
It's a little confusing when you're following the examples, but the column number takes precedence over the column name, so you have to clear the column number variable for the plugin to read the text variable:
Code: [Select]
Set integer [VxColumn] value to [Not Set]
So to get the example working:
Code: [Select]
Set Text [VxFile] to 'TestData\testcsv.csv'
Set integer [VxRow] value to 1
Set integer [VxColumn] value to 2
Execute external plugin, 'VA Extensions 2.0' and wait for return
Begin Small Integer Compare : [VxError] Equals 0
    Say, '{TXT:VxResult}'  (and wait until it completes)
End Condition
Begin Small Integer Compare : [VxError] Does Not Equal 0
    Write '[Red] {TXT:VxResult}' to log
End Condition - Exit when condition met
Pause 1 second
Set integer [VxRow] value to 2
Set integer [VxColumn] value to [Not Set]
Set Text [VxColumn] to 'Ship'
Execute external plugin, 'VA Extensions 2.0' and wait for return
Begin Small Integer Compare : [VxError] Equals 0
    Say, '{TXT:VxResult}'  (and wait until it completes)
End Condition
Begin Small Integer Compare : [VxError] Does Not Equal 0
    Write '[Red] {TXT:VxResult}' to log
End Condition - Exit when condition met

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: VAExtensions, a general purpose plugin
« Reply #34 on: May 01, 2017, 02:56:52 PM »
As usual, Pfeil is the man (and freaky quick with his response)!

As a side note I have a sneaking suspicion that the comparison of VxRow in the "search value" command within the CSV Sample profile should be an INTEGER comparison and not a SMALL INTEGER comparison.

Antaniserse

  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 87
    • My VA plugins
Re: VAExtensions, a general purpose plugin
« Reply #35 on: May 02, 2017, 12:15:41 AM »
It's a little confusing when you're following the examples, but the column number takes precedence over the column name, so you have to clear the column number variable for the plugin to read the text variable

Yes, this is pretty much true elsewhere in the examples too.

Ever since the introduction of the new plugin interface, VA gives access to the whole range of existing variables to the plugin code (while the previous implementation only pushed the specific variables mentioned in the 'execute plugin' window), so it is not always obvious which ones you want to consider in the specific call and which ones are to be ignored

Now, to avoid any ambiguity, you need to clear the unused variables before executing other functions; at some point I should probably rework the code and samples a bit to make use of the new scoped variables (with ~ and >), which avoids these kind of issues

Quote
As a side note I have a sneaking suspicion that the comparison of VxRow in the "search value" command within the CSV Sample profile should be an INTEGER comparison and not a SMALL INTEGER comparison.
That is correct: line should read
Code: [Select]
    Begin Integer Compare : [VxRow] Equals 0
« Last Edit: May 02, 2017, 12:20:32 AM by Antaniserse »
"I am not perfect and neither was my career. In the end tennis is like life, messy."
Marat Safin

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: VAExtensions, a general purpose plugin
« Reply #36 on: May 02, 2017, 08:02:49 AM »
Is it possible to use VAExtensions to write to a CSV? If so is there an example to reference?

Antaniserse

  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 87
    • My VA plugins
Re: VAExtensions, a general purpose plugin
« Reply #37 on: May 02, 2017, 11:15:01 AM »
Is it possible to use VAExtensions to write to a CSV? If so is there an example to reference?

Not at this time

So far, basically every file manipulating function has been set for reading only, both as a safety measure and because for the most part people seems more interested in fetching data to feed to VA rather than the opposite

What kind of use did you have in mind: writing a file from scratch (easy) or saving data in specific "cells" of an existing CSV , by specifying row and colums (more complex)?
"I am not perfect and neither was my career. In the end tennis is like life, messy."
Marat Safin

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: VAExtensions, a general purpose plugin
« Reply #38 on: May 02, 2017, 11:52:18 AM »
I'm nearly finished developing a Mass Effect 3 profile that requires a fair amount of voiced user input depending on how much the user wants to customize his/her experience. I intend to publish the work as a mod, so I'm aiming to minimize the time required to get users up and running as well as the time users need to spend working directly with VA (besides issuing setup and in-game commands). I'm still refining and testing all the commands, but I can provide you more detail here or via PM if you want more context. Basically VA has to be "taught" the state of the game by the user (Shepard's class, current squadmates, available powers, etc), and VA saves all these variables for later use. Being able to export these variables outside of the profile would be quite handy, especially since different saved games may required different values for the profile variables.

Ideally it would be great to be able to search an external file for whatever variable I need, which keeps me from having to make sure that the order that VA defines variables exactly matches the order they appear in the external file. I also really like the array aspect of the CSV, which makes visualization and transfer of blocks of variables easier.

I agree with you in that more users probably just want to read a file instead of write to a file, but for my purposes VA is the engine by which everything is created and storing it externally would add more flexibility and robustness.

Antaniserse

  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 87
    • My VA plugins
Re: VAExtensions, a general purpose plugin
« Reply #39 on: May 02, 2017, 03:30:03 PM »
Basically VA has to be "taught" the state of the game by the user (Shepard's class, current squadmates, available powers, etc), and VA saves all these variables for later use.


Compared to the ED samples above, where one might need to handle a large number of ships, systems etc., I would guess that you don't need as much dynamic info for the ME3 data you just described.
So, I would suggest having a look at the INI sample profile instead, which is one of the few set of functions that has also writing support already coded, and should also be faster than CSV parsing
"I am not perfect and neither was my career. In the end tennis is like life, messy."
Marat Safin

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: VAExtensions, a general purpose plugin
« Reply #40 on: May 03, 2017, 07:33:13 AM »
Quote
Compared to the ED samples above, where one might need to handle a large number of ships, systems etc., I would guess that you don't need as much dynamic info for the ME3 data you just described.
I've yet to delve into ED or similar games, but you're probably right about that. "Complexity" is simply a matter of perspective :)

I tried out the INI sample, and it looks like an array containing the section titles and keys could be looped through to set all appropriate variables up from scratch. I'll keep plugging away at it. Thanks!

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: VAExtensions, a general purpose plugin
« Reply #41 on: May 04, 2017, 01:18:37 PM »
I got the variable export to work using:
  • a CSV with the list of all ~270 variables in my ME3 profile
  • VAExtentions for loading & reading the CSV
  • VAExtensions for exporting the variables listed in the CSV to an INI
For anyone interested, here's how the code shakes out:
Code: [Select]
//*Adapted from sample code by Antaniserse*
Write '[Purple] Please standby while exporting commences' to log
Say, 'Please standby while exporting commences'
Write '[Purple] Processing...' to log

//Identify file path for input/output files if necessary
Begin Integer Compare : [file path] Has Not Been Set
    Execute command, 'Get Game File Path' (and wait until it completes)
End Condition

//Initialize CSV-related variables and load CSV file containing master list of profile variables
Set small int (condition) [VxError] value to 0
Set integer [VxRow] value to 1
Set integer [VxColumn] value to 1
Set Text [VxDelimiter] to ','
Set Text [csvFile] to '{EXP:'{TXT:file path}' + '\ME3 Variable List.csv'}'
Set Text [VxFile] to [csvFile]
Execute external plugin, 'VA Extensions 2.0' and wait for return
Begin Small Integer Compare : [VxError] Does Not Equal 0
    Write '[Red] {TXT:VxResult}' to log
End Condition

//Initialize INI processing variables
Set Text [VxResult] to ''
Set Text [iniFile] to '{EXP:'{TXT:file path}' + '\ME3.ini'}'
Set Text [VxINISection] to 'ME3 Variables for VoiceAttack'
Start Loop While : [VxRow] Is Less Than Or Equals [VxRowsCount]
    //Retrieve variable name from CSV file
    Set Text [VxFile] to [csvFile]
    Execute external plugin, 'VA Extensions 2.0' and wait for return
    //Initialize remaining INI processing variables using results from CSV information retrieval
    Set Text [VxFile] to [iniFile]
    Set Text [VxINIKey] to '{TXT:VxResult}'
    Set Text [VxArgs] to '{TXT:{TXT:VxResult}}'
    //Write profile variable to INI file
    Execute external plugin, 'VA Extensions 2.0' and wait for return
    Set integer [VxRow] to [VxRow] plus 1
End Loop

Write '[Purple] Profile variable data export complete' to log
Say, 'Profile variable data export complete'  (and wait until it completes)

Importing the INI back into VA should follow a similar process. Thanks again Antaniserse for your help as well as this awesome plugin!  :D

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: VAExtensions, a general purpose plugin
« Reply #42 on: May 08, 2017, 09:20:52 AM »
@Antaniserse - if you ever have a chance to revisit the VAExtensions coding I would definitely be interested in having additional functionality (if technically possible) to sequentially read through an INI file (as opposed to directly referencing arguments and keys). If that's not possible, then being able to write to a CSV would be slick.

Antaniserse

  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 87
    • My VA plugins
Re: VAExtensions, a general purpose plugin
« Reply #43 on: May 09, 2017, 02:08:56 AM »
@Antaniserse - if you ever have a chance to revisit the VAExtensions coding I would definitely be interested in having additional functionality (if technically possible) to sequentially read through an INI file (as opposed to directly referencing arguments and keys). If that's not possible, then being able to write to a CSV would be slick.

Well, to be honest reading an INI file sequentially kind of defeat the purpose of using an INI file in the first place, since it's for when you need a structured format, not a stream of data... besides, technically it's already possible right now, if you name section and keys with an indexer ("[Section1]/[Section2]/... Key1=xx/Key2=yy/...) and loop accordingly in the VA code.

Writing a CSV is again not a problem from the coding aspect, it's just clunky when I think of how one could actually call that from inside a VA action... however, there are already undocumented functions (well, everything is undocumented actually  ::) I mean there's not even a sample profile) in the plugin for reading and writing databases in SQLite format, and I might as well complete that first: it will give you much better control and much better performance than a CSV
"I am not perfect and neither was my career. In the end tennis is like life, messy."
Marat Safin

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: VAExtensions, a general purpose plugin
« Reply #44 on: May 09, 2017, 07:43:47 AM »
Quote
technically it's already possible right now, if you name section and keys with an indexer ("[Section1]/[Section2]/... Key1=xx/Key2=yy/...) and loop accordingly in the VA code
Yep I agree on that front. I just didn't want to totally rewrite all my variables to match this format :)

I look forward to trying out reading/writing via SQLite!

M

  • Guest
Re: VAExtensions, a general purpose plugin
« Reply #45 on: July 09, 2017, 02:48:40 AM »
I'm not able to make this work, the plugin is not loaded and in the command this is displayed "UNABLE TO ACCESS PLUGIN - PLUGIN NOT AVAILABLE"
I placed the VAExtentions folder inside the "Apps" directory in VoiceAttack.
I also tried the spotify plugin and it get loaded fine.

By the way the download link in github is broken, I had to play with the URL in order to download the package (from /archive instead that /downloads).
Attached the file I got.

Thanks to anyone who can help with this!

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: VAExtensions, a general purpose plugin
« Reply #46 on: July 09, 2017, 07:59:02 AM »
I placed the VAExtentions folder inside the "Apps" directory in VoiceAttack.
Did you copy the folder from that .zip? That's the source code, it needs to be compiled to a .dll so VoiceAttack can use it.


You should be able to download a precompiled version from https://github.com/Antaniserse/VAExtensions/releases, but that's returning an error, as you've said:
Quote
<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>

I would assume that's something the author needs to fix from his end.
« Last Edit: July 10, 2017, 07:37:29 AM by Pfeil »

Antaniserse

  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 87
    • My VA plugins
Re: VAExtensions, a general purpose plugin
« Reply #47 on: July 10, 2017, 06:42:57 AM »
By the way the download link in github is broken, I had to play with the URL in order to download the package (from /archive instead that /downloads)

The download link is fine: from the main GitHub page follow the link marked "Releases" and simply get the latest compiled version



what you attached here is the source version, which should work too but you need to compile it yourself (however, I'm not sure where you found the /archive and /download links to be honest...)


You should be able to download a precompiled version from https://github.com/Antaniserse/VAExtensions/releases, but that's returning an error, as you've said:
Code: [Select]
<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
I would assume that's something the author needs to fix from his end.

Just tested with a fresh download, it looks like it's working as usual here, both on VA 1.6.6 and VA 1.6.7... is that error from a specific command (I tried a few of the usual example within the profiles included included) or with any command in general?
« Last Edit: July 10, 2017, 06:47:11 AM by Antaniserse »
"I am not perfect and neither was my career. In the end tennis is like life, messy."
Marat Safin

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: VAExtensions, a general purpose plugin
« Reply #48 on: July 10, 2017, 07:41:59 AM »
Just tested with a fresh download, it looks like it's working as usual here, both on VA 1.6.6 and VA 1.6.7... is that error from a specific command (I tried a few of the usual example within the profiles included included) or with any command in general?
Sorry to send you on a wild goose chase  :-\

Checking it again, I'm now getting a cross-site scripting warning which I didn't get before(Rebooting overnight probably fixed it); The download was blocked by security software on my end, works fine when I turn that off.

M

  • Guest
Re: VAExtensions, a general purpose plugin
« Reply #49 on: July 12, 2017, 03:00:38 PM »
By the way the download link in github is broken, I had to play with the URL in order to download the package (from /archive instead that /downloads)

The download link is fine: from the main GitHub page follow the link marked "Releases" and simply get the latest compiled version



what you attached here is the source version, which should work too but you need to compile it yourself (however, I'm not sure where you found the /archive and /download links to be honest...)



Hi there, thank you for taking the time to look into my issue.
Since I received an error using the link you showcased in the screenshot I assumed that it may have pointed to a wrong folder and tried to guess a right URL on my own by looking at the other in the same page. I came up with this https://github.com/Antaniserse/VAExtensions/archive/v2.0/VAExtensions.zip that as you mentioned it is unfortunately just an altenative link to the source code.

I don't understand why the download doesn't work for me, I attached a screenshot of the error I receive here.
Do you mind sharing the zip file in this thread? Really curious to try your JSON plugin, it may allow me to easily fetch wikipedia entries.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: VAExtensions, a general purpose plugin
« Reply #50 on: July 12, 2017, 03:26:08 PM »
I don't understand why the download doesn't work for me, I attached a screenshot of the error I receive here.
I see you're running the "NoScript" plugin for Firefox, that's what's blocking the script(because of its XSS protection) and causing the error.
You can either use a browser without it, or try disabling it, to enable the download.

blueknight

  • Newbie
  • *
  • Posts: 14
Re: VAExtensions, a general purpose plugin
« Reply #51 on: October 23, 2017, 12:24:45 AM »
Is there a way to grab the whole Row and assign it to variables with one lookup?

here is an example of flow:
1. Search for something
2. Get Answer Back on a Row (lets Say 2)
3. Do Lookup on Row and automatically come back with.
a. Row2 / Column 1 - Then stick the result in Variable-2-1
b. Row2 / Column 2 - The Stick the result in Variable-2-2

etc

I have the logic of doing multiple reads, but since you have all of this already loaded in memory, what would be the easier way to look it up.


blueknight

  • Newbie
  • *
  • Posts: 14
Re: VAExtensions, a general purpose plugin
« Reply #52 on: October 24, 2017, 11:02:02 PM »
So I am getting an error what I am trying to do is create a suffix in Voice attack then take the data and feed it through to the  script to be able to look up things.

So as an example my file contains.
VAName,Row 2, Row 3, Row 4

So what I am trying to do is grab the variable from the command (When I say). Then look that up in VAName, then grab the row and bring back all the other variables.

So what I am noticing is that I am getting a ROW not set. Can anyone help with this?

Code: [Select]
    Set Text [VxArgs] to '{SUFFIX}'
    Write '[Pink] VxArgs = {TXT:VxArgs}' to log
    DISABLED - Set Text [VxFile] to [Var-Systems-File]
    Write '[Purple] File set to = {TXT:VxFile}' to log
    Set Text [VxColumn] to 'VAName'
    Write '[Pink] Column = {TXT:VxColumn}' to log
    Write '[Purple] Executing Plugin for Search' to log
    Execute external plugin, 'VA Extensions 2.0' and wait for return
    Write '[Red] {TXT:VxResult}' to log
    Begin Small Integer Compare : [VxError] Equals 0
        Begin Small Integer Compare : [VxRow] Equals 0
            Say, 'Commander {TXT:VAR-CMDR-Name}, System name not found. Please add it to my list if you want to go there frequently. '  (and wait until it completes)
        End Condition
    End Condition
    Begin Small Integer Compare : [VxError] Does Not Equal 0
        Write '[Red] {TXT:VxResult}' to log
    End Condition - Exit when condition met
    Set integer [VxRow] value to the value of [VxResult]
    Set integer [VxColumn] value to [Not Set]
    Set integer [VxColumn] value to 2
    Execute external plugin, 'VA Extensions 2.0' and wait for return
    Begin Small Integer Compare : [VxError] Equals 0
        Say, '{TXT:VxResult}'  (and wait until it completes)
    End Condition
    Begin Small Integer Compare : [VxError] Does Not Equal 0
        Write '[Red] {TXT:VxResult}' to log
    End Condition - Exit when condition met


Antaniserse

  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 87
    • My VA plugins
Re: VAExtensions, a general purpose plugin
« Reply #53 on: October 28, 2017, 12:14:10 AM »
Sorry, are we talking about what plugin function, exactly? The one that reads CSV files?

If I understand the code above correctly, after you call the plugin for a "search_csv" action, you don't need to do:

Code: [Select]
    Set integer [VxRow] value to the value of [VxResult]
because it already contains the index of the found row; VxResult is also storing this, but a a text variable, not a int one

I'll have a look into the full row result you mentioned earlier....
« Last Edit: October 28, 2017, 12:26:12 AM by Antaniserse »
"I am not perfect and neither was my career. In the end tennis is like life, messy."
Marat Safin

Wolfang42

  • Newbie
  • *
  • Posts: 13
Re: VAExtensions, a general purpose plugin
« Reply #54 on: November 25, 2023, 01:18:51 PM »
Is there a way to make
Code: [Select]
[VxResult] *not* have
Code: [Select]
" surrounding the result?

SemlerPDX

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 291
  • Upstanding Lunatic
    • My AVCS Homepage
Re: VAExtensions, a general purpose plugin
« Reply #55 on: November 26, 2023, 09:32:28 AM »
You can just replace it with nothing: