Release EDDI - Windows app for immersion and more

Status
Thread Closed: Not open for further replies.
Jgm,

BumbleB's question, "how to get VA to say how far the destination is", does point the one 'last thing' that the speech responder can't do... push variables back to VA.

How about a 'getstate' plugin function for VA to pull single variables from the state object?
 
Actually its not say I want, I want the distance variable to I can write a txt file of the distance to use in OBS to display on my overlay.

Code:
Set Text [BEE Destination] to [destination] (save value to profile)
Set decimal [BEE Distance] value to the value of [distance] (round to 0 decimal places) (save value to profile)

Write (overwrite), '{TXT:BEE Destination} - {DEC:BEE Distance} LY' to file '\Destination System.txt'
 
Actually its not say I want, I want the distance variable to I can write a txt file of the distance to use in OBS to display on my overlay.

Code:
Set Text [BEE Destination] to [destination] (save value to profile)
Set decimal [BEE Distance] value to the value of [distance] (round to 0 decimal places) (save value to profile)

Write (overwrite), '{TXT:BEE Destination} - {DEC:BEE Distance} LY' to file '\Destination System.txt'

Ok, I understand.

Short of the 'getstate' plugin function I suggested to jgm, there's presently no way to get variables out of speech responder cottle scripts to VA.
 
Jgm,

BumbleB's question, "how to get VA to say how far the destination is", does point the one 'last thing' that the speech responder can't do... push variables back to VA.

How about a 'getstate' plugin function for VA to pull single variables from the state object?

State variables should be available automatically in VoiceAttack, with the prefix 'EDDI state'. So if you did a setstate of a text variable with name 'foo' you could use that value in VoiceAttack with {TXT:EDDI state foo}
 
Ok, I whipped this up real quick and did some rudimentary testing.

I threw this into the speech responder 'Jumped' script for testing, but it could also go into the 'Jumping' (or any other) script...

Code:
{if state.destination:
    {set dest to SystemDetails(state.destination)}

    {set diff_x to sub(dest.x, system.x)}
    {set diff_y to sub(dest.y, system.y)}
    {set diff_z to sub(dest.z, system.z)}

    {set pow_x to pow(diff_x, 2)}
    {set pow_y to pow(diff_y, 2)}
    {set pow_z to pow(diff_z, 2)}

    {set distance to add(pow_x, pow_y)}
    {set distance to add(distance, pow_z)}
    {set distance to pow(distance, 0.5)}
    {set distance to round(distance, 1)}

    Distance to {state.destination} is {distance} light years.
}

It's written for readability over efficiency, so feel free to obfuscate to your heart's content!

With regards to Voice Attack, here are some examples for setting and clearing the 'destination' variable...

VA Command called 'Set destination'. Currently set to Sol...
Code:
Set Text [destination] to 'Sol'
Set Text [State variable] to 'destination'
Execute external plugin, 'EDDI 2.1.0-b3' and wait for return (context = setstate, Text Variables = State variable)


VA Command called 'Clear destination'. Sets 'destination' to 'Not Set'
Code:
Set Text [destination] to [Not Set]
Set Text [State variable] to 'destination'
Execute external plugin, 'EDDI 2.1.0-b3' and wait for return (context = setstate, Text Variables = State variable)


Standard disclaimer... Guaranteed until you can no longer see my tail lights, YMMV.


State variables should be available automatically in Voice Attack, with the prefix 'EDDI state'. So if you did a setstate of a text variable with name 'foo' you could use that value in Voice Attack with {TXT:EDDI state foo}

So with Hoodathunk's above script, in VA I could just call the {distance} value in VA with {DEC:EDDI state distance} ?
Not at comp at the moment but brain won't stop processing the final piece of what I've been working on for the last 2 months.

Also last night I just started a 3 point exploration trip (The Great Annihilator, Sag A* then Colonia) I noticed that after awhile the {DEC:System distance from home} variable stopped reporting. Is there some kind of limit on how many times I can call it ? server limit or something?

I'm wanting to get the distance to update after every jump in the ((EDDI jumped)) event.I have no idea if it connects to a server to get it values. Like I said before I'm totally new to this scripting and mumbling along best I can.
 
So with Hoodathunk's above script, in VA I could just call the {distance} value in VA with {DEC:EDDI state distance} ?

There needs to be another line in the speech responder script at the end to store the distance in state:

Code:
{SetState('distance', distance)}

and then it should be available in VoiceAttack.

Also last night I just started a 3 point exploration trip (The Great Annihilator, Sag A* then Colonia) I noticed that after awhile the {DEC:System distance from home} variable stopped reporting. Is there some kind of limit on how many times I can call it ? server limit or something?

