Question: Menu and a Turn-script Menu

Anonynn
26 Sept 2018, 04:32Hello!
So I have a skill tree prepared for my game which will prompt menu's to appear via turn-scripts when the player reaches a certain stat. However, I'm wondering if I should make it a command instead to avoid situations where if there's already a menu on screen that the turn-script menu doesn't try to happen at the same time thus probably causing a...
"only one menu allowed at a time" problem.
What do you guys think?
Anonynn.
mrangel
26 Sept 2018, 08:41You could have the turnscript do:
if ([condition required to display menu] and not HasScript (game, "menucallback")) {
// etc
}
so it will wait for there not to be a menu on screen before it does its thing (assuming the condition continues to be true)
I'm going a bit further with this; I've got a modified ShowMenu function (named Question because I can't override functions in the web version) which checks if there's already a menu on the screen, and if there is it saves its arguments into a set of attributes which will be displayed as soon as the current menu is answered.

Anonynn
26 Sept 2018, 18:02That's super smart :D ! I didn't know there were built-in ways around menu's overlapping one another. Hmm..
mrangel
26 Sept 2018, 18:15The script attribute game.menucallback
is used to store the script that will be run when a menu option is selected. Checking if it exists is the simplest way to find out if there's a menu active.