Day 5: Guess what? More bloody menus.

To be fair, these menus come with some of the reworking of the inventory system and how such items as displayed isn’t as simple as doing a normal ‘this button does this’ kind of menu. Each menu item’s function depends entirely on the matching list, which is kind of awkward to program and a few problems had to figure a few things out. The ‘Equipment’ , the guns and swords are in the same item list as everything out. There’s a separate ‘Inventory Menu’ too, so instead of just displaying the entire list, I only needed to display a list of items with a certain criteria, items with the ‘effect’ of ‘gun’ or ‘sword’. Then, I needed to be able to select a gun and sword to equip (and remove any equipped weapons) and display what’s equipped.

The difference between lists is that, in the inventory list you get something like:

Item(1)

Item(2)

Item(3)

In the equipment list it’ll end up as

Item(2)

Item(4)

Item(9)

So they need to be parsed differently.

Anyway, it just means you get an effect like this:

Advertisements

2 comments

  1. Wow yeah… I always thought inventry stuff would be tachy… but didnt think listing would be…

    I always figured there were a list for a b and c and you would only allow one item from each list… but heh I guess it all becomes spaghetti after a while…

    FFT on PSOne really nails the system… have you played that?

  2. I played a little FFT, and completed FFT: Advanced.

    Essentially to get it to work like above, I just parse the item list and check certain criteria (like you would in a database) and only display those items. At least that was the method I went for in the end, all other attempts sucked. 😉

    Say you’ve got an item list with a maximum of ’19’ items.

    Start a ‘for x = 1 to 19’

    Check the specific criteria like this:
    if Item(x).effect = “sword” or item(x).effect = “gun”

    It means anything in that if/then statement everything you do only applies to any ‘swords’ or ‘guns’ in the list.

    You can then display the list item. If you’re increasing the height every time ‘x’ changes and it’s a Sword or gun, then you will see these items appear one after the other, even if the slot numbers are 1 and 17.

    To select one, you have to get a variable that increases every time a new ‘weapon’ is found, like this:
    inc e, 1
    It’s still in the same if/then statement.

    Then I create a new if/then statement (literally, right after ‘inc e, 1’)
    If selection = e

    In my system, Up or Down changes the selection, either increasing it or descreasing it. So selection 1 = the top selection, so this means when the first weapon is found ‘e = 1’, if my selection = 1 too, then these two match. So if then the player hits enter, I can have a command that takes the current item and equips it. E.G.
    if returnkey() = 1 then Weapon$ = item(x).name

    I also use a function to clear any currently equipped weapons first.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s