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

Exergist

  • Full Member
  • ***
  • Posts: 100
Re: VAExtensions, a general purpose plugin
« Reply #40 on: May 03, 2017, 06: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

  • Full Member
  • ***
  • Posts: 100
Re: VAExtensions, a general purpose plugin
« Reply #41 on: May 04, 2017, 12: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

  • Full Member
  • ***
  • Posts: 100
Re: VAExtensions, a general purpose plugin
« Reply #42 on: May 08, 2017, 08: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: 78
    • My VA plugins
Re: VAExtensions, a general purpose plugin
« Reply #43 on: May 09, 2017, 01: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

  • Full Member
  • ***
  • Posts: 100
Re: VAExtensions, a general purpose plugin
« Reply #44 on: May 09, 2017, 06: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!