[SOLVED - ZS] Menus - Getting the Currently Selected Option

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
Posts: 551
Joined: Wed Sep 06, 2006 12:36 pm
Preferred Pronouns: She/Her
Operating System Version (Optional): Debian 11 (bullseye), Windows 10
Location: Middle of Nowheresville Il.

[SOLVED - ZS] Menus - Getting the Currently Selected Option

Post by Sarah »

So I modified m8f's Tips for Menus mod to work with Option Menus. Currently it works exactly the same, it picks from a random string and prints it at the bottom right of the screen when the menu is opened.

What I'd like it to do is show a different string depending on what option in the parent menu is highlighted. Is there a way to get an index number of the currently highlighted option, or something along those lines?
Spoiler: MENUDEF if interested
Spoiler: Menu ZScript
Lastly @m8f, I will clean up the current ZScript and incorporate it back into your mod and send it to you if you want - might be able to set up some other options too - let me know what you want me to do.

Very much solved. Thank you AFADoomer for the quick response, that was exactly what I needed.

Also I'd like to make the fruits of my labor available. They, yes they for they are two, come in two flavors, Tips with Options, and Tooltips. What's the difference? Tips with Options is m8f's Tips for Menus mod with the addition of a class for Option Menus. Works exactly the same as m8f's original code, for a demo just open up the Options Menu.

Tooltips is what I was trying to accomplish here. I want text to appear in the lower right hand corner of the screen with information on the current thing I have selected in a menu. Tooltips is about 95% m8f's code, 1% mine, and 4% further head trauma as I banged my head on the keyboard getting it to work. So it's my gift to m8f and the community and you can find more info about both of these mods to the mod over at the mod thread, which I will be making a post at shortly to give info and links.

Please let me know if you have any problems downloading the files from my Google Drive - I probably borked the share settings.
Last edited by Sarah on Mon Apr 27, 2020 12:02 am, edited 2 times in total.
User avatar
Posts: 1313
Joined: Tue Jul 15, 2003 4:18 pm

Re: [ZScript] Menus - Getting the Currently Selected Option

Post by AFADoomer »

OptionMenuDescriptor has a mSelectedItem variable that you should be able to use.

Return to “Scripting”