Author Topic: Plugin vs. Inline Function  (Read 2909 times)

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Plugin vs. Inline Function
« on: March 12, 2018, 04:43:44 PM »
Can anyone chime in about the advantages/disadvantages of using a plugin versus an inline function to perform a given set of actions?

At first glance it feels like the plugin interface is cumbersome compared to passing data directly from VA variables into an inline function. Though it looks like using plugins would help tidy up the VA root directory if you need to include your own dynamic-link libraries (.dll), since any dll files that are user generated need to be placed in the root folder for them to be available via inline function.

Any more thoughts? Thanks!

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Plugin vs. Inline Function
« Reply #1 on: March 13, 2018, 03:19:22 AM »
With a plugin you have more control over when it runs, both in the sense that it can start without being triggered by a command first, and that it'll be unaffected by the "Stop All Commands" instruction if you choose to implement it that way.

The flipside is that you also need to manage other aspects of this; Where an inline function will automatically stop(if it's set up properly) when you change profiles, a plugin will continue running in the background unless you explicitly stop it.


Debugging is much quicker with an inline function, in my experience.

While you can set up your IDE to close VoiceAttack, build your plugin directly to the Apps directory, and start VoiceAttack again, that takes much longer than just hitting "Test Run".


Inline functions are much easier to customize if a command needs a different version, but if you're using one like a subroutine for multiple commands you can't just call them from anywhere unless you precompile.

Copying an inline function action directly means any changes you makes in one won't propagate to the other, plus depending on the complexity they'll quickly take up space in your profile database and/or exported profiles.

Precompiling leaves you with another file to manage, and requires you to manage the source code somehow for later reference and modification; For the latter I just use a voice-disabled command that holds all my source code for a given profile, but this is cumbersome if you use an inline function across multiple profiles(at which point it's arguably more convenient to integrate it into an plugin).


Currently the editor for inline functions is pretty basic feature-wise(compared to an IDE like Visual Studio); It does not have autocompletion(let alone "intellisense"), the syntax highlighting is limited, it doesn't highlight matching brackets, and you cannot customize it.

One of the most noticeable things(to me) it lacks: Automatic indentation. Having to hit tab multiple times each time you add a line is inconvenient(I also prefer tabs over the 4 spaces the editor uses, but there's no setting for that).

For a plugin you can use an IDE which offers all of those features and more.

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: Plugin vs. Inline Function
« Reply #2 on: March 13, 2018, 07:48:36 AM »
Thanks Pfeil, that was a great read.

I've seen more talk about plugins on the forum recently and this is a good reference. So far I've preferred inline functions (typically first developed in an IDE then transferred to VA), but it is interesting to see other perspectives.