Author Topic: Many bugs with my commands with recognition  (Read 4485 times)

Sloboda

  • Jr. Member
  • **
  • Posts: 74
  • VoiceCommander Creator
    • A.M.I.S. X Plane
Many bugs with my commands with recognition
« on: March 14, 2017, 12:54:25 PM »
Hello Pfeil,

i'm sorry but i have bugs always on the sames commands types. When i have bug, it's always when i use recognition like "set altitude to", "set transponder to"...
Could you help me to improve please ?

When we will correct this "little" problem, it will be really perfect.

Actually, i can ensure it's impossible to make full flight without crash VA.

How can i help you ? What can i give to you ?

Many thanks,
best regards.

I attach a profile but it's on all the profiles. And i attach my VoiceAttackFault

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4761
  • RTFM
Re: Many bugs with my commands with recognition
« Reply #1 on: March 14, 2017, 02:15:12 PM »
It's still the same crash, related to the DirectInput(joystick) library used by VoiceAttack.

If your joystick drivers are up to date(if you're using any that don't come with Windows), it must be a conflict somewhere else.

The error log refers to a window handle being invalid when VoiceAttack is attempting to set the cooperative level for a certain DirectInput(joystick, gamepad, etc..) device. What this means exactly is for Gary to find out.
Though, if it has something to do with a window handle going missing, apparently you can just use NULL.
I don't know if Gary was able to have a look at that.


When VoiceAttack crashes, do any of your joysticks/input devices stop working?


Also, have you tried removing "VAJS.dll" from VoiceAttack's main directory? That should at least make it impossible for any joystick-related issues to cause VoiceAttack to crash.
« Last Edit: March 15, 2017, 01:43:15 PM by Pfeil »

Sloboda

  • Jr. Member
  • **
  • Posts: 74
  • VoiceCommander Creator
    • A.M.I.S. X Plane
Re: Many bugs with my commands with recognition
« Reply #2 on: March 15, 2017, 12:53:45 AM »
Hello Pfeil,

i confess i have not all understand but,

VAJS.dll is removed since you say me,
and I have not specific driver install for my joystick.

sorry but i don't know Gary ?

What do you mean about i can just use null ??? It's mostly this sentence i don't understand, i'm sorry.

I think about something and i will try to explain correctly:

With VA, wa can send 2 types of messages to spadnext.

First is, i send a dataref, example:

setvalue  > XPLANE!sim/flightmodel/controls/parkbrake > 1 (so, the parkbrakes are on, if you send 0, the parkbrakes)

Second is, i send a command, we can think it's same thing but no. In a command, the decimal have not any importance... Example:


setvalue  > XPLANE!sim/flightmodel/controls/parkbrake_toggle > 1(or 2 or 0 or anything...) We enter any decimal, just because it's needed in the VA decimal set, but only the link is sent to x-plane.

in this type, this command is exactly what is used by xplane for joysticks buttons. So, perhaps something, like VA, or spadnext, think there's a joystick action ???

Whar do you think about ?

Thank you very much Pfeil, you're very friendly.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4761
  • RTFM
Re: Many bugs with my commands with recognition
« Reply #3 on: March 15, 2017, 01:46:39 PM »
Sorry about the confusion(and the broken quote tags, apparently "date" is a required field for "link" to work).

The thing about using NULL is for Gary(The creator/programmer/evil genius of VoiceAttack), it's something that could potentially be changed within VoiceAttack itself.

Just keep us updated on whether VoiceAttack still crashes now that you've removed VAJS.dll.

Sloboda

  • Jr. Member
  • **
  • Posts: 74
  • VoiceCommander Creator
    • A.M.I.S. X Plane
Re: Many bugs with my commands with recognition
« Reply #4 on: March 15, 2017, 11:39:20 PM »
Hello Pfeil,

sure, the bug don't come from the VAJS.dll, i have remove this dll since you said me "a long time ago".
I'm on a good way i think, to understand what append (Sure not like you but like a user only).

I have add a text-to-speech "Yes ?" before the dictation to know whan i can start to dictate. I have less bugs now. And i have remove a part of your code: "Enter and cancel" commands.
Like this, the code is more quickly, and it better understand my dictation at the start of loop i think.

