ListMenus and closure

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
Kinsie
Posts: 7399
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33

ListMenus and closure

Post by Kinsie »

Hi! In my current little side-project I'm using a combination of ZScript, ACS and MENUDEF to create plot-spewing terminals in the style of some other old game whose name I forget right now.
Image

They're pretty cool as it stands, but I'd like to add options to them, to advance between multiple pages or close themselves instead of relying on the player to hit ESC. However, it looks like the "Command" option is limited to OptionMenus and can't be used in ListMenus. Is there an equivalent method I can use to make a ListMenu close itself? Thanks.
ZippeyKeys12
Posts: 111
Joined: Wed Jun 15, 2016 2:49 pm

Re: ListMenus and closure

Post by ZippeyKeys12 »

Ooh, information terminals like Marathon :wub: . Wouldn't you already be able to advance through pages with openmenu? :? Exiting seems like a problem, I can see it being annoying as I'd personally rather have a button.

EDIT: I can't wait to see this project, the text in the image you put is intriguing...
User avatar
Kinsie
Posts: 7399
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33

Re: ListMenus and closure

Post by Kinsie »

ZippeyKeys12 wrote:Wouldn't you already be able to advance through pages with openmenu? :?
ListMenus use different, equivalent options (PatchItem or TextItem) so that's not an issue. The issue is getting the menu to quit back into the game without having to ESC back through all the previous pages. If I have to do that, I'll just make all the terminals a single page and call it a limitation.
ZippeyKeys12 wrote:EDIT: I can't wait to see this project, the text in the image you put is intriguing...
The text is from a level in Marathon Infinity, just to illustrate what I've done without showing off any of my quality literature. That'll be for later.
User avatar
ramon.dexter
Posts: 1505
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: ListMenus and closure

Post by ramon.dexter »

And whatabout using ZSDF conversation for the menus?

To behonest, I'm also making a kinf of information terminals. All is done with ZSDF conversation.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49053
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ListMenus and closure

Post by Graf Zahl »

You can call Menu.Close to close your menu, but of course you'll have to write some item to actually perform the action.
User avatar
Kinsie
Posts: 7399
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33

Re: ListMenus and closure

Post by Kinsie »

ramon.dexter wrote:And whatabout using ZSDF conversation for the menus?

To behonest, I'm also making a kinf of information terminals. All is done with ZSDF conversation.
I think I considered Strife dialogues at some point, but something about them put me off. I'll probably use them for, well, actual dialogue options if it ever comes to that.
Graf Zahl wrote:You can call Menu.Close to close your menu, but of course you'll have to write some item to actually perform the action.
Excellent, this gives me a starting point. Thanks!
User avatar
Kinsie
Posts: 7399
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33

Re: ListMenus and closure

Post by Kinsie »

So, uhh, dumb question time. How do I actually use custom menu items in MENUDEF?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49053
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ListMenus and closure

Post by Graf Zahl »

Their class name needs to start with ListMenuItem/OptionMenuItem, and they need to implement a public Init function returning the object itself. The arguments for these functions will then be parsed by the MENUDEF parser, using the function's signature to interpret the values being passed.

Return to “Scripting”