Author Topic: Who is up for Voice Attack Coding Challenge #1?  (Read 2976 times)

SteveXM

  • Newbie
  • *
  • Posts: 17
Who is up for Voice Attack Coding Challenge #1?
« on: December 23, 2018, 08:56:44 PM »
I am trying make a way to play Subnautica with Rift Motion Controllers .
The only way this will be possible [with all of the controls] , is to use voice commands.
This is only 1 of many voice command ideas I am thinking about right now for this game (...and others), ....but this function is the most complex.  (The rest I can code myself and will) .

Important: With the new Voice Attack commands this game will be much more enjoyable because it will be playable with Oculus Rift Controlers [no tracking].

This is just a lazy way to try and get someonelse to write this code for me.


But seriously that would be nice.
If no nobody solves this in 48 hours I will post the solution...... if I can come up with it l. The solution will be shared around.

<<<<Pseudocode>>>>>
Primary Activation of Slot 1 = "[ Slot 1: Equip 1;Switch 1;use 1; [A]; equip [A]; switch to [A ]:use [A]"
Change Equip Item #1
    Dictate Item Name (save this to A)
    Extract Slot Num (save this to B)
    Replace the secondary activation of Slot # B w/ A
This makes it so I can save the dictated Item Name A and use it to activate the key press for slot #B
[This will make for a more immersive experience]

Ex;.
You can say "Equip fire extinguisher  slot 1"

Now in the future you can say any of these options to activate or switch to the item in slot #1.
   - "Fire Extinguisher"
   - "Equip Fire Extinguisher"
   - "Switch to Fire Extinguisher"
   - "use Fire Extinguisher"



BONUS POINTS: Voice will read back the "Item Name" and "Slot #" for confirmation.

Ex - "Fire Extinguisher, slot 1?"
User - "yes/ no"

If "no" keep previous,  otherwise set A for use with slot #

Any questions and I will respond ASAP.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Who is up for Voice Attack Coding Challenge #1?
« Reply #1 on: December 23, 2018, 09:51:35 PM »
This is just a lazy way to try and get someonelse to write this code for me.

Hilarious... However, thanks to this bug, you may not actually be able to replicate this:


I would list the items that can be assigned to slots instead:
Equip [Fire Extinguisher;First Aid Kit;Flashlight;Scanner] slot[1..5]
Code: [Select]
Say, '{CMDSEGMENT:1}, slot {CMDSEGMENT:3}?'
Wait for spoken response: 'yes;no'
Begin Text Compare : [~responsee] Does Not Equal 'yes'
    Write [Blue] 'Assignment cancelled.' to log
    Say, 'Assignment cancelled.'
End Condition - Exit when condition met
Set Text [>>slot{CMDSEGMENT:3}] to '{CMDSEGMENT:1}' (save value to profile)
Set Text [>>slotItems] to '{TXT:>>slot1};{TXT:>>slot2};{TXT:>>slot3};{TXT:>>slot4};{TXT:>>slot5}'
Write [Blue] 'Slot{CMDSEGMENT:3} mapped to '{CMDSEGMENT:1}'' to log
Say, 'Slot{CMDSEGMENT:3} mapped to '{CMDSEGMENT:1}''  (and wait until it completes)
Reset the active profile

But if you want to use dictation:
Dictate slot[1..5]
Code: [Select]
Say, 'Speak the item for slot {CMDSEGMENT:1}'
Start Dictation Mode (Clearing Dictation Buffer)
Start Loop While : [{DICTATION}] Equals ''
End Loop
Stop Dictation Mode
Say, '{DICTATION}, slot {CMDSEGMENT:1}?'
Wait for spoken response: 'yes;no'
Begin Text Compare : [~responsee] Does Not Equal 'yes'
    Write [Blue] 'Assignment cancelled.' to log
    Say, 'Assignment cancelled.'
End Condition - Exit when condition met
Set Text [>>slot{CMDSEGMENT:1}] to '{DICTATION}' (save value to profile)
Set Text [>>slotItems] to '{TXT:>>slot1};{TXT:>>slot2};{TXT:>>slot3};{TXT:>>slot4};{TXT:>>slot5}'
Write [Blue] 'Slot{CMDSEGMENT:1} mapped to '{TXT:>>slot{CMDSEGMENT:1}}'' to log
Say, 'Slot{CMDSEGMENT:1} mapped to '{TXT:>>slot{CMDSEGMENT:1}}''  (and wait until it completes)
Reset the active profile


