Author Topic: VA, EDDI and voices  (Read 5842 times)

jcdick1

  • Jr. Member
  • **
  • Posts: 59
VA, EDDI and voices
« on: April 06, 2024, 02:02:05 PM »
I have 22 voices available for VA to use for TTS.  In E:D, I'm trying to use a variable set by events in EDDI to assign a unique voice for each NPC that triggers the "message received" event.  This will probably come down to the age old "variable vs token" thing, but I just can't seem to get this to work.

When an NPC talks, an event is triggered, and EDDI sets a few variables. The relevant ones, as copied from their documentation on VA Integration, are:

{TXT:EDDI message received from} - The name of the source who sent the message
{TXT:EDDI message received message} - The message
{INT:EDDI message received seed} - A seed number generated from the sender information. This can be used ... to assign a voice to a message sender.

I'm going to assume that it is not setting a value less than or greater than what VA can handle.

I have a command that is triggered by this event that is intended to set a persistent voice for each NPC I encounter, using the "received seed" value, by assigning a random number between 1 and 22 to a new variable called "{INT:EDDI message received seed}_voice".  And then that would be written to the profile to survive gaming sessions.

I've been trying to troubleshoot by having the various variables involved written to a text file.  Ultimately, that text file should look something like this (completely made up and tabled for easy reading):

Code: [Select]
{TXT:EDDI message received from}    {INT:EDDI message received seed}    {INT:EDDI message received seed}_voice    voice value
Mad Eye Moody                                  2750983148                              2750983148_voice                 17
Al Hamaya Station                              175097372                               175097372_voice                  5
Al Hamaya Station                              175097372                               175097372_voice                  5
Lucy Beaumont                                  189407668                                189407668_voice                 20

With "17" being the "Desktop Dave" voice, 5 being "Ivona Raveena" voice and 20 being "Cepstral Belle" voice.  And then the message would be read using that assigned voice.  I should end up with potentially hundreds of these "{...seed}_voice" variables, each dynamically addressable.

But variables can't have colons in them, and so I can't figure out how to set that "{...seed}_voice" variable, because wouldn't it need the token - {INT:EDDI message received seed} - to have the variable name dynamically recalled?  When I go to do the integer compare - "If {...seed}_voice = 17, read {TXT:message} in 'Dave' voice" - it won't let me use "{INT:EDDI message received seed}_voice" because it has a colon in it.  But simply "{EDDI message received seed}_voice" isn't recalling the appropriate value, either.

Anyone have thoughts?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4780
  • RTFM
Re: VA, EDDI and voices
« Reply #1 on: April 06, 2024, 03:40:35 PM »
What does the actual command look like?

