Maintaining stringlist order and nesting menus
TriangleGames
02 Apr 2013, 15:041.) I have a stringlist which will be added to throughout the game, but I need to keep one specific string at the end of it. It's a list of options for a menu, and I want the last option to always be "Back." I imagine it has something to do with "list order," or "list position," but I've never used that stuff before, and I don't know the proper syntax for it. Or, should I create a "new" stringlist each time I call the menu, based on another stringlist and then add "Back" to the end of it?
2.) Also, I'm trying to figure out how to make "branching menus" which can return to the previous menu, and so far my best idea is to make a function for each menu so they can refer back to each other, but that seems pretty sloppy. Is there any simple way to do this without a full library? I tried using undo, but it goes back too far and undoes whatever called the first menu to begin with. I tried looking at the conversation library, but I got confused very quickly, and it implements stuff I don't really need, so I can't tell if it's a good model for what I want.
Visual example:
Main Menu: Make a choice...
--"Opt 1"
----Stuff happens
--"Opt 2"
----Sub Menu
------"Opt 1"
--------Things occur
------"Back"
--------Return to Main Menu
2.) Also, I'm trying to figure out how to make "branching menus" which can return to the previous menu, and so far my best idea is to make a function for each menu so they can refer back to each other, but that seems pretty sloppy. Is there any simple way to do this without a full library? I tried using undo, but it goes back too far and undoes whatever called the first menu to begin with. I tried looking at the conversation library, but I got confused very quickly, and it implements stuff I don't really need, so I can't tell if it's a good model for what I want.
Visual example:
Main Menu: Make a choice...
--"Opt 1"
----Stuff happens
--"Opt 2"
----Sub Menu
------"Opt 1"
--------Things occur
------"Back"
--------Return to Main Menu

jaynabonne
02 Apr 2013, 21:051) I was leaning toward what you said at the end - keep your list without the "Back" and then add "Back" on at the last minute. If you keep "Back" in its own string list (a list of length 1), then you can just do ListCombine(menu, back) at the last minute. This will generate a new list with the combined contents of the two.
2) Your visual example suggests a possibility: use objects for your menu data, and then use the parent/child relationship to navigate up and down.
You can then hang text and even functionality (scripts) off the objects.
The other way to do it is to have a list, which you use as a stack. When you navigate to a new level, push the current level on the end of the list. When you go to navigate up, grab the last entry and remove it from the list, to "pop" the entry.
2) Your visual example suggests a possibility: use objects for your menu data, and then use the parent/child relationship to navigate up and down.
<object name="MainMenu">
<object name="MainMenu_Opt1">
</object>
<object name="MainMenu_Opt2">
<object name="MainMenu_Opt2.1">
</object>
</object>
</object>
You can then hang text and even functionality (scripts) off the objects.
The other way to do it is to have a list, which you use as a stack. When you navigate to a new level, push the current level on the end of the list. When you go to navigate up, grab the last entry and remove it from the list, to "pop" the entry.