Simple Dynamic Menu - Non-Scrolling ~ by TK for rpg2knet.com ----------------------------------- This is a simple guide to making a small list of items sort themselves out in a predetermined order without any gaps appearing. It'll also tell you how to calculate the number of each item held. What this tutorial won't tell you is how to make a scrolling dynamic menu (I never needed it - mweh :p). *** Firstly, name some variables. I'll call the maximum number of items to be disaplyed "x" - so if you want to show a maximum of 9 items, x = 9. Find a block of empty variables - they MUST be all next to each other. - Call the first x variables "Item Place 1", "Item Place 2", all the way up to "Item Place x". - Call the next variable "Array". - Call the next x variables "Y Pos 1", "Y Pos 2", up to "Y Pos x". - Call the next x varaibles "Item # 1", "Item # 2", up to "Item # x". - Call the next variable "# Array". The first lot of variables will tell the game which item is in each position. The Array variable will point the game to the right variable to change during the calculation change. The Y Pos variables determine where each item name goes on the screen. The Item # variables tell the game how much of item 1, item 2 etc the player has. Finally, # Array is the same as Array but points to the Item # variables rather than the Item Place varaibles. *** Now, make an event, which will be called every time you want the list of items to update. Set all used variables to 0. Now set "Array" to the variable number "Item Place 1" occupies. Similarly set "# Array" to the variable number "Item # 1" occupies. Make a fork checking if the player has the first item. If so, set the variable determined by the value of "Array" (for the first case it'll be "Item Place 1") to 1. Add 1 to "Array" so that for the next item, "Array" will point to the "Item Place 2" variable. Set the variable determined by the value of "# Array" to the number of the first item held, and add 1 to "# Array". Next, make a fork to check for each of the following items. If that item is present, set the variable determined by "Array" to a number which you want to associate with that item (so set it to 2 for the second item, 3 for the third item etc). Then add 1 to "Array" so the next item will change the next "Item Place" variable. Do the same for the Item # variables, but changing the number set to be the number of the specific item held. It should look like this so far: *** Next, make x Show Picture commands so that all of your pictures of item names are shown, but off screen. Later on, we'll move the pictures that need to be seen into the visible area. For example: Show Picture 10: Wooden Bow (80, -40) Show Picture 11: Long Bow (80, -40) Show Picture 12: Fire Bow (80, -40) Show Picture 13: Ice Bow (80, -40) etc This of course limits the number of items you can have in this type of menu to 20... but you knew that already, right? ;). *** The next bit of code depends on how you want to display the number of each item held. Probably the simplest way is to have various 100 page events with a different number depending on the size of a variable. Change the variables your using to equal "Item # 1", "Item # 2" etc. If you don't want this to appear, just omit this part of the coding. *** Now's the time to actually make the items appear in the list, by using the Move Picture commad. First off, set the "X-Co-ordinate" of your pictures - this will remain unchanged. Set all of the "Y Pos" variables to a number like -40 - this way, items you don't have appear off screen. Now comes the only bit of multi forking in the system - although it isn't that hard ;). Make a first fork checking if the value of "Item Place 1" is equal to 1. If it is, change the variable "Y Pos 1" to the Y co-ordinate of where you want the first item in your list to show. If it isn't, make an Else case and add a fork to check if the value of "Item Place 1" is 2. If it is, change the variable "Y Pos 2" to the Y co-ordinate of where you want the first item in your list to show. If it isn't... well, you get the idea :p. Make x forks for the x possible items that can appear in position 1. Now make a brand new fork chain, starting with a check to see if "Item Place 2" is equal to 2. If it is, set "Y Pos 2" to the Y co-ordinate of the SECOND item in the list. If it isn't, continue the fork chain as before. Note that there's no need to check if "Y Pos 2" is equal to 1 - if you had the first item, it would have gone in the first slot. Create a fork chain for the remaining "Item Place" variables. They'll all look something like this: *** Finally, create x Move Picture commands where each picture is moved to co-ordinates "X Co-ordinate" and its corresponding "Y Pos" variable. Make sure Movement Time is set to 0.0. This completes the event - it'll look like this: ******* I'd like to thank Diero for his Dynmaic menu tutorial and Breekan for telling him how to do it :). This tutorial was produced for www.rpg2knet.com and anyone wishing to post it on their site must seek my permission. TK - tk@square-x.com