How To: ZSCRIPT MENUS?

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.

Re: How To: ZSCRIPT MENUS?

Postby ZZYZX » Mon Mar 20, 2017 3:19 pm

Child menu should take things from parent one on construction.
I remember you are supposed to have link to the parent...
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine
Discord: ZZYZX#1394
Github ID: jewalky

Re: How To: ZSCRIPT MENUS?

Postby Major Cooke » Mon Mar 20, 2017 3:31 pm

Piss waffles... precisely what I was hoping to avoid. Ah well.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: How To: ZSCRIPT MENUS?

Postby ZZYZX » Mon Mar 20, 2017 3:39 pm

You are consistently trying to avoid the best ways to do things.
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine
Discord: ZZYZX#1394
Github ID: jewalky

Re: How To: ZSCRIPT MENUS?

Postby Major Cooke » Mon Mar 20, 2017 3:47 pm

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...
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: How To: ZSCRIPT MENUS?

Postby ZZYZX » Mon Mar 20, 2017 4:00 pm

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.
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine
Discord: ZZYZX#1394
Github ID: jewalky

Re: How To: ZSCRIPT MENUS?

Postby Graf Zahl » Mon Mar 20, 2017 4:18 pm

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: How To: ZSCRIPT MENUS?

Postby Major Cooke » Mon Mar 20, 2017 10:33 pm

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.

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.

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:

Image
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: How To: ZSCRIPT MENUS?

Postby Ed the Bat » Thu Mar 23, 2017 1:37 pm

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?
User avatar
Ed the Bat
I'm tired. I want to go home.
 
Joined: 03 May 2012
Location: Maryland, US

Re: How To: ZSCRIPT MENUS?

Postby Major Cooke » Thu Mar 23, 2017 2:09 pm

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. :mrgreen:
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: How To: ZSCRIPT MENUS?

Postby Ed the Bat » Thu Mar 23, 2017 2:11 pm

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.
User avatar
Ed the Bat
I'm tired. I want to go home.
 
Joined: 03 May 2012
Location: Maryland, US

Re: How To: ZSCRIPT MENUS?

Postby Major Cooke » Thu Mar 23, 2017 2:37 pm

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.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: How To: ZSCRIPT MENUS?

Postby ZZYZX » Thu Mar 23, 2017 2:38 pm

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 :rock:
(also, HOERS-related)
Last edited by ZZYZX on Thu Mar 23, 2017 6:37 pm, edited 1 time in total.
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine
Discord: ZZYZX#1394
Github ID: jewalky

Re: How To: ZSCRIPT MENUS?

Postby Major Cooke » Thu Mar 23, 2017 6:32 pm

Yet another exploit that needs shooting apparently. And yes, HOERS related. :P
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: How To: ZSCRIPT MENUS?

Postby ZZYZX » Thu Mar 23, 2017 6:36 pm

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 :)
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine
Discord: ZZYZX#1394
Github ID: jewalky

Re: How To: ZSCRIPT MENUS?

Postby Nash » Thu Mar 23, 2017 6:56 pm

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...
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

PreviousNext

Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests