From EDukeWiki
Jump to navigation Jump to search

EVENT_CHANGEMENU is a game event.

This event functions similarly to the cmenu command--in fact, it happens while that command is being processed. It is primarily useful in specfic circumstances where you want to skip a menu/screen value, but the design of the source code would cause the screen to be displayed before you could use cmenu in EVENT_DISPLAYMENU, causing the unwanted screen to flash for a split second.

In the event, RETURN is set to the ID number for which a menu change was requested, from any source (the source code, CON, or the console). Changing the value of RETURN will cause your new value to be selected instead. Setting RETURN to any negative number will cancel the change.

During the event's execution, current_menu has not yet been changed.

You should never use a blanket setvar RETURN -1 in this event without any ifvar conditions as that will freeze all menus.

The following example cuts out two of the three Duke 3D v1.5 credits screens. After the first one, the panel order will go directly to the EDuke32 port credits.

    ifvare RETURN 991 // going forwards
        setvar RETURN 993
    ifvare RETURN 992 // going backwards
        setvar RETURN 990

Do not use the cmenu command within this event, as it causes unnecessary recursion and probably won't do what you want.

Remember that working around, hiding, or skipping the EDuke32 port credits (current_menu values 993 and 994) is a violation of the EDuke32 license.