Author Topic: How to add for example the value of 2 numbers I say  (Read 1352 times)

Septimanien

  • Newbie
  • *
  • Posts: 5
How to add for example the value of 2 numbers I say
« on: September 07, 2020, 08:44:52 AM »
Hi guys , newbie here . Question in the title :how to add the value of 2 numbers I say ?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: How to add for example the value of 2 numbers I say
« Reply #1 on: September 07, 2020, 08:48:05 AM »
Can you narrow that down? How are you speaking the numbers (E.G. as a single command phrase, using wildcards, using the "Wait For Spoken Response" action, ..)?

What are you trying to do with the result after the addition?

Septimanien

  • Newbie
  • *
  • Posts: 5
Re: How to add for example the value of 2 numbers I say
« Reply #2 on: September 07, 2020, 03:01:12 PM »
Ok, actually it's for the Wolfpack game, a submarine game, and we have to do some calculations. For example, to find the distance of a ship, I have to give 2 factors: a mast height and the measurement of the graduation I get on my periscope. Example: 3 centiradians (the measurement on my periscope) and 30 meters the actual mast height of the boat. Will give in calculation 30*100/3*4= 4000 meters. I would like to be able to say "3 centiradians for 30 meters !" and voiceattack answers me: 4000 meters !
I have for the moment nearly 300 completed orders, but only orders of the type "move mouse at x,x, left click, key press .... Now for the passage of numbers in value I'm lost ........


Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: How to add for example the value of 2 numbers I say
« Reply #3 on: September 07, 2020, 03:11:10 PM »
What does you command look like, currently? How do you intend to speak those numbers?

Have you read the documentation (press F1 while VoiceAttack has focus to open VoiceAttackHelp.pdf in your default PDF viewer)?

Septimanien

  • Newbie
  • *
  • Posts: 5
Re: How to add for example the value of 2 numbers I say
« Reply #4 on: September 07, 2020, 03:30:49 PM »
I use google translate to talk to you, it lets you presume my level in English .... I'm lost in the pdf .... I just want to understand the command: I say to my microphone "2+2" and voiceattack write 4 .

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: How to add for example the value of 2 numbers I say
« Reply #5 on: September 07, 2020, 05:23:59 PM »
The simplest way would likely be to have both numbers as part of your command phrase as numeric ranges, so you can then use the "{CMDSEGMENT:}" token to extract them from the spoken phrase.

You can then use the "{EXP:}" token to do the calculation, and output the result to the log directly using the "Write a Value to the Event Log" action.

E.G.
calculate [0..10] centiradians [1..30] meters
Code: [Select]
Write [Blue] '{EXP: {CMDSEGMENT:3 } * 100 / {CMDSEGMENT:1} * 4}' to log

However, note that predefined numbers in command phrases are problematic, as they can easily generate a large amount of phrase variations (300 in the example command phrase given), which will slow down the initial loading of your profile, or take up so much memory the application will crash; Don't use larger numbers than strictly necessary.

Septimanien

  • Newbie
  • *
  • Posts: 5
Re: How to add for example the value of 2 numbers I say
« Reply #6 on: September 08, 2020, 07:15:28 AM »
Thank you so much Pfeil ! Now I have work to do !
Yes I had to deal with my "go to cap" [0..360] I think maybe it's better to do for this example 2 commands, because the mast height stays the same for a while. So make a first command "mast height [0..50] and save value to profile . And then I can say 4 centiradians and the program gives me a distance, then later say 3 centiradians and it gives me the distance again... Until I give another mast height. But then I understand the system..... Thank you again for your precious indications! I consult a lot the https://voiceattack.com/changes.aspx which gives a lot more options but it's not easy for me ....