2019-06-25 15:59:53

Hi.
I don't know why this happenes every time  i try to make a void, or something like a game round, like i press on an option like start menu,  and then it gose to the round., but it just exits. here's the code.  btw, I added the show game window there to see if it works but it doesn't. (I'm also using nathantech's menu.
#include "menu.bgt"
void main()
{
click.load("click.ogg");
int r;
show_game_window("I am so cool");
wait(1000);
string text="hi. I am hippy";
string[] items={"Be a nice guy and play ma game for meh"};
r=new_menu(text, items, 0);
install_keyhook();
if(r==1)
{
sm();
}
}
void sm()
{
show_game_window("testingnumber###2000");
if(key_pressed(KEY_UP))
{
speak_wait("bopit.");
click.play();
}
}
it works, but the problem is that it refuses to enter the sm(); round when clicking on r1.
see ya.

see ya later. Hope you don't fall off a roof.

2019-06-25 17:27:10

It actually enters sm(), but then quickly exits. It executes the function once then it has nothing to do so it exits. Basicly, Those sections of the code that mean to operate the gameplay(handling keys, AI, Etc) are usually in a while loop which as you see, yours isn't in any loop. To fix this, add a while loop right after the show game window in sm(). Please be careful not to add it before the show game window(Don't put the show game window in your while loop). This will most likely cause unexpected beheaviors and probably impacts performance as well.

---
Co-founder of Sonorous Arts.
Check out Sonorous Arts on github: https://github.com/sonorous-arts/
my Discord: kianoosh.shakeri2#2988

2019-06-25 17:50:13

thank you. I managed to get it to work now.

see ya later. Hope you don't fall off a roof.

2019-06-25 18:08:39 (edited by Ahng 2019-06-25 18:10:54)

I got another question. when i made the new round, the nvda i have lagged when browsing. is there  a way to fix it? I made a menu, and it just keeps lagging when pressing up and down.

see ya later. Hope you don't fall off a roof.

2019-06-26 09:13:52 (edited by kianoosh 2019-06-26 09:14:29)

What you're talking about is probably related to the menu class you use. It is possibly changing the window title you to what should be spoken when you press up and down. Check if the title remains the same as when you set it whenever you press up and down. If the title changes, Post the menu include here so Either me or someone else can tell you what the problem is and how to overcome it.
If the title remains still, then I have no idea what's happening. This should be related to your menu if you're not doing anything wrong before setting up the menu

---
Co-founder of Sonorous Arts.
Check out Sonorous Arts on github: https://github.com/sonorous-arts/
my Discord: kianoosh.shakeri2#2988