How To: ZSCRIPT MENUS?
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!)
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!)
-
-
- Posts: 1384
- Joined: Sun Oct 14, 2012 1:43 am
- Location: Ukraine
Re: How To: ZSCRIPT MENUS?
Child menu should take things from parent one on construction.
I remember you are supposed to have link to the parent...
I remember you are supposed to have link to the parent...
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: How To: ZSCRIPT MENUS?
Piss waffles... precisely what I was hoping to avoid. Ah well.
-
-
- Posts: 1384
- Joined: Sun Oct 14, 2012 1:43 am
- Location: Ukraine
Re: How To: ZSCRIPT MENUS?
You are consistently trying to avoid the best ways to do things.
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: How To: ZSCRIPT MENUS?
Not really. OnMenuCreated was made for 2.5, not 2.4. Init functions for items don't work like regular menu init.
Also not having to splatter copy/paste code everywhere is certainly much nicer...
Also not having to splatter copy/paste code everywhere is certainly much nicer...
-
-
- Posts: 1384
- Joined: Sun Oct 14, 2012 1:43 am
- Location: Ukraine
Re: How To: ZSCRIPT MENUS?
If you can have that in base class for your submenus it's probably not copy+paste? idk. I haven't seen any menu code ever.
-
- Lead GZDoom+Raze Developer
- Posts: 49184
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: How To: ZSCRIPT MENUS?
If you have to to weird stuff, create your own widget that does not rely on stock code to create the submenu. In that case you'd have full access to it and can transfer whatever you wish. If you need to transfer content you won't be able to do it without some special coding.
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: How To: ZSCRIPT MENUS?
I'm not even ready to tackle that yet. That'd take doing all the screen resizing and resolution calculations and... I'm only knee-deep in the menu code at the moment.Graf Zahl wrote:If you have to to weird stuff, create your own widget that does not rely on stock code to create the submenu. In that case you'd have full access to it and can transfer whatever you wish. If you need to transfer content you won't be able to do it without some special coding.
At first I thought OnMenuCreated was called internally, then I realized it was just a ZScript exclusive. So I got that taken care of and now it works.
Now the next big thing I have to do is figure out how to make nice tiers like this work in just one menu instead of three. Should be interesting:
-
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
Re: How To: ZSCRIPT MENUS?
ZScript menus are quite over my head, at this point. But the possibilities have me quite interested. I don't suppose it would be feasible to try to make a grid-like selection menu, perhaps for a player select?
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: How To: ZSCRIPT MENUS?
Yes, that is possible. And yes, ZScript menus are truly insane in terms of flexibility and making things work. Why you could even have it, say, prompt a password for a door if you want. Or use it as a journal for discovering different things. That is, when Graf changes Menu.SetMenu to clearscope.
-
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
Re: How To: ZSCRIPT MENUS?
I've wanted a player select menu like that for years. But I worry it will be a long time before I can understand it well enough to create that on my own.
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: How To: ZSCRIPT MENUS?
This is where knowing some Java/C++ pays off. This whole concept was based around the UnrealScript idea, though Graf most likely will have taken many of his own liberties.
Anyway... The easiest method I can advise people is, either use VS2015 where all the .cpp files and text is easily searchable, or you can extract all the ZScript menu code from gzdoom.pk3. It's under zscript/menu. I do it with VS2015 since the search capability allows finding things really easily.
Anyway... The easiest method I can advise people is, either use VS2015 where all the .cpp files and text is easily searchable, or you can extract all the ZScript menu code from gzdoom.pk3. It's under zscript/menu. I do it with VS2015 since the search capability allows finding things really easily.
-
-
- Posts: 1384
- Joined: Sun Oct 14, 2012 1:43 am
- Location: Ukraine
Re: How To: ZSCRIPT MENUS?
Is there a way to require mouse for a specific menu?
edit: nevermind x2, my guessed way didn't do it.
Also, I'd like to not only require it, but also hide the default cursor to draw my own.
edit: nevermind x3, apparently I can use the InputEvent for when the mouse is off.
Ok, now, is there a way to DISABLE mouse for my menu so that I can always receive InputEvent instead of UiEvent?
Also how do I prevent closing the menu by escape? (I mean I already can spawn the same menu in OnDestroy, but that'd be a dirty hack and I'm looking for a valid way, and also one that wouldn't crash my executable...)
I want a main menu that opens automatically on startup (can do that already I think) and can't be closed (???)
Oh, alsoalsoalso can we get a GenericMenu in MENUDEF? Right now I need to inherit ListMenu or OptionMenu even if I intend replacing 100% of the functionality from scratch and it's not a menu at all.
My current implementation of a god mode menu looks like this: http://www.mediafire.com/file/8qo5iejb3 ... m3Menu.pk3
I'm thinking of implementing a windowing system in ZScript that has everything disconnected from specific rendering/input backends and in theory can do things like rendering via DrawPowerup and receiving input via event handlers, as well as rendering via menus and receiving input via menus. And of course have it's state disconnected from menus so the menu can be killed as many times as you want, the state will stay.
It should also work with either InputEvent or UiEvent for mouse... because apparently in menus anything can happen.
Wrappers rule
(also, HOERS-related)
edit: nevermind x2, my guessed way didn't do it.
Also, I'd like to not only require it, but also hide the default cursor to draw my own.
edit: nevermind x3, apparently I can use the InputEvent for when the mouse is off.
Ok, now, is there a way to DISABLE mouse for my menu so that I can always receive InputEvent instead of UiEvent?
Also how do I prevent closing the menu by escape? (I mean I already can spawn the same menu in OnDestroy, but that'd be a dirty hack and I'm looking for a valid way, and also one that wouldn't crash my executable...)
I want a main menu that opens automatically on startup (can do that already I think) and can't be closed (???)
Oh, alsoalsoalso can we get a GenericMenu in MENUDEF? Right now I need to inherit ListMenu or OptionMenu even if I intend replacing 100% of the functionality from scratch and it's not a menu at all.
My current implementation of a god mode menu looks like this: http://www.mediafire.com/file/8qo5iejb3 ... m3Menu.pk3
I'm thinking of implementing a windowing system in ZScript that has everything disconnected from specific rendering/input backends and in theory can do things like rendering via DrawPowerup and receiving input via event handlers, as well as rendering via menus and receiving input via menus. And of course have it's state disconnected from menus so the menu can be killed as many times as you want, the state will stay.
It should also work with either InputEvent or UiEvent for mouse... because apparently in menus anything can happen.
Wrappers rule
(also, HOERS-related)
Last edited by ZZYZX on Thu Mar 23, 2017 6:37 pm, edited 1 time in total.
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: How To: ZSCRIPT MENUS?
Yet another exploit that needs shooting apparently. And yes, HOERS related.
-
-
- Posts: 1384
- Joined: Sun Oct 14, 2012 1:43 am
- Location: Ukraine
Re: How To: ZSCRIPT MENUS?
Hey that's not an exploit — that's legit usage of ZScript features that exist at the moment, with no unwanted side effects (well except that you can't start a game, but that's temporary).
If Graf allowed RenderOverlay, it'd be an overlay on a TITLEMAP, with MainMenu calling Destroy on Init if not in GS_LEVEL. But as there are no overlays...
Besides, Doom 3 menu should not close by escape, unless it's in the game. But I didn't implement that part yet — in fact nothing is implemented at all for now
If Graf allowed RenderOverlay, it'd be an overlay on a TITLEMAP, with MainMenu calling Destroy on Init if not in GS_LEVEL. But as there are no overlays...
Besides, Doom 3 menu should not close by escape, unless it's in the game. But I didn't implement that part yet — in fact nothing is implemented at all for now
-
-
- Posts: 17465
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: How To: ZSCRIPT MENUS?
Alt + F4 and "delete WAD to Recycle Bin" always works unconditionally, so this fearmongering of unclosable menus is just exaggeration. ZZYZX already gave realistic use cases.
I can make a WAD even more annoying that calls new(someThinker) in a never-ending while() loop...
I can make a WAD even more annoying that calls new(someThinker) in a never-ending while() loop...