So I'm trying to make a builder menu, in bgt like in sbyw, or tk, or other games like that, and I'm having trouble.
When I run my code, witch I will explain later, it allows me to enter the coordinates in the boxes, but then when it gets to the menu, it just goes back to the while loop.
In the void game while(true), I have if(SCRIPT_COMPILED==false)
{
if(key_pressed(KEY_P))
{
bmenu();
}
}
Witch takes me to the menu just fine, here is the menu.
void bmenu()
{
settupmenu();
m.add_item_tts("Tile, T","til","t");
m.add_item_tts("Wall, W","Wal","w");
int mres=m.run("Build something",true);
if (m.get_item_name(mres)=="til")
{
mix=input_box("Builder", "Minimum x of the tile?");
if (mix=="") { bmenu(); }
mix2=string_to_number(mix);
max=input_box("Builder", "Maximum x of the tile?");
if (max=="") { bmenu(); }
max2=string_to_number(max);
miy=input_box("Builder", "Minimum y of the tile?");
if (miy=="") { bmenu(); }
miy2=string_to_number(miy);
may=input_box("Builder", "Maximum y of the tile?");
if (may=="") { bmenu(); }
may2=string_to_number(may);
miz=input_box("Builder", "Minimum z of the tile?");
if (miz=="") { bmenu(); }
miz2=string_to_number(miz);
maz=input_box("Builder", "Maximum z of the tile?");
if (maz=="") {bmenu(); }
maz2=string_to_number(maz);
tmenu();
}
}
void tmenu()
{
settupmenu();
m.add_item_tts(""+tilelist+"");
int mres=m.run("Tile type?",false);
if (mres==0 or m.get_item_name(mres)=="back")
{
bmenu();
}
else
{
spawn_tile(mix2,max2,miy2,may2,miz2,maz2,""+m.get_item_name(mres)+"");
}
}
So the mix and mix2 thing might seem a little weird, but I had trouble with the spawn_tile because it wasn't originally a string based function, except in the tiletype part. So I had to make a second variable to feed the number from the first one.
Anyway, anybody have any ideas on why this isn't working, and if so, please help. I've been working on this for hours and it's quite anoying.
P.S. I'm going to do practically the same thing with the walls menu, but a bit differently, witch I might be asking about later.
“Yes, sir. I am attempting to fill a silent moment with non-relevant conversation.”
“You don’t tell me how to behave; you’re not my mother!”
“Could you please continue the petty bickering? I find it most intriguing.” – Data (Star Trek: The Next Generation)