Is there a way to force message evaluation order? Consider the following:
init(self)
startgame()
end
function startgame()
msg.post(".", "hideUpperMenu")
--msg.post(".", "hideButton", menu.mainButton)
--msg.post(".", "hideButton", menu.dataButton)
--msg.post(".", "hideButton", menu.statsButton)
--msg.post(".", "hideButton", menu.levelButton)
--msg.post(".", "hideButton", menu.perksButton)
--msg.post(".", "hideButton", menu.appearanceButton)
msg.post(".", "showButton", menu.mainButton)
msg.post(".", "showButton", menu.dataButton)
end
function on_message(self, message_id, message, sender)
-- Hide a button
if (message_id == hash("hideButton")) then
gui.set_enabled(gui.get_node(message.node), false)
end
-- Reveal a button
if (message_id == hash("showButton")) then
gui.set_enabled(gui.get_node(message.node), true)
end
-- Hide upper menu
if (message_id == hash("hideUpperMenu")) then
msg.post(".", "hideButton", menu.mainButton)
msg.post(".", "hideButton", menu.dataButton)
msg.post(".", "hideButton", menu.statsButton)
msg.post(".", "hideButton", menu.levelButton)
msg.post(".", "hideButton", menu.perksButton)
msg.post(".", "hideButton", menu.appearanceButton)
end
end
If I run this, I get enabled/disabled problems, but if I comment out the message post to hideUpperMenu and uncomment the rest of the code in startgame, it ends up working correctly. It’s as if my showButton and hideUpperMenu message calls are happening stimultaneously.
I’d like to use hideUpperMenu instead. How can I force it to finish before calling showButton?