Mystic Software Forums

Mystic Software => General Discussion => Topic started by: ddl2829 on September 17, 2005, 06:37:15 PM

Title: (no subject)
Post by: ddl2829 on September 17, 2005, 06:37:15 PM
can any1 tell me how i would start ot ocode a item menu that does not use the internalmenu() command?
Title: (no subject)
Post by: Xorlak on September 18, 2005, 12:54:48 PM
This can be tricky.  I wouldn't recommend attempting this unless you have some prior game making experience.

Probably the best way is to store items in a series of arrays.  For example, you can keep the names of items in your inventory like this:

item[1]$ = "Potion"
item[2]$ = "Ether"
...

Etc.  And how many items of each you have in a parellel array:

itemcount[1]! = 2
itemcount[2]! = 3

You can list these side by side in a menu like this:

Code: [Select]
y!=10
for(i!=1;i! < maxitems!; i!++)
{
  text(10,y!,item[1]$)
  text(10,y!,itemcount[1]!)
  y!++
}

And get a result like:

Code: [Select]
Potion    2
Ether     3

Now, if you want to use an item, you can write a method that runs each time the item is used.  Say Use_Potion() is your potion method.  You can do something like

Code: [Select]
// i! is the number of the item being used
rpgcode("Use_" + item[i!]$)
itemcount[i!]!--

In the above case, if i! is 1, then the Use_Potion() method would be called and the number of potions in stock would be decreased.

That just scratches the surface, but it should give you an idea of where you need to go.