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: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
How To: ZSCRIPT MENUS?
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?
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 10:05 am, edited 2 times in total.
-
-
- Posts: 17465
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: How to do things with the new menu functions?
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...
-
- Posts: 2383
- Joined: Thu Feb 11, 2016 9:59 am
Re: How to do things with the new menu functions?
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.
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: How to do things with the new menu functions?
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...
-
- Posts: 2383
- Joined: Thu Feb 11, 2016 9:59 am
Re: How to do things with the new menu functions?
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.
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: How to do things with the new menu functions?
Now you know how I feel.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.
It hurts.
-
-
- Posts: 10773
- Joined: Sun Jul 20, 2003 12:15 pm
Re: How to do things with the new menu functions?
"Still lacking."Lud wrote:We're still lacking documentation on the new GetUDMF*** ZScript feature Nash posted about.
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.]
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: How to do things with the new menu functions?
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.Xaser wrote:[TBH we need a PSA for this in general; we need to get off the devbuilds-are-releases mindset.]
-
-
- Posts: 10773
- Joined: Sun Jul 20, 2003 12:15 pm
Re: How to do things with the new menu functions?
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.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.
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. ]
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: How to do things with the new menu functions?
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.
Changed it.
-
- Lead GZDoom+Raze Developer
- Posts: 49179
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: How to do things with the new menu functions?
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.
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.
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: How to do things with the new menu functions?
Graf, how is Font.FindFontColor supposed to work?
Because this doesn't work:
TEXTCOLO
MENUDEF
ZScript
It just returns untranslated instead of turning yellow.
Because this doesn't work:
TEXTCOLO
Code: Select all
Yellow
{
#272727 #515151 0 64
#784918 #F3A718 65 207
#F3A82A #FCD043 208 256
Console:
#000000 #7F7F00 0 127
#FFFF00 #FFFFFF 128 256
Flat:
#EEEE33
}
Code: Select all
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"
}
Code: Select all
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;
}
}
-
- Posts: 7402
- Joined: Fri Oct 22, 2004 9:22 am
- Graphics Processor: nVidia with Vulkan support
- Location: MAP33
Re: How to do things with the new menu functions?
How times change.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.
-
-
- Posts: 1651
- Joined: Wed May 13, 2009 3:15 am
- Graphics Processor: nVidia with Vulkan support
Re: How to do things with the new menu functions?
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:
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.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.
-
-
- Posts: 17465
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: How to do things with the new menu functions?
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).
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).
You do not have the required permissions to view the files attached to this post.