[Equip;Switch to;Use;] [{TXT:>>slotItems};Slot 1;Slot 2;Slot 3;Slot 4;Slot 5]
Code: [Select]
Begin Condition : [{CMDSEGMENT:1}] Equals 'Slot 1' OR ([{CMDSEGMENT:1}] Equals [>>slot1] AND [>>slot1] Has Been Set)
    Press 1 key and hold for 0,06 seconds and release
Else If : [{CMDSEGMENT:1}] Equals 'Slot 2' OR ([{CMDSEGMENT:1}] Equals [>>slot2] AND [>>slot2] Has Been Set)
    Press 2 key and hold for 0,06 seconds and release
Else If : [{CMDSEGMENT:1}] Equals 'Slot 3' OR ([{CMDSEGMENT:1}] Equals [>>slot3] AND [>>slot3] Has Been Set)
    Press 3 key and hold for 0,06 seconds and release
Else If : [{CMDSEGMENT:1}] Equals 'Slot 4' OR ([{CMDSEGMENT:1}] Equals [>>slot4] AND [>>slot4] Has Been Set)
    Press 4 key and hold for 0,06 seconds and release
Else If : [{CMDSEGMENT:1}] Equals 'Slot 5' OR ([{CMDSEGMENT:1}] Equals [>>slot5] AND [>>slot5] Has Been Set)
    Press 5 key and hold for 0,06 seconds and release
End Condition
This checks whether the slot has been assigned, as otherwise a lower slot may be matched if a higher slot is spoken, and both are "Not Set".


This command should run when the profile loads, to retrieve the previously set values:
Profile Setup
Code: [Select]
Begin Boolean Compare : [>>profileSetup] Does Not Equal True
    Set Text [>>slot1] to [Saved Value]
    Set Text [>>slot2] to [Saved Value]
    Set Text [>>slot3] to [Saved Value]
    Set Text [>>slot4] to [Saved Value]
    Set Text [>>slot5] to [Saved Value]
    Set Text [>>slotItems] to '{TXT:>>slot1};{TXT:>>slot2};{TXT:>>slot3};{TXT:>>slot4};{TXT:>>slot5}'
    Set Boolean [>>profileSetup] to True
    Reset the active profile
End Condition
This sets a flag, because the profile reset would otherwise cause a loop.



EDIT:


The profile is attached, merry Christmas.
« Last Edit: December 24, 2018, 04:43:02 AM by Pfeil »

SteveXM

  • Newbie
  • *
  • Posts: 17
Re: Who is up for Voice Attack Coding Challenge #1?
« Reply #2 on: December 24, 2018, 07:52:53 AM »
I knew someone would be up for a fun challenge.  Thank you. I'll test this bad boy out today. Merry Christmas!

SteveXM

  • Newbie
  • *
  • Posts: 17
Re: Who is up for Voice Attack Coding Challenge #1?
« Reply #3 on: December 26, 2018, 09:02:27 PM »
Update!
Subnautica/VA Fun
I ran in to a very interesting obstacle :)

[Unless I'm doing something wrong, (probably), this is what I think is happening, in one sentence) ]

When using the "Controller" setting, no keyboard binds can be used for any input......... ???!

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Who is up for Voice Attack Coding Challenge #1?
« Reply #4 on: December 26, 2018, 09:59:18 PM »
When using the "Controller" setting, no keyboard binds can be used for any input......... ???!
Is this a setting in Subnautica?

Some games can switch between keyboard/mouse and controller input on the fly, but for others it's one or the other.

From a quick Google search, it appears controller support was something of an afterthought during Subnautica's development, so it's not surprising it's not well integrated.

SteveXM

  • Newbie
  • *
  • Posts: 17
Re: Who is up for Voice Attack Coding Challenge #1?
« Reply #5 on: January 03, 2019, 07:07:09 PM »
Just to update on this post,

The controller is now working and I can still use keyboard commands as well. Chances are no one else is playing this game with VA and Oculus Touch Controllers, but if you are this might help.

I'm not sure why it wasn't working....or how I got it to work,  but it does. I think one of the issues I was having is the game window was losing focus, when this happens the game seems to loose certain functions.

To solve for this I added a new command to my profile that will re focus the window.  I'm sure I'm not doing this the most efficient way,but it works. Here is what the command looks like.

[Say "Focus Subnautica"]
Send a left mouse click to the "Subnautica" window.