2014-07-01 19:52:57

Hello guys. I learned BGT last year, and today, due to the boredom I had, I said: Why not making a nay simulator?
For those who don't know the nay, it's an Arabic musical instrument, like the flute. And since I play the flute and I like the nay very much, I thought to make this idea. But after I finished writing the scrypt (the most silly and simple one I have ever wrote), I runned it, and as soon as the program starts, it exits. I compiled it into an .exe, the same thing. So for those who know BGT, here's the scrypt, and please help me:
sound a;
sound b;
sound c;
sound d;
sound e;
sound f;
sound g;
sound h;
sound intro;
void main() {
show_game_window("the nay!");
intro.stream("sounds/intro.MP3");
intro.play();
while(intro.playing) {
if(key_pressed(KEY_RETURN)) {
intro.stop();
}
}
game();
return;
}
void game() {
a.load("sounds/a.ogg");
b.load("sounds/b.ogg");
c.load("sounds/c.ogg");
d.load("sounds/d.ogg");
e.load("sounds/e.ogg");
f.load("sounds/f.ogg");
g.load("sounds/g.ogg");
h.load("sounds/h.ogg");
if(key_pressed(KEY_Q)) {
a.play();
}
if(key_pressed(KEY_W)) {
b.play();
}
if(key_pressed(KEY_E)) {
c.play();
}
if(key_pressed(KEY_R)) {
d.play();
}
if(key_pressed(KEY_T)) {
e.play();
}
if(key_pressed(KEY_Y)) {
f.play();
}
if(key_pressed(KEY_U)) {
g.play();
}
if(key_pressed(KEY_I)) {
h.play();
}
if(key_pressed(KEY_Z)) {
exit();
}
}
Thank you and have a nice day.

2014-07-01 19:58:13

The if statements in game() are not inside a loop, so it only checks them once, then there is nothing left to do, so it exits.

Between these lines:

h.load("sounds/h.ogg");
if(key_pressed(KEY_Q)) {

There should be something like
while(true) {

And between the last two braces, there should be something like:

wait(5);
}

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2014-07-02 08:52:19

OK thanks, I'll fix it.