Author Topic: Checking pressing  (Read 27662 times)

0 Members and 10 Guests are viewing this topic.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Checking pressing
« Reply #45 on: February 01, 2015, 05:50:09 PM »
Anything in curly brackets that is not recognized or has no value will be left unchanged so you can check if a variable is null like this:

I am an idiot.  As Nime5ter points out.  This will always be true!  :bonk :bonk :bonk

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.7-->
<command id="1243" name="check if variable is null" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)==(B)</ifType>
    <ifParams>{Var.test}&amp;&amp;{Var.test}</ifParams>
    <then>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <params>
          <param>the test variable is null</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
</command>
« Last Edit: February 01, 2015, 05:57:45 PM by jitterjames »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Checking pressing
« Reply #46 on: February 01, 2015, 06:03:07 PM »
user variables of the form {var.??} will actually be blank (as in "") when they are not initialized so here is the test command that actually works!

Run it once and it will say it is null, but will assign it a value.  Run it again and it will show the value.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.6-->
<command id="1243" name="check if variable is null" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)==(B)</ifType>
    <ifParams>{Var.test}&amp;&amp;</ifParams>
    <then>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <params>
          <param>the test variable is null.  Setting it to "OK"</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Results.SetVar</cmdType>
        <params>
          <param>test</param>
          <param>OK</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <params>
          <param>the test variable is: {Var.test}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
</command>

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Checking pressing
« Reply #47 on: February 04, 2015, 04:11:50 PM »
Ну примерно вот так, я думаю.
I think, something like this:

Phobophile's example was a good start. Here is a command group that is based on his example.

I'm sorry that I used English in the commands, but better than bad Russian. ;)

If you don't understand it, let me know. Then I can try to explain.

Again, this will only work if you use voice commands only. If you also use the buttons F and LeftShift F on your keyboard, then VoxCommando will no longer know what mode you are in and the math will be incorrect.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.7-->
<commandGroup open="True" name="Flight Sim with DXInput" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="108" name="Flight Mode" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)==(B)</ifType>
      <ifParams>{var.eventSet}&amp;&amp;True</ifParams>
      <then>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>Please wait still executing last order.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.StopMacro</cmdType>
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)==(B)</ifType>
      <ifParams>{var.mode}&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>Results.SetVar</cmdType>
          <params>
            <param>mode</param>
            <param>0</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.StopMacro</cmdType>
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)==(B)</ifType>
      <ifParams>{var.mode}&amp;&amp;{1}</ifParams>
      <then>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>Maintaining current flap position.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.StopMacro</cmdType>
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)&lt;(B)</ifType>
      <ifParams>{var.mode}&amp;&amp;{1}</ifParams>
      <then>
        <action>
          <cmdType>PY.ExecString</cmdType>
          <params>
            <param>result = abs({1} - {var.mode})</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>Opening flaps for {LastResult} seconds</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>Opening flaps for {LastResult} seconds</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>DxInput.KeyDown</cmdType>
          <params>
            <param>F</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.SetEventTimer</cmdType>
          <params>
            <param>{LastResult}s</param>
            <param>releaseKey</param>
            <param>F</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Results.SetVar</cmdType>
          <params>
            <param>eventSet</param>
            <param>True</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Results.SetVar</cmdType>
          <params>
            <param>mode</param>
            <param>{1}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>PY.ExecString</cmdType>
          <params>
            <param>result = abs({var.mode} - {1})</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>Retracting flaps for {LastResult} seconds</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>Retracting flaps for {LastResult} seconds</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>DxInput.KeyDown</cmdType>
          <params>
            <param>leftshift</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>DxInput.KeyDown</cmdType>
          <params>
            <param>F</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.SetEventTimer</cmdType>
          <params>
            <param>{LastResult}s</param>
            <param>releaseKey</param>
            <param>F</param>
            <param>leftshift</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Results.SetVar</cmdType>
          <params>
            <param>eventSet</param>
            <param>True</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Results.SetVar</cmdType>
          <params>
            <param>mode</param>
            <param>{1}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <phrase>enter, switch to, choose, release, retract, begin</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\flightsim.xml</payloadFromXML>
    <event>vc.loaded</event>
  </command>
  <command id="206" name="release key" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>DxInput.KeyUp</cmdType>
      <params>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>DxInput.KeyUp</cmdType>
      <params>
        <param>{2}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>eventSet</param>
        <param>False</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>Okay</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>releaseKey</event>
  </command>
</commandGroup>

Yandex says:
Phobophile пример был хороший старт. Вот команда, группа, которая основана на его примере.

Я сожалею, что я использовал английский язык в команды, но лучше, чем плохой русский. ;)

Если вы этого не понимаете, дайте мне знать. Тогда я могу попробовать объяснить.

Опять же, это будет работать только если вы используете только на голосовые команды. Если Вы также использовать кнопки F и LeftShift F на клавиатуре, затем VoxCommando больше не знаю, в каком режиме вы находитесь и математический расчет будет неверным.
« Last Edit: February 04, 2015, 04:48:25 PM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

NooBAsTiK

  • Jr. Member
  • **
  • Posts: 33
  • Karma: 0
    • View Profile
    • SquaD Skulls
