Author Topic: Need a plugin built... stuck at step one  (Read 3692 times)

lyfesaver

  • Newbie
  • *
  • Posts: 6
Need a plugin built... stuck at step one
« on: June 29, 2021, 09:55:37 AM »
I need a plugin built and as I don't write code my plan is to hit up Fiverr but I need to know what kind of developer to find.

Any insight as to what skills to look for would be appreciated. Doing a search for VoiceAttack there brought up nothing, lol.

The other side of the plugin is for a bot for Twitch streamers, written in C#, that has all the options detailed in this post:

https://forum.voiceattack.com/smf/index.php?topic=3867.0

I am thankful for the feedback but I never replied because I dont understand and felt asking the person to wizen up this old dummy was not the best way forward, lol :D

Here is the flow:

Once creates actions in the bot that have a full flow of doing things in OBS, PC, games, etc...  I need a plugin that will get a list of available actions from bot (getActions already exists for HTTP and websocket servers) and offers a way to assign a command to an action in VA.

Again, any help pointing me in the right direction would be awesome, thx.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Need a plugin built... stuck at step one
« Reply #1 on: June 29, 2021, 10:38:54 AM »
The plugin structure itself should not be all that complicated for a programmer versed in C#, though previous experience with VoiceAttack would obviously help.

However, a plugin cannot create commands or execute actions directly, so at least part of the functionality would need to come from preexisting VoiceAttack commands, which would require a fair understanding of VoiceAttack's more advanced features.


If you have control over this "bot" you're referring to, and you either set or can see the names of the "actions" you would be requesting it to execute, the simplest setup likely be to forego getting a list programmatically, and passing the name of the relevant action using the "Execute an External Plugin Function" action's "Plugin Context" field to your "bot" instead.
I.E. you would create a VoiceAttack command triggered by your method(s) of choice (E.G. spoken phrases, keyboard keys, etc...), which then contains an "Execute an External Plugin Function" action with it's "Plugin Context" field containing the name of the "bot action" you want the command to initiate.

This would be a more manual process, as you'd need to create a command for each action, but the plugin would likely only need to pass the name of the "bot action" to the actual "bot", rather than dealing with VoiceAttack-specific configuration.


That said, if all you need is to send a UDP packet containing a single command, without any feedback from the target application, that could potentially be done using a fairly basic inline function, E.G.
Code: [Select]
using System;
using System.Text;
using System.Net.Sockets;

public class VAInline
{
public void main()
{
UdpClient client = new UdpClient();
try
{
client.Connect("localhost", 1234);

Byte[] messageBytes = Encoding.ASCII.GetBytes("my command");
client.Send(messageBytes, messageBytes.Length);

client.Close();
}
catch (Exception e)
{
VA.WriteToLog("UDP sender exception: " + e);
}
}
}
assuming the "bot" doesn't require any handshaking, etc... which should be outlined in its documentation

lyfesaver

  • Newbie
  • *
  • Posts: 6
Re: Need a plugin built... stuck at step one
« Reply #2 on: June 29, 2021, 11:42:15 AM »
First off, you is AWESOME for the detailed reply. I am friends with the developer of the bot and if you would like access to tinker with while in alpha (pre 0.9) then I can hook it up. The mostly completed wiki can be accessed via the github: https://github.com/nate1280/ChannelPointsHandler/wiki/Version-0.50

That being said, I will get with my friend and see what is what. I just know that I would rather throw $$$ at someone and have them make it happen rather than ask another for item to be put on his already overwhelming todo list :D

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Need a plugin built... stuck at step one
« Reply #3 on: June 29, 2021, 12:16:42 PM »
The UDP listener is not properly documented, but there is an example of the format here that may work.

Try
Code: [Select]
using System;
using System.Text;
using System.Net.Sockets;

public class VAInline
{
public void main()
{
string actionID = "";
string actionName = "my action";


UdpClient client = new UdpClient();
try
{
client.Connect("localhost", 1234);

Byte[] messageBytes = Encoding.ASCII.GetBytes("{\"request\":\"DoAction\",\"action\":{\"id\":\"" + actionID + "\",\"name\": \"" + actionName + "\",},\"args\":{\"value\": \"value\",}}");
client.Send(messageBytes, messageBytes.Length);

client.Close();
}
catch (Exception e)
{
VA.WriteToLog("UDP sender exception: " + e);
}
}
}
presumably that would attempt to execute the "bot action" named "my action".
Given that the ID is stated to be optional, I'm assuming you only need to enter the name of the action, leaving the value of "id" blank.


If that works, you could use
Code: [Select]
using System;
using System.Text;
using System.Net.Sockets;

public class VAInline
{
public void main()
{
string actionID = VA.GetText("~actionID") ?? "";
string actionName = VA.GetText("~actionName") ?? "";


UdpClient client = new UdpClient();
try
{
client.Connect("localhost", 1234);

Byte[] messageBytes = Encoding.ASCII.GetBytes("{\"request\":\"DoAction\",\"action\":{\"id\":\"" + actionID + "\",\"name\": \"" + actionName + "\",},\"args\":{\"value\": \"value\",}}");
client.Send(messageBytes, messageBytes.Length);

client.Close();
}
catch (Exception e)
{
VA.WriteToLog("UDP sender exception: " + e);
}
}
}
to get the values from VoiceAttack variables instead, if you prefer.

lyfesaver

  • Newbie
  • *
  • Posts: 6
Re: Need a plugin built... stuck at step one
« Reply #4 on: June 29, 2021, 12:31:43 PM »
Looking at my current UDP examples I am just putting some random number in the field:
Port: 6669
Payload: {
  "command": "speak",
  "id": "1234",
  "voice": "ModVoice",
  "message": "%user% says %rawInput%"
}

In that example it allows the TTS app that he also wrote and is getting merged into bot to allow my mods to whisper TTS to me without the stream hearing it and I just added the 1234 myself

lyfesaver

  • Newbie
  • *
  • Posts: 6
Re: Need a plugin built... stuck at step one
« Reply #5 on: June 29, 2021, 01:39:01 PM »
Using your examples he wrote a quick DLL that just runs a variable to action name via UDP

https://cdn.discordapp.com/attachments/554327494883409930/859512217002049536/unknown.png

I have source and would share so u could peek but not sure of the rules for this forum and dont want to be in anyone's craplist :D

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Need a plugin built... stuck at step one
« Reply #6 on: June 29, 2021, 01:51:46 PM »
If you want to post the source code that's fine.

lyfesaver

  • Newbie
  • *
  • Posts: 6
Re: Need a plugin built... stuck at step one
« Reply #7 on: June 29, 2021, 02:07:24 PM »
Thanks!