Dismiss menu by docking the crank

I'm looking to use the crank undocking and docking to open and close the menu, respectively. I managed to figure out the undocking to open portion using this code snippet I slightly modified from the PulpScript documentation:

on undock do
	menu at 1,1,20,10 then
		option "Sword" then
		end
		option "Bow" then
		end
	end
end

But I'm having trouble figuring out the right event and/or function to use to get the system to make re-docking the crank close the menu. Is this possible?

I was thinking of possibly using the config setting below to allow the B button to dismiss the root menu, and then somehow link or mimic that action under "on dock do"

config.allowDismissRootMenu = 1
1 Like

I'm not sure this is possible with Pulp. I don't think there's any way to call a button press without pressing a button. The other problem is that your undock code runs only once when the crank is undocked. So, anything that you want to happen when the crank gets docked won't run until the undock action has been completed, which is to say, the menu will have to be closed before "on dock" will run.

I've been trying to figure out a clever way to be able to do this, but I don't think there's anyway to track the crank's state if it changes while a menu or say action is on screen.

Following to see if anyone can figure out how to do it in Pulp, but I don't believe it's possible.

The Pulp menu system takes over all user input, so you can’t do much about it unfortunately. But, you could make your own menu system and control it that way using a combination of draw, window, and/or label commands in the player draw event.

2 Likes