loading
 
Get and use varables of listen module
Anonymous
15 year
I am using the Listen module in roborealm. I created a variable so that it will recognize when the user says "Play Sound" the variable name is tutorial. I want to use that variable in my C++ and check that "Play Sound" is what the user said. So when my API program runs, the user will say "Play Sound" and a .robo program will open to play my tutorial. How do I go about doing this? This is what I tried...

tutorial = getVariable("tutorial", buffer, 64);
If tutorial = "Play Sound"
     rr.open("C:\\Desktop\\tutorial.robo")

Is this the proper way of doing this? And if so, how do I declare tutorial in my C++ program? Do I declare it as a string?
Anonymous 15 year
In C/C++ that would be more like

char buffer[64];
tutorial = rr.getVariable("tutorial", buffer, 64);
if (stricmp(buffer, "Play Sound")==0)
{
     rr.open("C:\\Desktop\\tutorial.robo");
}

Assuming that "tutorial" is what you typed into the Listen variable module.

STeven.
STeven.
Anonymous 15 year
In the line:
tutorial = rr.getVariable("tutorial", buffer, 64)
What should the variable tutorial, be declared as? Is that a string?
Anonymous 15 year
That was actually a typo incorrectly copied from the first example. It should just read

rr.getVariable("tutorial", buffer, 64);

as the value of the RR  variable "tutorial" is placed in the C variable buffer with max length 64 (it is a char * or primitive string).

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index