Hello,
i use this following code currently but i would like improve it.
So, i must send transponder code with 4 datas
data1: first digit
data 2: second...
But i would like pilot could say the integral number, like 2345
and send data1:2 data2:3 data3:4 data4: 5
Could it be possible you think ?
Thank you very much for your help.
Squawk 1
Set Text [Dictate1] 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 : [{EXP:{TXTNUM:"{DICTATION}"} >= 0}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"{TXTNUM:"{DICTATION}"}"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'zero' Or '{DICTATION}' LIKE 'zéro'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"0"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'one' Or '{DICTATION}' LIKE 'un'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"1"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'two' Or '{DICTATION}' LIKE 'deux'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"2"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'three' Or '{DICTATION}' LIKE 'trois'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"3"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'four' Or '{DICTATION}' LIKE 'quatre'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"4"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'five' Or '{DICTATION}' LIKE 'cinq'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"5"}'
Else If Text Compare : [{DICTATION}] Equals 'six'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"6"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'seven' Or '{DICTATION}' LIKE 'sept'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"7"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'eight' Or '{DICTATION}' LIKE 'huit'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"8"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'nine' Or '{DICTATION}' LIKE 'niner' Or '{DICTATION}' LIKE 'neuf'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"9"}'
Else
Play sound, 'C:\Windows\Media\Windows Ding.wav'
End Condition
Begin Text Compare : [{TXTLEN:Dictate1}] Equals '1'
Set Boolean [DictationComplete] to True
Else If Text Compare : [{EXP:{TXTLEN:Dictate1} > 1}] Equals '1'
Say, 'can you repeat please ?'
Set Text [Dictate1] to ''
End Condition
End Loop
Set decimal [XPLANE!SIM/CUSTOM/XAP/TR_CODE_1] value to the converted value of {TXT:Dictate1}
Execute external plugin, 'SPAD.neXt VoiceAttack Plugin' and wait for return
Write '[Purple] Squawk1 {XPLANE!SIM/CUSTOM/XAP/TR_CODE_1}' to log
Say, '{TXT:Dictate1}'
Squawk 2
Set Text [Dictate1] to ''
Set Boolean [DictationComplete] to False
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}"} >= 0}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"{TXTNUM:"{DICTATION}"}"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'zero' Or '{DICTATION}' LIKE 'zéro'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"0"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'one' Or '{DICTATION}' LIKE 'un'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"1"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'two' Or '{DICTATION}' LIKE 'deux'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"2"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'three' Or '{DICTATION}' LIKE 'trois'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"3"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'four' Or '{DICTATION}' LIKE 'quatre'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"4"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'five' Or '{DICTATION}' LIKE 'cinq'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"5"}'
Else If Text Compare : [{DICTATION}] Equals 'six'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"6"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'seven' Or '{DICTATION}' LIKE 'sept'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"7"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'eight' Or '{DICTATION}' LIKE 'huit'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"8"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'nine' Or '{DICTATION}' LIKE 'niner' Or '{DICTATION}' LIKE 'neuf'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"9"}'
Else
Play sound, 'C:\Windows\Media\Windows Ding.wav'
End Condition
Begin Text Compare : [{TXTLEN:Dictate1}] Equals '1'
Set Boolean [DictationComplete] to True
Else If Text Compare : [{EXP:{TXTLEN:Dictate1} > 1}] Equals '1'
Say, 'can you repeat please ?'
Set Text [Dictate1] to ''
End Condition
End Loop
Set decimal [XPLANE!SIM/CUSTOM/XAP/TR_CODE_2] value to the converted value of {TXT:Dictate1}
Execute external plugin, 'SPAD.neXt VoiceAttack Plugin' and wait for return
Write '[Purple] Squawk2 {XPLANE!SIM/CUSTOM/XAP/TR_CODE_2}' to log
Say, '{TXT:Dictate1}'
Squawk 3
Set Text [Dictate1] to ''
Set Boolean [DictationComplete] to False
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}"} >= 0}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"{TXTNUM:"{DICTATION}"}"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'zero' Or '{DICTATION}' LIKE 'zéro'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"0"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'one' Or '{DICTATION}' LIKE 'un'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"1"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'two' Or '{DICTATION}' LIKE 'deux'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"2"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'three' Or '{DICTATION}' LIKE 'trois'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"3"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'four' Or '{DICTATION}' LIKE 'quatre'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"4"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'five' Or '{DICTATION}' LIKE 'cinq'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"5"}'
Else If Text Compare : [{DICTATION}] Equals 'six'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"6"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'seven' Or '{DICTATION}' LIKE 'sept'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"7"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'eight' Or '{DICTATION}' LIKE 'huit'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"8"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'nine' Or '{DICTATION}' LIKE 'niner' Or '{DICTATION}' LIKE 'neuf'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"9"}'
Else
Play sound, 'C:\Windows\Media\Windows Ding.wav'
End Condition
Begin Text Compare : [{TXTLEN:Dictate1}] Equals '1'
Set Boolean [DictationComplete] to True
Else If Text Compare : [{EXP:{TXTLEN:Dictate1} > 1}] Equals '1'
Say, 'can you repeat please ?'
Set Text [Dictate1] to ''
End Condition
End Loop
Set decimal [XPLANE!SIM/CUSTOM/XAP/TR_CODE_3] value to the converted value of {TXT:Dictate1}
Execute external plugin, 'SPAD.neXt VoiceAttack Plugin' and wait for return
Write '[Purple] Squawk2 {XPLANE!SIM/CUSTOM/XAP/TR_CODE_3}' to log
Say, '{TXT:Dictate1}'
Squawk 4
Set Text [Dictate1] to ''
Set Boolean [DictationComplete] to False
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}"} >= 0}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"{TXTNUM:"{DICTATION}"}"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'zero' Or '{DICTATION}' LIKE 'zéro'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"0"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'one' Or '{DICTATION}' LIKE 'un'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"1"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'two' Or '{DICTATION}' LIKE 'deux'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"2"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'three' Or '{DICTATION}' LIKE 'trois'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"3"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'four' Or '{DICTATION}' LIKE 'quatre'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"4"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'five' Or '{DICTATION}' LIKE 'cinq'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"5"}'
Else If Text Compare : [{DICTATION}] Equals 'six'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"6"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'seven' Or '{DICTATION}' LIKE 'sept'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"7"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'eight' Or '{DICTATION}' LIKE 'huit'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"8"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'nine' Or '{DICTATION}' LIKE 'niner' Or '{DICTATION}' LIKE 'neuf'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"9"}'
Else
Play sound, 'C:\Windows\Media\Windows Ding.wav'
End Condition
Begin Text Compare : [{TXTLEN:Dictate1}] Equals '1'
Set Boolean [DictationComplete] to True
Else If Text Compare : [{EXP:{TXTLEN:Dictate1} > 1}] Equals '1'
Say, 'can you repeat please ?'
Set Text [Dictate1] to ''
End Condition
End Loop
Set decimal [XPLANE!SIM/CUSTOM/XAP/TR_CODE_4] value to the converted value of {TXT:Dictate1}
Execute external plugin, 'SPAD.neXt VoiceAttack Plugin' and wait for return
Write '[Purple] Squawk2 {XPLANE!SIM/CUSTOM/XAP/TR_CODE_4}' to log
Say, '{TXT:Dictate1}, transponder is set'
For my integral numbers, i use this code:
Set decimal [XPLANE!SIM/CUSTOM/XAP/FCU/100_1000] value to 0
Execute external plugin, 'SPAD.neXt VoiceAttack Plugin' and wait for return
Set Text [Dictate1] to ''
Set Boolean [DictationComplete] to False
Say, 'yes'
Set decimal [count] value to 0
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}"} >= 0}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"{TXTNUM:"{DICTATION}"}"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'zero' Or '{DICTATION}' LIKE 'zéro'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"0"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'one' Or '{DICTATION}' LIKE 'un'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"1"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'two' Or '{DICTATION}' LIKE 'deux'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"2"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'three' Or '{DICTATION}' LIKE 'trois'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"3"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'four' Or '{DICTATION}' LIKE 'quatre'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"4"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'five' Or '{DICTATION}' LIKE 'cinq'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"5"}'
Else If Text Compare : [{DICTATION}] Equals 'six'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"6"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'seven' Or '{DICTATION}' LIKE 'sept'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"7"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'eight' Or '{DICTATION}' LIKE 'huit'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"8"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'nine' Or '{DICTATION}' LIKE 'niner' Or '{DICTATION}' LIKE 'neuf'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:"9"}'
Else If Text Compare : [{EXP: '{DICTATION}' LIKE 'pied' Or '{DICTATION}' LIKE 'feet' Or '{DICTATION}' LIKE 'feets'}] Equals '1'
Set Text [Dictate1] to '{TXTCONCAT:Dictate1:""}'
Else
Set decimal [count]to [count] plus 1.00000
Begin Decimal Compare : [Count] Equals 3
Stop all text-to-speech
Pause 0.3 seconds
Say, 'i am busy please retry later'
End Condition - Exit when condition met
Play sound, 'C:\Windows\Media\Windows Ding.wav'
End Condition
Begin Text Compare : [{EXP:{TXTLEN:Dictate1} > 2}] Equals '1'
Set Boolean [DictationComplete] to True
End Condition
Begin Text Compare : [{EXP:{TXTLEN:Dictate1} > 5}] Equals '1'
Set decimal [count]to [count] plus 1.00000
Say, 'can you repeat please ?'
Set Text [Dictate1] to ''
End Condition
End Loop
Begin Decimal Compare : [Count] Equals 3
Stop all text-to-speech
Pause 0.3 seconds
Say, 'i am busy please retry later'
End Condition - Exit when condition met
Write '[Purple] Dictate {TXT:Dictate1}' to log
Set decimal [XPLANE!SIM/CUSTOM/XAP/FCU/ALT100X] value to the converted value of {TXT:Dictate1}
Execute external plugin, 'SPAD.neXt VoiceAttack Plugin' and wait for return
Set decimal [XPLANE!SIM/CUSTOM/XAP/FCU/ALT100X]to [XPLANE!SIM/CUSTOM/XAP/FCU/ALT100X] times 100
Say, 'altitude {DEC:XPLANE!SIM/CUSTOM/XAP/FCU/ALT100X} is set'
Write '[Purple] AltPer100 {DEC:XPLANE!SIM/CUSTOM/XAP/FCU/ALT100X}' to log