Hi everyone, I was wondering if someone familiar with Monarch could help me figure out how to setup a basic menu system. I’ve setup a “main menu” which works fine since I based the structure around the example. However, now I’m trying to add an overlay to the game which has a couple of on-screen buttons. Those buttons I want to pop-up another screen when clicked. I have setup this system like this:
The main.script initializes the collection by showing the hud screen (which appears fine within the game.) This hud contains two buttons (for now): inventory and stats. I want each of these to pop-up a screen which shows the related information. For now I have started by trying to create the inventory pop-up screen.
In the code for the hud, I have the following:
local node = gui.get_node("inventorybutton")
if gui.pick_node(node, x, y) then
msg.post(game_ref, hash("pause"))
pprint(monarch.dump_stack())
monarch.show(hash("inventory"))
pprint("after show inventory")
pprint(monarch.dump_stack())
end
This pauses the game using the timescale option and then attempts to show the inventory. I have also tried not pausing the game to see if the timescale was causing the screen to not show up but there’s no difference w/ or w/o it. After I click the inventory button I see the following printout:
DEBUG:SCRIPT: 1 = hash: [menu]
2 = hash: [hud]
DEBUG:SCRIPT: after show inventory
DEBUG:SCRIPT: 1 = hash: [menu]
2 = hash: [hud]
There is no error and the inventory screen I’ve created never runs the init loop or is created (I have another print statement there for testing which never shows up.) I’ve tried a screen_proxy and a screen_factory but there’s no difference. Has anyone seen this or have any ideas of what to check? I have an “about” popup on the main menu setup similarly and it works without issues but for some reason in the overlay portion of the game this screen can not be shown.