EVENT CHANGEMENU: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Created page with "EVENT_CHANGEWEAPON is a game event. This event functions similarly to the cmenu command--in fact, it happens while that command is being processed...."
 
No edit summary
Line 2: Line 2:


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.
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 <code>setvar RETURN -1</code> in this event as it 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.
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.

Revision as of 22:26, 28 October 2012

EVENT_CHANGEWEAPON 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 as it 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.

onevent EVENT_CHANGEMENU
    ifvare RETURN 991 // going forwards
        setvar RETURN 993
    ifvare RETURN 992 // going backwards
        setvar RETURN 990
endevent

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.