Author Topic: Elite Dangerous - Exploring distance using suffix and prefix  (Read 1515 times)

Incurable-Rash

  • Jr. Member
  • **
  • Posts: 52
Elite Dangerous - Exploring distance using suffix and prefix
« on: November 06, 2017, 12:07:14 pm »
I have create travel distance commands for exploring, from 5000 ls to 500,000 ls.\
The command are simple timed pause commands before slowing within 1500 ls.
This has made my vap over 700 commands.
Is there a way to reduce this?
Maybe using suffix and prefixes or something else.
Don't know enough about programing VA to do is myself.
This is what I currently use.

Execute command, 'Set Speed To 0% - Keybinding' (and wait until it completes)
Say, 'Setting speed for 23,000 light seconds. This trip will take about 4 minutes.'  (and wait until it completes)
Execute command, 'Set Speed To 100% - Keybinding' (and wait until it completes)
Pause 264 seconds
Say, 'We are almost at our destination, Reducing speed'
Execute command, 'Set Speed To 75% - Keybinding' (and wait until it completes)

Tkael

  • Jr. Member
  • **
  • Posts: 54
Re: Elite Dangerous - Exploring distance using suffix and prefix
« Reply #1 on: December 02, 2017, 01:22:53 am »
Have you been collecting data? VoiceAttack can capture a variable number and input it into a formula, so with enough data we may be able to create a formula to predict when to automatically revise speeds.
(Ref. https://voiceattack.com/VoiceAttackHelp.pdf, particularly the section on command tokens like {CMDSEGMENT:segment})

Incurable-Rash

  • Jr. Member
  • **
  • Posts: 52
Re: Elite Dangerous - Exploring distance using suffix and prefix
« Reply #2 on: December 28, 2017, 11:47:42 am »
I have 195 commands from 1000 ls to 400,000 ls. I have timed the travel times for all these. So i'm guessing that is the data you were referring to.
I only have very basic skills for writing these things so I somewhat understand the concept, compiling the command is another thing.
The variable I am not clear on is how to account for the various ship speeds and acceleration in super cruise.

Above is the level of understanding for doing this.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1544
  • RTFM
Re: Elite Dangerous - Exploring distance using suffix and prefix
« Reply #3 on: December 28, 2017, 02:13:58 pm »
The way I see it there are two different aspects to this: The amount of command phrases sent to the speech engine, and the amount of commands in your profile.
The latter can be reduced to a single command, if that's easier to maintain for you. The former cannot be reduced without relying on freeform dictation to get the number, which is much less accurate.

What Tkael is proposing is to replace a static list of many different distance/time combinations with a formula that calculates the required time for any given distance on-the-fly instead.
That would mean you can have a single command that does all the work, without having to rely on a long conditional tree to set the pause time.


A basic conditional tree-based command could be something like
Travel [1..400,1000] light seconds
Code: [Select]
Execute command, 'Set Speed To 0% - Keybinding' (and wait until it completes)
Begin Text Compare : [{CMDSEGMENT:1}] Equals '1000'
    Set decimal [~travelTime] value to 2,00000
    Set Text [~travelTimeText] to '2 seconds'
Else If Text Compare : [{CMDSEGMENT:1}] Equals '23000'
    Set decimal [~travelTime] value to 264.00000
    Set Text [~travelTimeText] to '4 minutes'
Else If Text Compare : [{CMDSEGMENT:1}] Equals '400000'
    Set decimal [~travelTime] value to 20000,00000
    Set Text [~travelTimeText] to '5 hours and 30 minutes'
End Condition
Say, 'Setting speed for {CMDSEGMENT:1} light seconds. This trip will take about {TXT:~travelTimeText}.'  (and wait until it completes)
Execute command, 'Set Speed To 100% - Keybinding' (and wait until it completes)
Pause a variable number of seconds [~travelTime]
Say, 'We are almost at our destination, Reducing speed'
Execute command, 'Set Speed To 75% - Keybinding' (and wait until it completes)
Where you'd add an "Else If" block for each distance.

Especially if you can work out a formula, you'd also want to dynamically speak the time; An inline function would probably work best for that(converting the seconds to a TimeSpan and determining whether hours, minutes, or seconds is the correct suffix by checking whether the former two are 0 could work).

EDIT: An inline function that will accomplish the above:
Code: [Select]
using System;

public class VAInline
{
    public void main()
    {
        TimeSpan travelTime = TimeSpan.FromSeconds(Convert.ToDouble(VA.GetDecimal("~travelTime")));
        if (travelTime.Hours != 0)
        {
            VA.SetText("~travelTimeText", String.Format("{0:%h} hours and {0:%m} minutes", travelTime));
        }
        else if (travelTime.Minutes != 0)
        {
            VA.SetText("~travelTimeText", String.Format("{0:%m} minutes", travelTime));
        }
        else
        {
            VA.SetText("~travelTimeText", String.Format("{0:%s} seconds", travelTime));
        }
    }
}

So the command would instead be something like
Code: [Select]
Execute command, 'Set Speed To 0% - Keybinding' (and wait until it completes)
Begin Text Compare : [{CMDSEGMENT:1}] Equals '1000'
    Set decimal [~travelTime] value to 2,00000
Else If Text Compare : [{CMDSEGMENT:1}] Equals '23000'
    Set decimal [~travelTime] value to 264.00000
Else If Text Compare : [{CMDSEGMENT:1}] Equals '400000'
    Set decimal [~travelTime] value to 20000,00000
End Condition
Inline C# Function: Seconds to human time, wait until execution finishes
Say, 'Setting speed for {CMDSEGMENT:1} light seconds. This trip will take about {TXT:~travelTimeText}.'  (and wait until it completes)
Execute command, 'Set Speed To 100% - Keybinding' (and wait until it completes)
Pause a variable number of seconds [~travelTime]
Say, 'We are almost at our destination, Reducing speed'
Execute command, 'Set Speed To 75% - Keybinding' (and wait until it completes)
« Last Edit: December 28, 2017, 03:32:26 pm by Pfeil »

Incurable-Rash

  • Jr. Member
  • **
  • Posts: 52
Re: Elite Dangerous - Exploring distance using suffix and prefix
« Reply #4 on: December 30, 2017, 10:33:07 pm »
Thank you for the reply,
I will try to make sense of what you have told me, but with my limited skills it will take me sometime.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1544
  • RTFM
Re: Elite Dangerous - Exploring distance using suffix and prefix
« Reply #5 on: December 31, 2017, 04:57:43 am »
I've built and exported the command for you, so you can have a look at the actions and how they're configured; It's attached below.

It uses the "Execute by name (Advanced)" option of the "Execute Another Command" action, as I don't have your "Set Speed To X% - Keybinding" commands(and when not by name, the internal ID would not match even if I created dummy versions of them).
You can change these to "Execute selected command", if you prefer.


If you're in a region that uses "," as the thousands separator, you may encounter this issue.

Incurable-Rash

  • Jr. Member
  • **
  • Posts: 52
Re: Elite Dangerous - Exploring distance using suffix and prefix
« Reply #6 on: January 05, 2018, 12:21:17 pm »
I will look it over.

Thank you that was very gracious of you to do this

Incurable-Rash

  • Jr. Member
  • **
  • Posts: 52
Re: Elite Dangerous - Exploring distance using suffix and prefix
« Reply #7 on: January 08, 2018, 10:39:16 am »
Once again thanks to pfeil and Tkael for their help with this profile.

I was wondering is that a way to have a formula accessed, by VA,  to determine the travel time between planets.
I know that some where in the middle of the travel the ship starts to slow down, and I am sure that FD has some sort of way to get the game to do this if I collect enough data maybe I can get the constant used for that different distances traveled and great a formula that VA can use to calculate the overall travel time