The data to calculate distance from home is in the local data, but there were some situations where it might not update. I've tweaked the code to ensure that it updates as often as possible, and this will make it in to the next release.
 
State variables should be available automatically in VoiceAttack, with the prefix 'EDDI state'. So if you did a setstate of a text variable with name 'foo' you could use that value in VoiceAttack with {TXT:EDDI state foo}

Wow! Awesome! The circle is now complete! [up]

I looked again at the speech responder help.md and voiceattack.md files and saw no reference to this feature. You may want to add a short blurb to minimize further confusion.

Happy New Year and continued thanks for all your hard work!
 
Last edited:
State variables should be available automatically in VoiceAttack, with the prefix 'EDDI state'. So if you did a setstate of a text variable with name 'foo' you could use that value in VoiceAttack with {TXT:EDDI state foo}

I'm trying to pass a variable to VA of the docking granted station type.

In the speechresponder docking granted script I have the line:

{set station to StationDetails(event.station)}
{setState('stationtype', (station.model))}

From what you said this variable 'stationtype' should be available to VA as {TXT:EDDI state stationtype}.

This variable is showing as not set in VA. What am I missing?

*****Edit****

I got it to work! The working line is:
{SetState("stationtype", station.model)}
 
Last edited:
I've had the opportunity to 'pre-beta test' the 'setstate' functionality and I can attest that it's very powerful.

For example, in anticipation of 2.1.0 b1, I have written VA commands with turn off and on the speech responder...

VA Command 'Data Interface off' :
Execute external plugin 'EDDI 2.1.0-b1' and wait for return (with context = disablespeechresponder)

VA Command 'Data Interface on' :
Execute external plugin 'EDDI 2.1.0-b1' and wait for return (with context = enablespeechresponder)

Additionally, I've created a Boolean 'state object' variable called 'verbose', which controls how chatty the speech responder scripts can be...

VA Command 'Data Interface brief' :
Set Boolean [verbose] to False
Set Text [State Variable] to 'verbose'
Execute external plugin 'EDDI 2.1.0-b1' and wait for return (with context = setstate & Text Variables = State Variable)

VA Command 'Data Interface verbose' :
Set Boolean [verbose] to True
Set Text [State Variable] to 'verbose'
Execute external plugin 'EDDI 2.1.0-b1' and wait for return (with context = setstate & Text Variables = State Variable)

For example, using 'verbose', I can do this with the 'Galnet news published' script...

Code:
{if state.verbose:
    {set regexfilter to "^(?!(.*Weekly|Report.*)|(.*Powerplay|Update.*)|(.*Starport|Update.*)).*$"}
    {if len(event.items) = 1:
        A new Galnet article has been published, entitled {event.items[0].title}.
        {if match(event.items[item].title, regexfilter):
            it reads 
            {Pause(1000)}
            {event.items[0].content}.
        }
    |elif len(event.items) > 1:
        {len(event.items)} new Galnet articles have been published.  
        {set item to 0}
        {while item < len(event.items):
            {if item = 0:
                The first is entitled {event.items[item].title}, 
                {if match(event.items[item].title, regexfilter):
                    and reads 
                    {Pause(1000)}
                    {event.items[item].content}.
                }
            |elif item = 1:
                The second is entitled {event.items[item].title}, 
                {if match(event.items[item].title, regexfilter):
                    and reads 
                    {Pause(1000)}
                    {event.items[item].content}.
                }
            |elif item = len(event.items) - 1:
                The last is entitled {event.items[item].title}, 
                {if not(match(event.items[item].title, regexfilter)):
                    and reads 
                    {Pause(1000)}
                    {event.items[item].content}.
                }
            |else:
                The next is entitled {event.items[item].title},
                {if not(match(event.items[item].title, regexfilter)):
                    and reads 
                    {Pause(1000)}
                    {event.items[item].content}
                }
            }
            {set item to item + 1}
            {Pause(1000)}
        }.
    }
|else:
    {if len(event.items) = 1:
        A new Galnet article has been published, entitled {event.items[0].title}.
    |elif len(event.items) > 1:
        {len(event.items)} new Galnet articles have been published.  Their titles are
        {set item to 0}
        {while item < len(event.items):
            {if item = len(event.items) - 1:
                and {event.items[item].title}
            |else:
                {event.items[item].title},
            }
            {set item to item + 1}
        }.
    }
}


Another example, I can now repeat the landing pad location after 'docking granted'...