Set Text [Squawk1] to ''
Set Boolean [DictationComplete] to False
Say, 'yes'
Start Loop While : [DictationComplete] Equals False
    Start Dictation Mode (Clearing Dictation Buffer)
    Start Loop While : [{DICTATION}] Equals ''
    End Loop
    Stop Dictation Mode
    Begin Text Compare : [{DICTATION}] Equals 'zéro'
        Set Text [Squawk1] to '{TXTCONCAT:Squawk1:"0"}'
    Else If Text Compare : [{DICTATION}] Equals 'un'
        Set Text [Squawk1] to '{TXTCONCAT:Squawk1:"1"}'
    Else If Text Compare : [{DICTATION}] Equals 'deux'
        Set Text [Squawk1] to '{TXTCONCAT:Squawk1:"2"}'
    Else If Text Compare : [{DICTATION}] Equals 'trois'
        Set Text [Squawk1] to '{TXTCONCAT:Squawk1:"3"}'
    Else If Text Compare : [{DICTATION}] Equals 'quatre'
        Set Text [Squawk1] to '{TXTCONCAT:Squawk1:"4"}'
    Else If Text Compare : [{DICTATION}] Equals 'cinq'
        Set Text [Squawk1] to '{TXTCONCAT:Squawk1:"5"}'
    Else If Text Compare : [{DICTATION}] Equals 'six'
        Set Text [Squawk1] to '{TXTCONCAT:Squawk1:"6"}'
    Else If Text Compare : [{DICTATION}] Equals 'sept'
        Set Text [Squawk1] to '{TXTCONCAT:Squawk1:"7"}'
    Else
        Play sound, 'C:\Windows\Media\Windows Ding.wav'
    End Condition
    Begin Text Compare : [{TXTLEN:Squawk1}] Equals '4'
        Set Boolean [DictationComplete] to True
    End Condition
End Loop
Set decimal [XPLANE!sim/cockpit/radios/transponder_code] value to the converted value of {TXT:Squawk1}
Execute external plugin, 'SPAD.neXt VoiceAttack Plugin - v0.9.5+' and wait for return
Say, 'squawk is {TXT:Squawk1}'
Write '[Purple] Squawk= {DEC:XPLANE!sim/cockpit/radios/transponder_code}' to log


This morning, i'm on a new way:
Why can i not directly dictate my decimals in a text and stop dictation when DECIMAL-LENGH:squawk=4 (for example)

Because i think is slow to compare one to1, two to 2...., and we need to change the text numbers for each language.
But i see in VA log, when i say two or deux(french) it print 2 in log, and when i say "long" numbers like twenty-two or hundred for example, it print directly 22 and 100.

Is it possible you think to directly dictate numbers like that, and send the decimal value when the number lengh is good ?

Thank you very much Pfeil.
Have a good day.
Friendly, Guillaume.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4761
  • RTFM
Re: Many bugs with my commands with recognition
« Reply #5 on: March 16, 2017, 10:39:37 AM »
sure, the bug don't come from the VAJS.dll, i have remove this dll since you said me "a long time ago".
If it's still crashing, please post your latest VoiceAttackFault.txt

i have remove a part of your code: "Enter and cancel" commands.
No need to keep that around if you're not using it, but it won't speed up the command in a humanly perceptible way.

Why can i not directly dictate my decimals in a text and stop dictation when DECIMAL-LENGH:squawk=4 (for example)
You can't concatenate non-string variables. You'd still need an If/Else tree to check the value of the decimal to add another digit:
Code: [Select]
Set decimal [dec] value to 10,00000
Set decimal [DigitToAdd] value to 7,00000
Begin Decimal Compare : [dec] Is Greater Than Or Equals 100,00000
    Set decimal [DigitToAdd] to [DigitToAdd] times 1000,00000
Else If Decimal Compare : [dec] Is Greater Than Or Equals 10,00000
    Set decimal [DigitToAdd] to [DigitToAdd] times 100,00000
Else If Decimal Compare : [dec] Is Greater Than Or Equals 1,00000
    Set decimal [DigitToAdd] to [DigitToAdd] times 10,00000
End Condition
Set decimal [dec] to [dec] plus [DigitToAdd]
Write '[Blue] {DEC:dec}' to log
Except that won't work for "0", so you'd need to add an exception to account for that.

Because i think is slow to compare one to1, two to 2....
Even if you're somehow running this on a commodore 64, a simple string compare still won't be "slow". Even with VoiceAttack's overhead.

But i see in VA log, when i say two or deux(french) it print 2 in log, and when i say "long" numbers like twenty-two or hundred for example, it print directly 22 and 100.
It does? On my machine, the speech engine will treat single digits as words, from zero to nine. Anything above that is rendered as a numeric value instead.

There are two ways around this:

Say "Numeral" before each digit, which instructs the speech engine to output numeric values.
E.G. "two" will output "two", "numeral two" will output "2".


Say multiple digits as a single phrase.
E.G. "One two three" should be recognized as "123".


