View Issue Details

IDProjectCategoryView StatusLast Update
0000289GZDoom (All)[All Projects] Featurepublic2017-02-25 09:22
ReporterNash 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionno change required 
Summary0000289: Scripted way to open menus
DescriptionCurrently, the only way to open a menu is by user intervention (like binding a key to "openmenu MyCustomMenu", or just using the openmenu command in the console).

I'd like to request a scripted way that a modder can control when exactly a specific menu opens.

Very legitimate use cases:

- A custom dialogue/speech menu, user walks up to an NPC, presses +use and the custom menu will appear
- A "keypad password" menu for opening locked doors, the custom menu will only appear if the player actually uses the door
- A "level up" screen that should automatically appear when the player levels up, to distribute his new skill points

The above just wouldn't make sense if the user can simply call them out of context.
TagsNo tags attached.

Relationships

Activities

_mental_

_mental_

2017-02-24 02:56

developer   ~0000734

You can do this with Menu.SetMenu() function:
Menu.SetMenu("SoundOptions", 0);
Nash

Nash

2017-02-24 03:27

reporter   ~0000735

Alright, but how do I get information about what actually activated the menu? In the use case of the "keypad menu", the menu needs to know WHAT exactly to unlock...
_mental_

_mental_

2017-02-24 04:36

developer   ~0000736

Last edited: 2017-02-24 04:36

View 2 revisions

I don't know how menu system will look like in the next release.
However I crafted some lame sample in a few minutes.

menudef.txt:
ListMenu "TestMenu"
{
    Class "TestMenu"
}
zscript.txt:
class TestMenu : ListMenu
{
    Actor invoker;
}

class MenuPistol : Pistol
{
    States
    {
    Fire:
        PISG A 4
        {
            Menu.SetMenu("TestMenu");
            let menu = TestMenu(Menu.GetCurrentMenu());
            menu.invoker = invoker;
            A_Log(menu.invoker.GetClassName());
        }
        Goto Ready;
    }
}

I'm not aware of better way to do so at the moment.



menupistol.pk3 (432 bytes)
Graf Zahl

Graf Zahl

2017-02-24 11:31

administrator   ~0000749

The main problem here is that all the requested use cases require custom network protocol handling and that's unfortunately not that easy to do. Having a menu open is a one-liner function but it's an open invitation to use it wrong.
Nash

Nash

2017-02-25 09:11

reporter   ~0000765

Last edited: 2017-02-25 09:11

View 2 revisions

Graf, you can close this. Case 1 and 3 is already possible with current engine mechanics, and about that keypad thing, I may decide to ditch the idea for my game (too many UIs may be too cumbersome for the player).

Issue History

Date Modified Username Field Change
2017-02-17 11:30 Nash New Issue
2017-02-24 02:56 _mental_ Note Added: 0000734
2017-02-24 03:27 Nash Note Added: 0000735
2017-02-24 04:36 _mental_ File Added: menupistol.pk3
2017-02-24 04:36 _mental_ Note Added: 0000736
2017-02-24 04:36 _mental_ Note Edited: 0000736 View Revisions
2017-02-24 11:31 Graf Zahl Note Added: 0000749
2017-02-25 09:11 Nash Note Added: 0000765
2017-02-25 09:11 Nash Note Edited: 0000765 View Revisions
2017-02-25 09:22 _mental_ Status new => closed
2017-02-25 09:22 _mental_ Resolution open => no change required