Right-click the action list, choose "Copy All as Text" from the context menu, then paste here into a code block (click the # button)

jcdick1

  • Jr. Member
  • **
  • Posts: 59
Re: VA, EDDI and voices
« Reply #2 on: April 06, 2024, 03:58:20 PM »
Code: [Select]
Append, '\r\n{TXT:EDDI message received from} - {INT:EDDI message received seed}' to file 'C:\Users\XXXX\Documents\message_received.txt'
Set integer [{EDDI message received seed}_voice] value to [Saved Value]
Begin Integer Compare : [{EDDI message received seed}_voice] Equals 0
    Set integer [{EDDI message received seed}_voice] value as random from 1 to 22 (save value to profile)
    Append, ' {EDDI message received seed}_voice - {{EDDI message received seed}_voice}' to file 'C:\Users\XXXX\Documents\message_received.txt'
    Begin Integer Compare : [{{EDDI message received seed}_voice}] Equals 1
        Desktop David voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 2
        Desktop Hazel voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 3
        Desktop Zira voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 4
        Ivona Amy voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 5
        Ivona Brian voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 6
        Ivona Emma voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 7
        Ivona Eric voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 8
        Ivona Geraint voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 9
        Ivona Jennifer voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 10
        Ivona Joey voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 11
        Ivona Kendra voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 12
        Ivona Kimberly voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 13
        Ivona Nicole voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 14
        Ivona Raveena voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 15
        Ivona Russell voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 16
        Ivona Salli voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 17
        Cepstral Belle voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 18
        Cepstral Dallas voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 19
        MS Hayley voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 20
        MS Heather voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 21
        MS Heera voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 22
        MS Helen voice
        Say, '{TXT:EDDI message received message}'
    End Condition
Else
    Begin Integer Compare : [{{EDDI message received seed}_voice}] Equals 1
        Desktop David voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 2
        Desktop Hazel voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 3
        Desktop Zira voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 4
        Ivona Amy voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 5
        Ivona Brian voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 6
        Ivona Emma voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 7
        Ivona Eric voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 8
        Ivona Geraint voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 9
        Ivona Jennifer voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 10
        Ivona Joey voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 11
        Ivona Kendra voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 12
        Ivona Kimberly voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 13
        Ivona Nicole voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 14
        Ivona Raveena voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 15
        Ivona Russell voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 16
        Ivona Salli voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 17
        Cepstral Belle voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 18
        Cepstral Dallas voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 19
        MS Hayley voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 20
        MS Heather voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 21
        MS Heera voice
        Say, '{TXT:EDDI message received message}'
    Else If Integer Compare : [{{EDDI message received seed}_voice}] Equals 22
        MS Helen voice
        Say, '{TXT:EDDI message received message}'
    End Condition
End Condition

The command
Code: [Select]
Begin Integer Compare : [{EDDI message received seed}_voice] Equals 0
is set for "not set is 0", so that if that seed has never been seen before, it sets it.

I've also tried

Code: [Select]
Append, ' {INT:EDDI message received seed}_voice - {{INT:EDDI message received seed}_voice}' to file 'C:\Users\XXXX\Documents\message_received.txt'

and

Code: [Select]
Append, ' {INT:EDDI message received seed}_voice - {INT:{INT:EDDI message received seed}_voice}' to file 'C:\Users\XXXX\Documents\message_received.txt'


As I said, in the "Else If ..." statements, I can't use "{INT:EDDI message received seed}_voice" because it contains a colon.  And I've tried those without the outside braces, as well.

The text file - which I'm only using to confirm the variables are being set - should end up looking like

Code: [Select]
System Authority Vessel - 988932465  988932465_voice 17

But its only registering the first append, missing the last two items, and the same voice is being used for every NPC:

Code: [Select]
System Authority Vessel - 988932465

Edit:  What it comes down to is that I'm trying to assign a value to a dynamic retrievable variable with a name based on another changing variable.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4780
  • RTFM
Re: VA, EDDI and voices
« Reply #3 on: April 07, 2024, 01:07:06 AM »
Code: [Select]
Begin Text Compare : [{INT:{INT:EDDI message received seed}_voice}] Equals '0'Given that you're not actually using the numbers mathematically, that's all that's required, just a straight compare as text, by using the inner token and literal text to form the variable name, then using the outer token to retrieve the value of that variable.

In places where you need the variable name, use
Code: [Select]
{INT:EDDI message received seed}_voiceE.G. the variable name for a "Set an Integer Value" action can be formed that way


And no, putting curly braces around arbitrary text doesn't make it a token. All that'll happen is that the token parser, if applicable to the field, will remove the braces.

jcdick1

  • Jr. Member
  • **
  • Posts: 59
Re: VA, EDDI and voices
« Reply #4 on: April 07, 2024, 12:47:10 PM »
If I do that first bit as a text compare instead of an integer compare as in your first code snippet, the variable option is to "evaluate 'Not Set' as blank," not 0.  So would it still set that value properly?

Would I then need
Code: [Select]
{INT:EDDI message received seed}_voice
for the "Else If ..." compares determining which voice to use, whether or not its an integer or text compare, in order for it to be recalling the proper variable?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4780
  • RTFM
Re: VA, EDDI and voices
« Reply #5 on: April 07, 2024, 12:56:16 PM »
If I do that first bit as a text compare instead of an integer compare as in your first code snippet, the variable option is to "evaluate 'Not Set' as blank," not 0.  So would it still set that value properly?
If you're unsure what value will be returned by a token (or set of tokens), use the "Write a Value to the Event Log" to output it to the log on the main window.

You're not checking a variable value; you're comparing literal text returned by a token (the fact that it's returned by a token is only relevant because in this case it causes the input in the "Variable Name / Token" field to be interpreted as literal text that'll be passed to the token parser, rather than a variable name) to literal text, so in that particular case you'd want to check whether the literal text returned by the token equals the literal text "not set" (compares are case-insensitive).


The Else If actions would work on the same principle: you're comparing literal text returned by a token to literal text, so you need to both build the variable name, and retrieve the value of that variable, I.E. you need both tokens.

Again: if you're not sure what value is being returned, write it to the log and check.

jcdick1

  • Jr. Member
  • **
  • Posts: 59
Re: VA, EDDI and voices
« Reply #6 on: April 07, 2024, 01:25:19 PM »
It isn't so much being unsure about the value being returned as much as it is not being sure the variable is even being created and assigned a value in the first place.

When the event is triggered, EDDI creates those variables mentioned for the sender's name, the sender's seed value and the message itself.  If the sender is "Billy Bob Haskins" and Billy Bob Haskins' seed value is "8327652", I can't tell that the variable named "8327652_voice" is even properly being created, let alone being assigned the random value between 1 and 22 because I can't get VA to tell me it is successfully creating/recalling it.

The value upon which I am basing the voice variable name is provided from EDDI as an INT value, but I can't put "{INT:EDDI message received seed}_voice" to get VA to differentiate Billy Bob Haskins' voice from anyone else's, because as soon as I type that colon in the variable name box, it pops up "variable names cannot contain a colon."

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4780
  • RTFM
Re: VA, EDDI and voices
« Reply #7 on: April 07, 2024, 01:51:27 PM »
I can't tell that the variable named "8327652_voice" is even properly being created, let alone being assigned the random value between 1 and 22 because I can't get VA to tell me it is successfully creating/recalling it.
If
Code: [Select]
Write [Blue] '{INT:{INT:EDDI message received seed}_voice}' to logwrites a number rather than "Not set" to the log, the variable was successfully set.


as soon as I type that colon in the variable name box, it pops up "variable names cannot contain a colon."
Correct, that's why you use the "Variable Name / Token" field, which if a token is part of the input, does not interpret said input as a variable name.

jcdick1

  • Jr. Member
  • **
  • Posts: 59
Re: VA, EDDI and voices
« Reply #8 on: April 07, 2024, 01:59:43 PM »
Quote
Correct, that's why you use the "Variable Name / Token" field, which if a token is part of the input, does not interpret said input as a variable name.

So change it to a text compare, and just leave the value as blank and check the box "Evaluate not set as blank" so that the initial Compare looks like this:

Code: [Select]
Begin Text Compare : [{INT:EDDI message received seed}_voice] Equals ''

And then change all the rest of the "Else if ..." statements to text compares to have it compare the 1 to 22 as characters, not values?

Edit:

Using my previous example values for "Billy Bob Hoskins," would
Code: [Select]
Write [Purple] '{INT:EDDI message received seed}_voice' to log

then write the variable name "8327652_voice" to the log in purple?

jcdick1

  • Jr. Member
  • **
  • Posts: 59
Re: VA, EDDI and voices
« Reply #9 on: April 07, 2024, 03:48:13 PM »
Sitting in-game right now, getting a message I have "exited the no-fire zone" for the station,

Code: [Select]
Write [Blue] '{INT:{INT:EDDI message received seed}_voice}' to log

did not display a value (or even "not set") in the main VA window in blue or any other color.  And no voice at all was used to read the message.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4780
  • RTFM
Re: VA, EDDI and voices
« Reply #10 on: April 08, 2024, 01:10:35 AM »
If there was no log message at all, you have the "Write a Value to the Event Log" action placed in a conditional branch that isn't being executed (E.G. because the statement governing that branch is not evaluating to True), or the command containing it isn't being executed.

Integer values cannot be blank. They either return "Not set", or a numeric value.

jcdick1

  • Jr. Member
  • **
  • Posts: 59
Re: VA, EDDI and voices
« Reply #11 on: April 08, 2024, 08:47:24 AM »
I'm guessing it has something to do with embedding an integer variable name in the assigned voice variable name vs using a text string, because I basically wrote an alternate version using the {EDDI message received sender} variable in the new variable name, so that I get a series of variables named things like "Fort Harrison voice" or "Cruise ship voice" or "Willie Fogg voice" and they seem to be working.  I'll check today to see if the ones set last night are successfully recalled from the profile and remain the same in a second gaming session.
Code: [Select]
7/4 11:26 PM - Allain Breck - Joey
7/4 11:26 PM - Fort Harrison - Eric
7/4 11:27 PM - Fort Harrison - Eric
7/4 11:27 PM - Fort Harrison - Eric
7/4 11:27 PM - Allain Breck - Joey
7/4 11:34 PM - Willie Fogg - Salli
7/4 11:39 PM - Fort Harrison - Eric
7/4 11:42 PM - Mr Bear - Amy
7/4 11:43 PM - Mr Bear - Amy
7/4 11:43 PM - Mr Bear - Amy
7/4 11:43 PM - System Authority Vessel - Heera
7/4 11:43 PM - System Authority Vessel - Heera
7/4 11:44 PM - System Authority Vessel - Heera
7/4 11:47 PM - Albert - Joey
7/4 11:47 PM - Teeka Daneun - Dallas
7/4 11:48 PM - Albert - Joey
7/4 11:48 PM - Teeka Daneun - Dallas

That second value - the assigned voice - is populated by recalling a {TXT:{TXT:EDDI message received from} voice} value, so I think it just doesn't like having an integer embedded in the new variable name.