Mystic Software Forums

Mystic Software => General Discussion => Topic started by: Dandy Masher on June 07, 2005, 07:55:31 PM

Title: (no subject)
Post 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.

Code: [Select]
// 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.

Code: [Select]
// 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
Title: (no subject)
Post by: Aminaga on June 08, 2005, 06:05:45 AM
Just so you know, the name DM is taken.  Razz
Title: (no subject)
Post by: AlienDude on June 08, 2005, 08:32:33 AM
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
Title: (no subject)
Post by: Xorlak on June 08, 2005, 10:02:13 AM
The code looks fine at a glance.  I'll try running it and get back to you later.
Title: (no subject)
Post by: Dude Man on June 08, 2005, 09:41:38 PM
Quote from: "dreammakermaster"
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.  <_<
Title: (no subject)
Post by: Xorlak on June 11, 2005, 04:47:48 PM
Sorry it took so long.  Just be careful with your braces... (Heh...)

Code: [Select]
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
  }
}
Title: (no subject)
Post by: Aminaga on June 11, 2005, 04:48:31 PM
Eh, I don't see any braces through that helmet of yours. J/K