Author Topic: Commands on a toggle  (Read 561 times)

Solanx

  • Newbie
  • *
  • Posts: 2
Commands on a toggle
« on: May 07, 2024, 04:50:46 PM »
I'm playing X4 and the in-game hotkey for turrets is set to toggle on/off. I'm trying to get Voice attack to speak one tts response for arming and one for disarming but using the dynamic response format in the pdf seems to be a random variable of the 2 responses when I want it to play response 1 the 1st time the command is executed and the 2nd response the 2nd time.

Code: [Select]
Turrets activated;Turrets deactivated


Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Commands on a toggle
« Reply #1 on: May 08, 2024, 12:53:16 AM »
That can be accomplished using a (Boolean) variable and a condition, E.G.
Code: [Select]
Begin Boolean Compare : [>turretsActivated] Equals False
    Say, 'Turrets activated'
Else
    Say, 'Turrets deactivated'
End Condition
Set Boolean [>turretsActivated] to Toggle

Make sure the condition and the "Set a True/False (Boolean) Value" action have the "Evaluate 'Not Set' as false" option checked.

Solanx

  • Newbie
  • *
  • Posts: 2
Re: Commands on a toggle
« Reply #2 on: May 08, 2024, 04:09:37 PM »
That can be accomplished using a (Boolean) variable and a condition

Awesome. It took me a few minutes but I finally figured out how to enter this. Works perfectly. Thank you.

Here's my current command incase any other x4 users want to add it. If it is out of sequence you just need to manually cycle the turrets until they are synced.
Code: [Select]
Press Left Shift+\ | keys and hold for 0.05 seconds and release
Begin Boolean Compare : [turretsActivated] Equals False
    Play sound, 'internal:Thomb'
    Pause 0.5 seconds
    Say, 'Turrets activated'
Else
    Play sound, 'internal:Servo'
    Pause 0.5 seconds
    Say, '<?xml version="1.0" encoding="ISO-8859-1"?> <speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US"> Turrets<prosody pitch="+6st">Dee</prosody>activated </speak>'
End Condition
Set Boolean [turretsActivated] to Toggle

« Last Edit: May 08, 2024, 06:35:57 PM by Solanx »