Hi all,
So in this other project I have, I've got a menu with music working as well as having the speech manager class up and running.
I also again got unexpected end of file, but I have less code with this so it's easier to work with as there's a total of about four braces.
The idea is to create a do loop in the menu that checks to see if one of the choices in the menu is selected, where it will then call the functions. Game i don't have coded yet but I'll start as soon as I get this sorted, speech options should call configuration from speech manager, and exit calls exit to exit the game of course. This time I'm breaking up all my functions into includes, I just can't deal with five-10 functions, all dealing with different things in one file. I'm talking about functions that branch off into different things entirely. This time I'll make an object for player interaction and another for enemies--I also did try to make an effort to indent this time, especially with the do loop since there's lots of braces in it but not as much as I have to keep track of in the Memory Train Deluxe file. How do I turn on mismatching indents in NVDA? People were talking about but I have never scene it.
The way I understand these closing braces is that the first right brace closes the if statement for choice four exit, the second one closes the do loop, and the third closes the main function.
Thanks for your help all. Code:
#include "dynamic_menu.bgt"
#include "speech_manager.bgt"
//The main menu, speech and other things.
speech_manager speech;
sound music;
void main()
{
speech.init("Config.dat", "9223315");
music.stream("sounds/music/mainmenu.ogg");
music.volume = -10;
show_game_window("Test");
dynamic_menu menu;
set_error_output("error.log");
music.play_looped();
int result;
menu.set_speech_mode(speech.mode);
menu.set_tts_object(speech.sapi);
menu.add_item_tts("start");
menu.add_item_tts("Speech Options");
menu.add_item_tts("exit");
int choice;
result=menu.run("Please choose an option.", true);
do
{ if(choice==1)
{
game();
}
else if(choice==2)
{ speech.configure();
}
else if(choice==3)
{ exit();
}
}
}
edit: So I put this particular file through the BGT matcher, and it says I have 22 quotes which I suppose should be normal for the parameters of functions require them around quotes, but 0 unclosed braces and 0 unclosed brackets. This tells me that it's not a braces error but something logical or syntax related? That's good to know as it's only my second do loop.