Asked — Edited
Resolved Resolved by Rich!

Filereadlinerandom?

When I try to use FileReadLineRandom(c:\users\dylan_000\documents\robotrreetings.txt) As a command it gives me the wrong syntax error. Whats wrong?


ARC Pro

Upgrade to ARC Pro

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

United Kingdom
#1  

How do you plan on using the returned data? That line alone would be useless since it is not assigning it to anything or comparing it to anything.

To be able to use it the command would need to be part of a process, i.e.

IF(FileReadLineRandom("c:\users\dylan_000\documents\robotrreetings.txt") = "spoons")
  Print("Spoons")
EndIf

Or as a variable to call upon

$line = FileReadLineRandom("c:\users\dylan_000\documents\robotrreetings.txt")

It looks like you are trying to have a list or greetings for your robot, the script would be something like;

$greeting = FileReadLineRandom("c:\greetings.txt")
SayWait ($greeting)

or

SayWait(FileReadLineRandom("c:\greetings.txt"))

Bear in mind all;) are really closed brackets

#2  

Thanks, the third one is what I was doing. I'll test it soon.

PRO
Synthiam
#3  

Look in the examples folder and preview the file example:)

#4  

It seems to work, don't have my speech recognition settings set up yet so the computer doesn't speak back, but it does complete the script with no errors. Thanks Rich

PRO
Synthiam
#5  

@Technopro keep in mind that there are syntax examples in the manual as well. When you find a command, such as FileReadRandom(), there is an example of the syntax in the description of the manual. And also, there are many many project examples of how to use each function included in ARC:)

#6  

@Technopro ... I have my speech recognition setup and working... Rich's above samples I have tried work perfectly...