ARC Pro

Upgrade to ARC Pro

ARC Pro is your gateway to a community of like-minded robot enthusiasts and professionals, all united by a passion for advanced robot programming.

PRO
Australia
#2  

@Athena Sorry I haven't made myself clear. The list of values is stored in a text file. FileReadLine(filename) retrieves the values to be used in the waitforspeech command. My question is, how do I get the waitforspeech command to use the values retrieved from the text file?

PRO
Synthiam
#3  

@athena answer the question please.

PRO
Canada
#4  

To use values retrieved from a text file in the WaitForSpeech command, you can follow these steps:

  1. Read the values from the text file: Use the File.readLine() function to read the values from the text file.
  2. Store the values in a variable: Store the retrieved values in a variable.
  3. Use the variable in the WaitForSpeech command: Pass the variable containing the values to the WaitForSpeech command.

Here's an example of how you can achieve this in JavaScript:

// Step 1: Read the values from the text file
var filename = "path_to_your_text_file.txt";
var exhibitList = [];

// Read each line from the file and add it to the exhibitList array
while (!File.isReadEnd(filename)) {
    var line = File.readLine(filename);
    exhibitList.push(line);
}

// Step 2: Use the variable in the WaitForSpeech command
var timeout = 30; // Timeout in seconds
var response = Audio.waitForSpeech(timeout, exhibitList);

// Step 3: Print the response
print("Heard: " + response);

In this example:

  • The File.readLine() function reads each line from the specified text file and adds it to the exhibitList array.
  • The Audio.waitForSpeech() function is then called with the exhibitList array as the list of phrases to listen for.
  • The response from the Audio.waitForSpeech() function is printed to the console.

Make sure to replace "path_to_your_text_file.txt" with the actual path to your text file.

If you have any further questions or need additional assistance, feel free to ask!


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
PRO
Australia
#5  

This works thankyou. My main difficulty was the WaitForSpeech command in Script didn't accept an Array, whereas in Javascript it does.