If you're using the latter, you can do away with the If/Else tree and just check the value of the number:
Code: [Select]
Set Boolean [DictationComplete] to False
Say, 'yes'
Start Loop While : [DictationComplete] Equals False
    Start Dictation Mode (Clearing Dictation Buffer)
    Start Loop While : [{DICTATION}] Equals ''
    End Loop
    Stop Dictation Mode
    Begin Text Compare : [{EXP:{TXTNUM:"{DICTATION}"} >= 1000}] Equals '1'
        Set decimal [XPLANE!sim/cockpit/radios/transponder_code] value to the converted value of {TXTNUM:"{DICTATION}"}
        Set Boolean [DictationComplete] to True
    Else
        Play sound, 'C:\Windows\Media\Windows Ding.wav'
    End Condition
End Loop
Execute external plugin, 'SPAD.neXt VoiceAttack Plugin - v0.9.5+' and wait for return
Say, 'squawk is {DEC:XPLANE!sim/cockpit/radios/transponder_code}'
Write '[Purple] Squawk= {DEC:XPLANE!sim/cockpit/radios/transponder_code}' to log
Checking whether the numeric value of the dictation string has a value of 1000 or higher does two things: Makes sure it's actually a number, and makes sure that number has four digits.

Sloboda

  • Jr. Member
  • **
  • Posts: 74
  • VoiceCommander Creator
    • A.M.I.S. X Plane
Re: Many bugs with my commands with recognition
« Reply #6 on: March 17, 2017, 03:24:38 AM »
Hello Pfeil,
I start a new profile for 737. I will try your differents solutions in it and report result.
Thank you very much.

I will say to you why i thought the code was too slowly.
Because i had see in log, when i don't let enought time between 2 numbers when i speak, in the log i have(for example: i dictate a squawk 2-5-4-3)
2
54
3

it paste 5 and 4 together

so,
i ear the ding, because the compare code don't recognize anything
and after a moment, VA crash.

Here is the reason i thought it was too slowly.
If you want, you can go to see my last video at a moment i dictate decimals and ear how i must say the numbers for VA understand. Perhaps you will can tell me if it's normal or not ?

https://www.youtube.com/watch?v=ydblmJ6eTOY
(Go at 5mn05 for first dictation)

Thank you, bye.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4761
  • RTFM
Re: Many bugs with my commands with recognition
« Reply #7 on: March 17, 2017, 07:04:37 AM »
when i don't let enought time between 2 numbers when i speak, in the log i have(for example: i dictate a squawk 2-5-4-3)
2
54
3
Yeah, that's perfectly normal. It has nothing to do with VoiceAttack itself; The speech engine is waiting for a pause long enough to signify the end of a sentence before it makes a guess at what you've said.


I'm not sure why or when it was taken out, but the original example had a way to handle situations where multiple numbers are spoken at once(using "set altitude to" as an example):
Code: [Select]
    Begin Text Compare : [{EXP:{TXTNUM:"{DICTATION}"} >= 0}] Equals '1'
        Set Text [AltPer100] to '{TXTCONCAT:AltPer100:"{TXTNUM:"{DICTATION}"}"}'
    Else If Text Compare : [{DICTATION}] Equals 'zéro'
        Set Text [AltPer100] to '{TXTCONCAT:AltPer100:"0"}'
This allows for either method; Speaking single digits, or multiple at once.

However, I'd make one additional change:
Code: [Select]
     Begin Text Compare : [{TXTLEN:AltPer100}] Equals '3'
        Set Boolean [DictationComplete] to True
    Else If Text Compare : [{EXP:{TXTLEN:AltPer100} > 3}] Equals '1'
        Play sound, 'C:\Windows\Media\Windows Critical Stop.wav'
        Set Text [AltPer100] to ''
    End Condition
Should a condition arise where more than the maximum amount of characters have been stored, this will clear the variable so you can start over. Without it, the loop would keep going because the length is over three, rather than exactly three.

Sloboda

  • Jr. Member
  • **
  • Posts: 74
  • VoiceCommander Creator
    • A.M.I.S. X Plane
Re: Many bugs with my commands with recognition
« Reply #8 on: March 17, 2017, 11:13:42 AM »
Hello Pfeil,
i'm sorry to be stupid but, when i try to enter your last code in VA, it say me "Variable names may not contain colons".

I don't know yet make good relation since your txt in forum and what i exactly must create in VA. It will come with experience.
Sorry.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4761
  • RTFM
Re: Many bugs with my commands with recognition
« Reply #9 on: March 17, 2017, 02:42:25 PM »
I've attached the edited "set altitude to" command, so you can see where everything goes.

Sloboda

  • Jr. Member
  • **
  • Posts: 74
  • VoiceCommander Creator
    • A.M.I.S. X Plane
Re: Many bugs with my commands with recognition
« Reply #10 on: March 21, 2017, 09:49:30 AM »
Hello Pfeil,

i applause ! Great thanks for your last code; it's really the best ever for my command.

I just need to say 250 now when i want 25000 feet for example.
Top of the top.

Thank you very very much.

Best regards.