Re: Checking pressing
« Reply #48 on: February 08, 2015, 02:09:48 PM »
Thank you so much. I find it hard to understand how it works :) I tried this code. A release (F) works well, but does not want to clean up ...

NooBAsTiK

  • Jr. Member
  • **
  • Posts: 33
  • Karma: 0
    • View Profile
    • SquaD Skulls
Re: Checking pressing
« Reply #49 on: February 08, 2015, 02:10:47 PM »
Makes an instant press

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Checking pressing
« Reply #50 on: February 08, 2015, 02:24:00 PM »
Hi,

I don't understand exactly what you are saying.

Can you please "Enable Log" in "Options"? http://voxcommando.com/mediawiki/index.php?title=Log

Then use the commands in order to demonstrate the problem.

Then add the file "voxLog.txt" here, so that we can try to understand what is happening?

---
Yandex says:

Привет,

Я не понимаю именно то, что вы говорите.

Можете вы, пожалуйста, "включить Лог" (Enable Log) в "параметры" (Options)? http://voxcommando.com/mediawiki/index.php?title=Log

Затем с помощью команды, чтобы продемонстрировать проблему.

Затем добавить файл "voxLog.txt" здесь, так что мы можем попытаться понять, что происходит?
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Checking pressing
« Reply #51 on: February 08, 2015, 03:14:09 PM »
I see.

DxInput.KeyDown does not appear to be working in the way I expected.

I don't know if this is my misunderstanding or not. It will take me some time to investigate.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Checking pressing
« Reply #52 on: February 08, 2015, 03:59:48 PM »
We have now tested "DxInput.KeyDown" and "DxInput.KeyUp" with a video game. Both are working correctly.

"DxInput.KeyDown" emulates pressing the button down until "DxInput.KeyUp" occurs.

   

 У нас сейчас тестируется "DxInput.KeyDown" и "DxInput.KeyUp" с видео игры. Оба работают правильно.

"DxInput.KeyDown" эмулирует нажатие кнопки "вниз" до тех пор, пока "DxInput.KeyUp" происходит.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Checking pressing
« Reply #53 on: February 08, 2015, 04:16:48 PM »
We tested with "Dragon Age Inquisition" on Win7 and it seems to work fine.  We tested with a command to press W down (using DxInput.KeyDown W) to start walking, and another command using DxInput.KeyUp W  to stop walking.

It worked as expected.

There are no keyboard combinations in Dragon Age so we were not able to test holding down shift and a letter.

NooBAsTiK

  • Jr. Member
  • **
  • Posts: 33
  • Karma: 0
    • View Profile
    • SquaD Skulls
Re: Checking pressing
« Reply #54 on: February 08, 2015, 05:05:23 PM »
I do not know ....
the lshift+f does not work.

NooBAsTiK

  • Jr. Member
  • **
  • Posts: 33
  • Karma: 0
    • View Profile
    • SquaD Skulls
Re: Checking pressing
« Reply #55 on: February 08, 2015, 05:11:50 PM »
vox says what will be done time passes, said confirmation but nothing happens

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Checking pressing
« Reply #56 on: February 08, 2015, 05:23:54 PM »
Hi,

I don't understand exactly what you are saying.

Can you please "Enable Log" in "Options"? http://voxcommando.com/mediawiki/index.php?title=Log

Then use the commands in order to demonstrate the problem.

Then add the file "voxLog.txt" here, so that we can try to understand what is happening?

---
Yandex says:

Привет,

Я не понимаю именно то, что вы говорите.

Можете вы, пожалуйста, "включить Лог" (Enable Log) в "параметры" (Options)? http://voxcommando.com/mediawiki/index.php?title=Log

Затем с помощью команды, чтобы продемонстрировать проблему.

Затем добавить файл "voxLog.txt" здесь, так что мы можем попытаться понять, что происходит?
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

NooBAsTiK

  • Jr. Member
  • **
  • Posts: 33
  • Karma: 0
    • View Profile
    • SquaD Skulls
Re: Checking pressing
« Reply #57 on: February 09, 2015, 02:08:03 AM »
How do I get home, I will do

NooBAsTiK

  • Jr. Member
  • **
  • Posts: 33
  • Karma: 0
    • View Profile
    • SquaD Skulls
Re: Checking pressing
« Reply #58 on: February 09, 2015, 02:17:48 PM »
here it is

NooBAsTiK

  • Jr. Member
  • **
  • Posts: 33
  • Karma: 0
    • View Profile
    • SquaD Skulls
Re: Checking pressing
« Reply #59 on: February 09, 2015, 03:00:33 PM »
I think I understand what the Problem

Code: [Select]
09.02.2015 21:14:31 991 action result: KeyDown emulated
09.02.2015 21:14:31 991 action repeat set to: 1
09.02.2015 21:14:31 991 Action:  VC.SetEventTimer - 17s&&releaseKey&&F&&LeftShift
09.02.2015 21:14:31 991 [action] VC.SetEventTimer:17s&&releaseKey&&F&&LeftShift

If you press F + Left Shift does not work
If you press Left Shift + F, then this works