A bit ago ravstar52 on Reddit made this post (
https://www.reddit.com/r/EliteDangerous/comments/4wylhv/if_you_have_trouble_finding_coordinates_on/) for a program he developed to input your current coordinates displayed on your HUD when you're near a planet's surface and figure out which heading you should turn to in order to get to a desired known location. Someone else (CCninja86) took that code and made an online version.
My thought as a VoiceAttack user was, why not go the next step, have this voice entered and my ship tell me which way to turn? So I took ravstar52's code, modified it a bit more, and wrote some VA commands to talk to the exe. Was thinking about trying to make it a plugin, but this works very nicely as is. It should work all behind the scenes, no popping up or anything.
So how to get started - first get the executable from below, either download or compile it yourself. Make a new directory in the VoiceAttack directory (you already have VA if you're reading this, right?), naming it "BearingCalc". If you name it something else, you'll have to change the reference within one of the VA commands (calc heading). Put the exe in that directory. Then download the VA command profile at the link below and import it into VA. All the commands are under the category "Bearing", in case you need to look at them or remove them later.
That should be all you need to get started, no guarantees beyond saying it's been tested a number of times against the other two programs for numeric results. You can look at the commands to figure out what to say or to modify them. I set it up with the following commands:
"enter positions" or "set positions" This calls a routine to listen for each coordinate number, your current x and y first, then the target x and y. One requirement, you have to include either "positive" or "plus", "negative" or "minus" before the numbers as appropriate. If it doesn't get a good match to anything, it will prompt you three time before canceling out. For numbers, just use whole integers, don't worry about anything past the decimal point. I didn't try to set that up because I don't think it needs that much precision, plus it would have made entering more of a pain both for the user and the programming.
When a number is understood, VA will read it back to you and ask for confirmation. "Confirm" or "correct" will work as set up. Three tries again before VA cancels out.
If VA misheard you, "redo" starts over for that coordinate.
Also in the coding in the <<prompt>> command I have a variable for "loop", set to 4. This is how many seconds you get between tries, adjust if you want it slower or faster, although too fast might make it miss your input often.
"enter current position" and "enter destination" These two allow you to enter the x/y of each point separately, maybe useful if things change. They don't call the calculation automatically, you'll need to use "calc heading" or "find heading" to do that. I just added these in to give a bit more flexibility in adjusting numbers.
"check heading" Same as above, but uses the previous destination inputted (it will read what it has stored), so you can check on your progress without reentering. If there was none entered, it will default to the above command.
"repeat heading" Just repeats the last calculated heading.
"read positions" or "read coordinates" Just reads what is currently in the position variables, more for testing than anything else.
Link for VoiceAttack commands:
http://www.filedropper.com/bearingcalc_2Link for exe to do the math:
http://www.filedropper.com/bearingcalc_1, based on above linked post
For those cautious about running executables unseen, you can make it yourself same way I did, using this website: Online compiler
http://www.onlinecompiler.net/ and inserting the following code, compiling, and then downloading the generated exe.
Source: Text file:
http://www.filedropper.com/sourcecode#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <math.h> // Allows use of atan2()
using namespace std;
//initilise ALL the things!
char bom;
float xStartingPosition;
float yStartingPosition;
float xEndingPosition;
float yEndingPosition;
float deltaX;
float deltaY;
int Heading;
//functions start here
int BearingCalculator(float xStart, float yStart, float xEnd, float yEnd) {
deltaX = xStart - xEnd; //Calculating the displacement in X
deltaY = yStart - yEnd; //Calculating the displacement in Y
Heading = (atan2 (deltaY, deltaX) * (180/3.14159265)); //Calculating the bare Tan of the triangle
if (Heading <= 0) {
Heading = 360 + Heading;
}
};
int main (int nNumberofArgs, char* pszArgs[])
{
ifstream a_file ( "coordinates.txt" );
if ( !a_file.is_open() ) {
ofstream e_file ( "heading.txt" );
e_file<< "error";
e_file.close();
return(0);
}
else {
a_file.get(bom);
a_file.get(bom);
a_file.get(bom);
a_file>> xStartingPosition;
a_file>> yStartingPosition;
a_file>> xEndingPosition;
a_file>> yEndingPosition;
a_file.close();
}
BearingCalculator(xStartingPosition, yStartingPosition, xEndingPosition, yEndingPosition);
ofstream b_file ( "heading.txt" );
b_file<< Heading;
b_file.close();
return 0;
}