Mystic Software Forums
Mystic Software => General Discussion => Topic started by: Dandy Masher on June 07, 2005, 07:55:31 PM
-
Hey, could someone help me with this? This is a very basic type of menu I used in TK2, but it doesn't want to work in TK3. I'd really appreciate if someone could give it a quick gander.
The problem is that my While loop doesn't seem to be properly detecting my keypress. No matter which key I press, the game locks up.
// menu display program
done! = false
button! = 1
mainMenuImage()
while (!done!)
{
wait(result$)
if (result$ == "UP")
{
button! = button! - 1
if (button! < 1)
{
button! = 1
}
mainMenuImage()
{
if (result$ == "DOWN")
{
button! = button! + 1
if (button! > 9)
{
button! = 9
}
mainMenuImage()
{
if (result$ == "X")
{
delay(0.25)
fade(2)
fontSize(20)
done! = true
}
}
And here is the method referenced above.
// mainMenuImage method
method mainMenuImage()
{
if (button! == 1)
{
setImage("menu_main_items.png", 328, 16, 296, 192)
}
if (button! == 2)
{
setImage("menu_main_gear.png", 328, 16, 296, 192)
}
if (button! == 3)
{
setImage("menu_main_talents.png", 328, 16, 296, 192)
}
if (button! == 4)
{
setImage("menu_main_status.png", 328, 16, 296, 192)
}
if (button! == 5)
{
setImage("menu_main_roster.png", 328, 16, 296, 192)
}
if (button! == 6)
{
setImage("menu_main_map.png", 328, 16, 296, 192)
}
if (button! == 7)
{
setImage("menu_main_load.png", 328, 16, 296, 192)
}
if (button! == 8)
{
setImage("menu_main_return.png", 328, 16, 296, 192)
}
if(button! == 9)
{
setImage("menu_main_exit.png", 328, 16, 296, 192)
}
}
Thanks for looking.
DM
-
Just so you know, the name DM is taken. Razz
-
Look at my menu help topic at the bottom, i have a menu system similar to yours, i use canvases, which is the new way of doing things.
And allyou have in the if array(yu can use switch() now) is put images up, not actually DO anything, or allow to do anything, just stare at the pretty pictures. Take a look at canvassing!
change the wait() command to result$=wait().
(Also you could have called yourself Master Shake Smile ) that way yor initials would be MS!!! Laughing
-
The code looks fine at a glance. I'll try running it and get back to you later.
-
Just so you know, the name DM is taken. Razz
By me. But I don't give a rat's ass who gets called DM. I prefer to be called Dude Man anyways. <_<
-
Sorry it took so long. Just be careful with your braces... (Heh...)
done! = false
button! = 1
mainMenuImage()
while (!done!)
{
wait(result)
if (result == "UP")
{
button! = button! - 1
if (button! < 1)
{
button! = 1
}
mainMenuImage()
} // <-- This brace was flipped!
if (result == "DOWN")
{
button! = button! + 1
if (button! > 9)
{
button! = 9
}
mainMenuImage()
} // <-- This too!
if (result == "X")
{
delay(0.25)
fade(2)
fontSize(20)
done! = true
}
}
-
Eh, I don't see any braces through that helmet of yours. J/K