VA Command 'Pad location' :
Set integer [landingpad] value to the value of [EDDI docking granted landingpad]
Set Text [station] to [EDDI docking granted station]
Set Text [State Variable] to 'landingpad'
Execute external plugin 'EDDI 2.1.0-b1' and wait for return (with context = setstate & Text Variables = State Variable)
Set Text [State Variable] to 'station'
Execute external plugin 'EDDI 2.1.0-b1' and wait for return (with context = setstate & Text Variables = State Variable)
Set Text [Script] to 'Pad location'
Execute external plugin 'EDDI 2.1.0-b1' and wait for return (with context = speech & Text Variables = Script)


Speech Responder script called 'Pad location'

Code:
{set station to StationDetails(state.station)}
{if station.model = "Coriolis Starport" || station.model = "Orbis Starport" || station.model = "Ocellus Starport" || station.model = "Unknown Starport":
    {Pause(500)}
    Landing pad {state.landingpad} is at
    {if state.landingpad = 1:
        six o'clock near
    |elif state.landingpad = 2:
        six o'clock near
    |elif state.landingpad = 3:
        six o'clock far
    |elif state.landingpad = 4:
        six o'clock far
    |elif state.landingpad = 5:
        seven o'clock near
    |elif state.landingpad = 6:
        seven o'clock near
    |elif state.landingpad = 7:
        seven o'clock
    |elif state.landingpad = 8:
        seven o'clock far
    |elif state.landingpad = 9:
        eight o'clock near
    |elif state.landingpad = 10:
        eight o'clock far
    |elif state.landingpad = 11:
        nine o'clock near
    |elif state.landingpad = 12:
        nine o'clock near
    |elif state.landingpad = 13:
        nine o'clock
    |elif state.landingpad = 14:
        nine o'clock far
    |elif state.landingpad = 15:
        nine o'clock far
    |elif state.landingpad = 16:
        ten o'clock near
    |elif state.landingpad = 17:
        ten o'clock near
    |elif state.landingpad = 18:
        ten o'clock far
    |elif state.landingpad = 19:
        ten o'clock far
    |elif state.landingpad = 20:
        eleven o'clock near
    |elif state.landingpad = 21:
        eleven o'clock near
    |elif state.landingpad = 22:
        eleven o'clock
    |elif state.landingpad = 23:
        eleven o'clock far
    |elif state.landingpad = 24:
        twelve o'clock near
    |elif state.landingpad = 25:
        twelve o'clock far
    |elif state.landingpad = 26:
        one o'clock near
    |elif state.landingpad = 27:
        one o'clock near
    |elif state.landingpad = 28:
        one o'clock
    |elif state.landingpad = 29:
        one o'clock far
    |elif state.landingpad = 30:
        one o'clock far
    |elif state.landingpad = 31:
        two o'clock near
    |elif state.landingpad = 32:
        two o'clock near
    |elif state.landingpad = 33:
        two o'clock far
    |elif state.landingpad = 34:
        two o'clock far
    |elif state.landingpad = 35:
        three o'clock near
    |elif state.landingpad = 36:
        three o'clock near
    |elif state.landingpad = 37:
        three o'clock
    |elif state.landingpad = 38:
        three o'clock near
    |elif state.landingpad = 39:
        four o'clock near
    |elif state.landingpad = 40:
        four o'clock far
    |elif state.landingpad = 41:
        five o'clock near
    |elif state.landingpad = 42:
        five o'clock near
    |elif state.landingpad = 43:
        five o'clock
    |elif state.landingpad = 44:
        five o'clock far
    |elif state.landingpad = 45:
        five o'clock far
    }
    , as you enter with the green lights on your right.
}


This should give you a little taste as to the power of State objects. I hope you find this useful.

H/T to Cmdr Tkael for his excellent Galnet reader script.

@Hoodathunk / @JGM I've been unable to replicate the "verbose" script described above. Can you assist with debugging?

For example, my VA Command 'Data Interface brief' is written:
Code:
Set Boolean [verbose] to False
Set Text [State Variable] to 'verbose'
Execute external plugin, 'EDDI 2.1.0-b3' and wait for return (with context = setstate & Text Variables = State Variable)

Set Text [Script] to 'EDDI will now give only brief summary reports'
Execute external plugin, 'EDDI 2.1.0-b3' and wait for return (with context = say & Text Variables = Script)
Write '[Blue] Verbose EDDI: {BOOL:EDDI state verbose}' to log

{BOOL:EDDI state verbose} evaluates as "Not set" and state.verbose is not set for future scripts. What could I be doing wrong?
 
