Posted: 19th Oct 2003 23:50
After talking with smokie mcpot I decided to make the outline of a working rpg menu. It uses just the text, line and box commands, no sprites, although you could if you wanted. It allows you to switch menus and see different items. If you press on an item it disappears. Obviously it would need to be developed far more for an actual RPG, but this demonstrates how to start it.

Its made for DBC, but should work in pro.

+ Code Snippet
`Basic RPG menu
`By Joseph Thomson
`19/10/03

`Data for menus
data "Healing",6
data "Potion","Ether","Antidote","Healing Water","Phoenix Down","Super Potion"
data "Magic",7
data "Fire Drops","Ice Crystals","Sleeping Potion","Firey Rain","Hurricane Draught","Lightning Orb","Water Orb"
data "Armour",11
data "Steel Gauntlets","Golden Shield","Fire Shield","Heavy Chain Mail","Light Chain Mail","Leather Boots","Magic Helmet"
data "Iron Helmet","Dragon Skin Gloves","Ring of Defence","Iron Plated Gloves"
data "Weapons",4
data "Blade of Destruction","Firey Dagger","Longbow","Crossbow"
data "Misc",5
data "Feather","Colourful Orb","Diary III","Broken Pen","Tissue"

`Number of submenus
numSubMenus=5

`Where the sub menu names will be stored
dim mainMenu$(numSubMenus)
`Where the item names will be stored
dim subMenu$(numSubMenus,20)
`Where the amount of item will be stored
dim subMenuQuantity(numSubMenus,20)
`Where the amount of items in the sub menu will be stored
dim subMenuAmount(numSubMenus)

`Read in data
for x=1 to numSubMenus
   read mainMenu$(x)
   read subMenuAmount(x)
   for y=1 to subMenuAmount(x)
      read subMenu$(x,y)
      subMenuQuantity(x,y)=rnd(10)+1
   next y
next x

sync on

do
   `Background
   ink rgb(255,255,255),0
   box 0,0,639,479

   `Do left menu graphics
   ink rgb(100,100,100),0
   box 23,23,203,463
   ink rgb(200,200,200),0
   box 20,20,200,460
   ink rgb(0,0,0),0
   text 40,35,"MENUS"
   line 40,55,180,55

   `Do right menu graphics
   ink rgb(100,100,100),0
   box 253,23,623,463
   ink rgb(200,200,200),0
   box 250,20,620,460
   ink rgb(0,0,0),0
   text 270,35,"ITEM"
   text 500,35,"QUANTITY"
   line 270,55,600,55
   line 480,35,480,440


   `Loop through sub menus
   for x=1 to numSubMenus
      `If the mouse is hovering it
      if mousex()>40 and mousex()<40+text width(mainMenu$(x)) and mousey()>40+20*x and mousey()<40+20*x+text height(mainMenu$(x))
         ink rgb(0,200,0),0
         `If the mouse is clicked then switch menus to that one
         if mouseclick()=1 then currentMenu=x
      else
         ink rgb(100,100,100),0
      endif
      `Print main menu text
      text 40,40+20*x,mainMenu$(x)
   next x

   `Reset the 'cursor' for printing the text to the top of the list
   listInc=0
   `Loop through items
   for x=1 to subMenuAmount(currentMenu)
      `If the amount is more than 0
      if subMenuQuantity(currentMenu,x)>0
         `Move the 'cursor' for printing the text down, so we don't get overlapping text
         inc listInc
         `If mouse is hovering it
         if mousex()>270 and mousex()<270+text width(subMenu$(currentMenu,x)) and mousey()>40+20*listInc and mousey()<40+20*listInc+text height(subMenu$(currentMenu,x))
            ink rgb(255,255,0),0
            `If the mouse is clicked and the time has passed from the last item click
            if mouseclick()=1 and timer()-clickTimer>200
               `Decriment the number of items
               subMenuQuantity(currentMenu,x)=subMenuQuantity(currentMenu,x)-1
               `Reset timer
               clickTimer=timer()
            endif
         else
            ink rgb(100,100,100),0
         endif
         `Print item name
         text 270,40+20*listInc,subMenu$(currentMenu,x)
         `Print item quantity
         text 500,40+20*listInc,str$(subMenuQuantity(currentMenu,x))
      endif
   next x

   sync
   cls
loop
Posted: 22nd Oct 2003 8:07
Nice Clean approach for static menu items
Posted: 10th Nov 2003 5:12
I like it.

Suggestion for a v2: Toggle support. With this system (which is indeed very clean), you have a weapons list (although it's just another array with different names) that uses the same click & decrease function. Why not have a toggle feature?

I understand that's pointless (it's only an invintory without a statistical output) and could (in fact) be made to create a new array item when a quantity is altered (Blade of Destruction is removed and Equipped Blade of Destruction is added to the array when unequipped version is clicked and vise versa) and whatnot, but for now, I do in fact like this system for a specific area of a game I'm currently putting down in paper.

Good work.
Posted: 30th Nov 2003 10:28
Yes! Very Good!
Posted: 5th Dec 2003 22:10
Nice
Posted: 10th Dec 2003 9:34
yea this is a nice menu i am doing my Item menu kinda like this one. but it keybaord controld and doesn't use those data statements. and there is only menu
Posted: 27th Dec 2003 0:09
This is just code, people can add their own eye candy
Posted: 31st Dec 2003 1:56
Yeah, this is just the basis for a menu, you have to make version 2 .