How To: ZSCRIPT MENUS?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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.

How To: ZSCRIPT MENUS?

Postby Major Cooke » Tue Feb 14, 2017 7:49 am

So now that we have shiny new menu options to play with, where do we start?

How will MenuDef interpret 'keywords' for this? I.e. if we have "MyListMenu" which doesn't exactly replace ListMenu, would we use that for MenuDef?
Last edited by Major Cooke on Sat Feb 18, 2017 11:05 am, edited 2 times in total.
User avatar
Major Cooke
The road to Hell is paved in the carrion she leaves behind.
 
Joined: 28 Jan 2007
Discord: Major Cooke#0846

Re: How to do things with the new menu functions?

Postby Nash » Tue Feb 14, 2017 11:11 pm

Graf, can you please provide some barebones basic examples... with no example to follow, no obvious entry points, this feature will go to waste because no one is going to use them...
User avatar
Nash
Nash Muhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia

Re: How to do things with the new menu functions?

Postby Lud » Wed Feb 15, 2017 7:38 am

Give him some time, guys. He just fixed half a page of issues. Patience is what gets things done around here, especially since he's a one-man-army for the most part.
Lud
 
Joined: 11 Feb 2016

Re: How to do things with the new menu functions?

Postby Major Cooke » Wed Feb 15, 2017 10:16 am

Meh fuck it, I might as well try screwing with it and seeing if I can invent a simple slide-me-over-while-highlighted example...
User avatar
Major Cooke
The road to Hell is paved in the carrion she leaves behind.
 
Joined: 28 Jan 2007
Discord: Major Cooke#0846

Re: How to do things with the new menu functions?

Postby Lud » Wed Feb 15, 2017 10:18 am

Don't forget to post results. We're still lacking documentation on the new GetUDMF*** ZScript feature Nash posted about. We're also lacking documentation on how the A_CustomRailgun fire delay works. We need more documentation, guys. I'd happily add it if I knew how the fuck it worked.
Lud
 
Joined: 11 Feb 2016

Re: How to do things with the new menu functions?

Postby Major Cooke » Wed Feb 15, 2017 10:19 am

Lud wrote:Don't forget to post results. We're still lacking documentation on the new GetUDMF*** ZScript feature Nash posted about. We're also lacking documentation on how the A_CustomRailgun fire delay works. We need more documentation, guys. I'd happily add it if I knew how the fuck it worked.


Now you know how I feel.

It hurts.
User avatar
Major Cooke
The road to Hell is paved in the carrion she leaves behind.
 
Joined: 28 Jan 2007
Discord: Major Cooke#0846

Re: How to do things with the new menu functions?

Postby Xaser » Wed Feb 15, 2017 11:39 am

Lud wrote:We're still lacking documentation on the new GetUDMF*** ZScript feature Nash posted about.

"Still lacking."

The feature was added literally less than a day ago. Jesus H. Roosevelt Christ.