Code:
Set Boolean [verbose] to False
Set Text [State Variable] to 'verbose'
Execute external plugin, 'EDDI 2.1.0-b3' and wait for return (with context = setstate & Text Variables = State Variable)

Set Text [Script] to 'EDDI will now give only brief summary reports'
Execute external plugin, 'EDDI 2.1.0-b3' and wait for return (with context = say & Text Variables = Script)
Write '[Blue] Verbose EDDI: {BOOL:EDDI state verbose}' to log

{BOOL:EDDI state verbose} evaluates as "Not set" and state.verbose is not set for future scripts. What could I be doing wrong?

The state isn't interpreted until the next command, although thinking about it that's not a great way of doing things so I'll update EDDI to mirror the state variable in EDDI state as part of setstate.

How are you testing state.verbose in future scripts? It should be something like:

Code:
{if state.verbose:
  I'm verbose
}
 
The state isn't interpreted until the next command, although thinking about it that's not a great way of doing things so I'll update EDDI to mirror the state variable in EDDI state as part of setstate.

How are you testing state.verbose in future scripts? It should be something like:

Code:
{if state.verbose:
  I'm verbose
}

jgm beat me to it.

After seeing Tkael's post this morning, I wrote a quick 'verbose' script in speech responder (similar to jgm's code snippet) and called it from VA when I change the variable state and came to the same conclusion. the 'verbose' variable is changing just fine within speech repsonder state object, but not being updated for {BOOL:EDDI state verbose}.

jgm, thanks for your quick response.
 
Last edited:
Actually its not say I want, I want the distance variable to I can write a txt file of the distance to use in OBS to display on my overlay.

Following this , would like the 'Variable' , to be spoken ( no overlay I run in fullscreen mode ) , or the 'txt file' to be captured viewed on a Tablet.

just a thought for those helping in coding this.. :)
 
Last edited:
I was testing in EDDI, though it looks like my testing methodology was flawed. When I created a VA command and tested in VA rather than in EDDI, I got the correct output.
 
Last edited:
The state isn't interpreted until the next command, although thinking about it that's not a great way of doing things so I'll update EDDI to mirror the state variable in EDDI state as part of setstate.

How are you testing state.verbose in future scripts? It should be something like:

Code:
{if state.verbose:
  I'm verbose
}

Great. I believe that should also help with a related issue I noticed tonight. :)

I re-wrote my Docking granted event to set states and indicate the landing pad number with a separate command (to allow that second command to be independently called if I want a pad location reminder).
Code:
{set station to StationDetails(event.station)}
{SetState("stationtype", station.model)}
{SetState("landingpad", event.landingpad)}

{Pause(8000)}

{F("Pad location")}

{F("Station Report")}
The Docking granted event does not have the state variables correctly set when it is triggered, but if I later call my sub-command to repeat the landing pad (Pad location) then it contains the correct values.
 
Great. I believe that should also help with a related issue I noticed tonight. :)

I re-wrote my Docking granted event to set states and indicate the landing pad number with a separate command (to allow that second command to be independently called if I want a pad location reminder).
Code:
{set station to StationDetails(event.station)}
{SetState("stationtype", station.model)}
{SetState("landingpad", event.landingpad)}

{Pause(8000)}

{F("Pad location")}

{F("Station Report")}
The Docking granted event does not have the state variables correctly set when it is triggered, but if I later call my sub-command to repeat the landing pad (Pad location) then it contains the correct values.

I'm unsure what the issue here is. Please could you provide a template that shows the issue?
 
Just a bit off topic here. I didn't see SetState in the cottle documentation. I haven't read all 1176 posts here so I may have missed something. Is this a way to set variables? The Cottle documentation refers to the set directive. There's nowhere in there about SetState.
 
Just a bit off topic here. I didn't see SetState in the cottle documentation. I haven't read all 1176 posts here so I may have missed something. Is this a way to set variables? The Cottle documentation refers to the set directive. There's nowhere in there about SetState.

SetState is not part of cottle, it is a separate function because variables set with cottle are removed after the script finished. When you edit a script and click on help you will find the SetState under EDDI Functions. Also it is a new function and only in the beta version available so you have to wait a bit or test the beta.
 
SetState is not part of cottle, it is a separate function because variables set with cottle are removed after the script finished. When you edit a script and click on help you will find the SetState under EDDI Functions. Also it is a new function and only in the beta version available so you have to wait a bit or test the beta.

I see no SetState function when I click on Help when editing a script. I see a StateDetails() which has to do with the state of the system (War Boom Famine etc). Maybe my version is out of date. I'm using 2.0.13.
 
Status
Thread Closed: Not open for further replies.
Back
Top Bottom