Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (TedMar), 1,420 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
AUM87 SpeechRecognition. #404033
07/01/12 16:27
07/01/12 16:27
Joined: Feb 2006
Posts: 33
Herts, UK
D
danohu Offline OP
Newbie
danohu  Offline OP
Newbie
D

Joined: Feb 2006
Posts: 33
Herts, UK
The AUM87 tutorial contains a SpeechRecognition script file.

I want to add a comparison to the speech recognition code. When I add something simple like (screen_color.blue = 100), see below, the code will run successfully.

if((listeningresult == 0) && (screen_color.blue = 100)) {
str_cpy((status_text.pstring)[0],"ready");
get_last_sentence(mysentence);
str_cpy((test_text.pstring)[0],mysentence);
listeningresult = 1;

However when I try other more complex comparisons I don’t seem to be able to get them to work and wondered what I am doing wrong? For example, when I write the speech that appears on the screen to a txt file and then try and run the comparison below I get‘Error E355’.

if((listeningresult == 0) && (file_asc_write (filehandle, 13) > 1) {
str_cpy((status_text.pstring)[0],"ready");
get_last_sentence(mysentence);
str_cpy((test_text.pstring)[0],mysentence);
listeningresult = 1;

Alternatively, when I try the following I get ‘Script Editor is not working’.

if((listeningresult == 0) && (file_length (filehandle) <= 1)) {
str_cpy((status_text.pstring)[0],"ready");
get_last_sentence(mysentence);
str_cpy((test_text.pstring)[0],mysentence);
listeningresult = 1;

Any help will be greatfully appreciated.

Re: AUM87 SpeechRecognition. [Re: danohu] #404036
07/01/12 17:01
07/01/12 17:01
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Error E355 relats to the published version of a game.
Originally Posted By: Mighty Manual
A published engine could not start. Possible reasons are modifications to the executable, resource, or script after publishing. This can also happen if the .CD folder contained old content. Delete the .CD folder and publish again.


What version of Gamestudio do you use? Are you aware file_asc_write does not return a value and hence the result of your condition is unspecified?


Always learn from history, to be sure you make the same mistakes again...
Re: AUM87 SpeechRecognition. [Re: Uhrwerk] #404052
07/01/12 18:48
07/01/12 18:48
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
The comparision screen_color.blue = 100 is wrong, it must be:

screen_color.blue == 100

Re: AUM87 SpeechRecognition. [Re: danohu] #404170
07/03/12 20:46
07/03/12 20:46
Joined: Feb 2006
Posts: 33
Herts, UK
D
danohu Offline OP
Newbie
danohu  Offline OP
Newbie
D

Joined: Feb 2006
Posts: 33
Herts, UK
Thanks for the help. The essence of the problem is that while I am able to run the code in the AUM tutorial successfully and then write the text appearing on the screen to a txt file, each time I speak again the text in my txt file is replaced by the new words I have just spoken and the old words are erased. I want to be able to ensure that when I speak a new set of words to the screen that they will appear each time on a different line in the txt file. I was hoping to use some sort of comparison such as ‘If text has been written to line X in the txt file then place the new words just spoken on line Y’. My coding abilities are clearly lacking from you responses. Thank you nevertheless. Any further help or insights would be much appreciated.

Re: AUM87 SpeechRecognition. [Re: danohu] #404171
07/03/12 21:03
07/03/12 21:03
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
I guess you are using file_open_write to get a handle to the file you are writing into. Use "file_open_append (STRING* name);" instead. Then any text you write to this file will be appended.

Re: AUM87 SpeechRecognition. [Re: PadMalcom] #404210
07/04/12 20:55
07/04/12 20:55
Joined: Feb 2006
Posts: 33
Herts, UK
D
danohu Offline OP
Newbie
danohu  Offline OP
Newbie
D

Joined: Feb 2006
Posts: 33
Herts, UK
Thanks for the response. I did try the append option but got a funny effect. The spoken words would be saved to a new line. Unfortunately, the same series of words were then repeated about 20 times. It seemed almost like an 'echo' had taken place. Rather weird but perhaps that is to do with my machine??

Re: AUM87 SpeechRecognition. [Re: danohu] #404262
07/05/12 21:07
07/05/12 21:07
Joined: Feb 2006
Posts: 33
Herts, UK
D
danohu Offline OP
Newbie
danohu  Offline OP
Newbie
D

Joined: Feb 2006
Posts: 33
Herts, UK
I have managed to recreat the code I was talking about below:

#include <acknex.h>
#include <default.c>
#include "speechrecog.h";

var gamerunning = 1;
var listeningresult = 0;
var filehandle;
STRING* mysentence = "#100";

TEXT* dummy_text = { strings = 1; pos_x = 10; pos_y = 10; flags = VISIBLE; }
TEXT* status_text = { strings = 1; pos_x = 720; pos_y = 20; flags = VISIBLE; }
TEXT* test_text = { strings = 1; pos_x = 520; pos_y = 20; flags = VISIBLE; }

function main()
{
video_mode = 7;
screen_color.blue = 150;
init_speech();

while(gamerunning) {
wait(1);

is_listening(listeningresult);

if(listeningresult == 0) {
str_cpy((status_text.pstring)[0],"ready");
get_last_sentence(mysentence);
str_cpy((dummy_text.pstring)[0],mysentence);
listeningresult = 1;
filehandle = file_open_append ("c:\\test.txt");
file_str_write (filehandle, mysentence);
file_close(filehandle);
}
else
{
str_cpy((status_text.pstring)[0],"listening");
}
if (key_1) stop_listening();
if (key_2) start_listening();
}
free_speech();
}

//When I speak two words "test" then "new" with a three second
//gap in between them, the following appears in my test.txt file:

Click to reveal..

TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnewnew


//While the two words appear on different lines the 'echo' effect is not what I wanted. Perhaps this is because I should in fact use 'file_open_write' to start with rather than begin with 'file_open- append'. Not sure how to do this?? Any thoughts on how to get around the problem would be welcomed.





Last edited by Rei_Ayanami; 07/05/12 21:52. Reason: Added Spoiler because it destroyed the site layout

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1