While I can understand the frustration in the OP (though from the linked issue, it looks like that was a bug that's since been fixed), the level of impatience on display here is simply cartoonish. Keep in mind that the new menu features have been completed on a bleeding-edge development branch. Docs aren't going to instantaneously materialize, especially when the person in question is a developer who's still actively developing.

[TBH we need a PSA for this in general; we need to get off the devbuilds-are-releases mindset.]
User avatar
Xaser
anarchivist
 
 
 
Joined: 20 Jul 2003

Re: How to do things with the new menu functions?

Postby Major Cooke » Wed Feb 15, 2017 12:07 pm

Xaser wrote:[TBH we need a PSA for this in general; we need to get off the devbuilds-are-releases mindset.]


There already is. Of course I'm bearing this in mind. The problem is, this thing is so vast, when people start asking on how to use it, there will either be documentation immediately or not at all.
User avatar
Major Cooke
The road to Hell is paved in the carrion she leaves behind.
 
Joined: 28 Jan 2007
Discord: Major Cooke#0846

Re: How to do things with the new menu functions?

Postby Xaser » Wed Feb 15, 2017 12:42 pm

Major Cooke wrote:The problem is, this thing is so vast, when people start asking on how to use it, there will either be documentation immediately or not at all.

ZScript itself is evidence against this notion. Remember back when nobody knew how to use that, and we were able to figure it out over time? Literally the exact same thing is happening here.

The part I don't understand is this crazy air of desperation that clouds the thread, like if we don't get tips on how to use the new menus NOW, then the entire system will collapse. I really don't understand where this fear is coming from, especially considering we went through the same process with ZScript as a whole and it seems to be working out. Are we afraid Graf is going to vanish or nefariously withhold info*, leaving us modders in the dust for all eternity? Give it some time for things to settle and we'll have this whole thing sorted out.


[*Well, if we keep acting like frightened children, then he may not want to respond, so consider that perhaps. :P ]
User avatar
Xaser
anarchivist
 
 
 
Joined: 20 Jul 2003

Re: How to do things with the new menu functions?

Postby Major Cooke » Wed Feb 15, 2017 12:49 pm

Okay, the OP was made thinking that the breakage was on purpose, since D4D's upgrade menu is set up on the thin sticks of keyconf and crappy aliases. I admit that had me scared. That's why I had just a tiny bit of rush and need for knowing some basics to start out with.

Changed it.
User avatar
Major Cooke
The road to Hell is paved in the carrion she leaves behind.
 
Joined: 28 Jan 2007
Discord: Major Cooke#0846

Re: How to do things with the new menu functions?

Postby Graf Zahl » Wed Feb 15, 2017 2:25 pm

Granted, the menu system is a bit different, but in the end it's rather simple, I based it all on two concepts already in use by MENUDEF:

1. Every menu can be linked to a class, you can see that best in the load and save menus. They are defined as ListMenus but they only do that to gain the basic menu functionality you need anyway, the only thing of the list menu they actually use is the caption. Once you have set a new menu class and linked it you are free to go to do what you want, The code may still be C++ but it should show you which functions to override to implement a menu that'S completely independent of the widget system.

2. For adding new widgets you have to follow a simple naming convention (ListMenuItemXYZ or OptionMenuItemXYZ) and then can use it in MENUDEF as a new type 'XYZ params' where the params are directly deduced from the class's Init function's prototype, including optional values. Just have a look at the existing types and look how they get accessed.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: How to do things with the new menu functions?

Postby Major Cooke » Wed Feb 15, 2017 7:18 pm

Graf, how is Font.FindFontColor supposed to work?
Because this doesn't work:

TEXTCOLO
Code: Select allExpand view
Yellow
{
   #272727  #515151    0  64
   #784918  #F3A718   65 207
   #F3A82A  #FCD043  208 256
Console:
   #000000  #7F7F00    0 127
   #FFFF00  #FFFFFF  128 256
Flat:
   #EEEE33
}


MENUDEF
Code: Select allExpand view
OptionMenu "OptionsMenu"
{
   Title "$OPTMNU_TITLE"
   SubMenuColor "$OPTMNU_CONTROLS",         "CustomizeControls"
   SubMenuColor "$OPTMNU_MOUSE",         "MouseOptions"
   SubMenuColor "$OPTMNU_JOYSTICK",         "JoystickOptions"
   StaticText " "
   SubMenuColor "$OPTMNU_PLAYER",         "PlayerMenu"
   SubMenuColor "$OPTMNU_GAMEPLAY",         "GameplayOptions"
   SubMenuColor "$OPTMNU_COMPATIBILITY",   "CompatibilityOptions"
   SubMenuColor "$OPTMNU_AUTOMAP",         "AutomapOptions"
   SubMenuColor "$OPTMNU_HUD",            "HUDOptions"
   SubMenuColor "$OPTMNU_MISCELLANEOUS",   "MiscOptions"
   SubMenuColor "$OPTMNU_NETWORK",         "NetworkOptions"
   SubMenuColor "$OPTMNU_SOUND",         "SoundOptions"
   SubMenuColor "$OPTMNU_DISPLAY",         "VideoOptions"
   SubMenuColor "$OPTMNU_VIDEO",         "VideoModeMenu"
   StaticText " "
   SafeCommand "$OPTMNU_DEFAULTS",   "reset2defaults"
   SafeCommand   "$OPTMNU_RESETTOSAVED",   "reset2saved"
   Command "$OPTMNU_CONSOLE",         "menuconsole"
}


ZScript
Code: Select allExpand view
Class OptionMenuItemSubMenuColor : OptionMenuItemSubMenu
{
    bool isSelected;
    
    Color selColor
;
    
    OptionMenuItemSubmenuColor Init
(String label, Name command, int param = 0)
    {
        Super.init(label, command);
        mParam = param;
        return self;
    }
    
    override int Draw
(OptionMenuDescriptor desc, int y, int indent, bool selected)
    {
        isSelected = selected;
        int t = Font.FindFontColor("Yellow"); //<---------------------------------------------------------------------------------------------------------------------
        drawLabel(indent, y, selected ? t : OptionMenuSettings.mFontColorMore);
        return indent;
    }
}


It just returns untranslated instead of turning yellow.
User avatar
Major Cooke
The road to Hell is paved in the carrion she leaves behind.
 
Joined: 28 Jan 2007
Discord: Major Cooke#0846

Re: How to do things with the new menu functions?

Postby Kinsie » Thu Feb 16, 2017 12:57 am

Major Cooke wrote:The problem is, this thing is so vast, when people start asking on how to use it, there will either be documentation immediately or not at all.
How times change.
User avatar
Kinsie
A Concept Utterly Obsolete
 
Joined: 22 Oct 2004
Location: MAP33
Discord: Find Me...
Twitch ID: thekinsie

Re: How to do things with the new menu functions?

Postby Player701 » Thu Feb 16, 2017 4:56 am

Considering that the question I asked in the ZScript discussion thread has probably been overlooked, and also since this looks like a good place to ask such questions, I will repeat it here:
Player701 wrote:Last time I checked - was long ago, maybe things have changed since then? - MENUDEF could only be used to replace the existing menu setup, not to extend it. Therefore, it was impossible to play with two mods which defined their own menus and wanted them to be accessible from the main menu - one of them would always override the other. Has it indeed changed or is ZScript going to make it possible at last?

(edit) If you don't understand what I mean, compare to how UT2004 handles mutator options. Each mutator can get its own menu section on the mutator configuration tab, or even a separate openable window, complete with any GUI elements the developer would like to have. I was hoping ZDoom would eventually get a kind of a "Mod Menu" extendable via a ZScript API, which would allow a mod to add its subsection(s) there for easy configuration. What's important here is that different subsections wouldn't conflict with each other if there was more than one mod active.

Sorry if this has been answered somewhere already, but I couldn't find any information on this particular aspect of the menu system. I apologize for reposting, just thought it'd help my question to not get lost in the endless stream of messages which is exactly how I would describe the main ZScript thread in its current state. :oops:
User avatar
Player701
You are now breathing manually.
 
Joined: 13 May 2009
Location: Russian Federation
Discord: Player701#8214

Re: How to do things with the new menu functions?

Postby Nash » Thu Feb 16, 2017 8:49 am

Why is this MENUDEF crashing the game on startup? This used to work before I pull in the new scripted menus.

EDIT: The "JoystickOptions" block at line 247 is causing the crash. I can remove this block no problem; but I may not the only person who - due to lack of documentation or proper consultation - may have just pasted the entire contents of ZDoom's MENUDEF into their own mod, and then only made cosmetic changes here and there.

Player701's concern about true modularity in the menu system may be worth discussing. I'm sure modders just resorted to pasting the entire contents of the stock MENUDEF because it isn't as modular as, say, DECORATE (not additive).
Attachments
menudef.txt
(22.52 KiB) Downloaded 67 times
User avatar
Nash
Nash Muhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia

Next

Return to Scripting

Who is online

Users browsing this forum: Collegia Titanica and 2 guests