EVENT NEWGAMECUSTOM: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Documentation for NEWGAMECUSTOM
 
mNo edit summary
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
EVENT_NEWGAMECUSTOM is a [[EDuke32 event list|Game Event]].
{{EventTable|1=EVENT_NEWGAMECUSTOM|2=[[myconnectindex]]|3=-1|4=4 values}}


This [[event]] is fired when a new game is started over the ''MENU_NEWGAMECUSTOM'' and ''MENU_NEWGAMECUSTOMSUB'' menus, as defined through '''DEF''' scripting, see [[DEF_Language#newgamechoices| newgamechoices]].
EVENT_NEWGAMECUSTOM is a [[EDuke32 event list|Menu Event]].


It serves to define the logic using which the player is sent to the proper volume and level upon selecting a menu entry. The indices of the selected menu entries are hereby stored in the '''userdef.return''' array, where the entry at index 0 corresponding to the choice in the top-layer menu, and the entry at index 1 corresponding to the submenu choice. The latter is set to -1 if no submenu exists.
This [[event]] is fired when a menu entry is selected in the ''MENU_NEWGAMECUSTOM'' and ''MENU_NEWGAMECUSTOMSUB'' menus, as defined through '''DEF''', see [[Newgamechoices_(DEF)| newgamechoices]].


'''Example:''' The following example corresponds to the example given in [[DEF_Language#newgamechoices]] and defines the logic to send the player to the proper level.
It serves to define the logic using which the player is sent to the proper volume and level upon selecting a menu entry.
 
The indices of the selected menu entries are stored in the '''userdef.return''' array.
 
The RETURN variable, i.e. the entry at index 0 corresponds to the choice in the top-layer menu, while the entry at index 1 corresponds to the submenu choice. The third layer submenu is accessed at index 2. If no submenu is defined, return is set to -1 instead.
 
== Return Values ==
 
:; userdef.return 0
:: Same as RETURN. Contains the menu entry ID of the first-layer selection.
 
:; userdef.return 1
:: Contains the menu entry ID of the second-layer selection. If no second layer exists, set to -1.
 
:; userdef.return 2
:: Contains the menu entry ID of the third-layer selection. If no third layer exists, set to -1.
 
:; userdef.return 3
:: Set to -1.
 
== Usage Example ==
 
The following example corresponds to the example given in [[Newgamechoices_(DEF)]] and defines the logic to send the player to the proper level.


  appendevent EVENT_NEWGAMECUSTOM
  appendevent EVENT_NEWGAMECUSTOM

Latest revision as of 08:33, 4 February 2022

Event ID player# THISACTOR RETURN
EVENT_NEWGAMECUSTOM myconnectindex -1 4 values

EVENT_NEWGAMECUSTOM is a Menu Event.

This event is fired when a menu entry is selected in the MENU_NEWGAMECUSTOM and MENU_NEWGAMECUSTOMSUB menus, as defined through DEF, see newgamechoices.

It serves to define the logic using which the player is sent to the proper volume and level upon selecting a menu entry.

The indices of the selected menu entries are stored in the userdef.return array.

The RETURN variable, i.e. the entry at index 0 corresponds to the choice in the top-layer menu, while the entry at index 1 corresponds to the submenu choice. The third layer submenu is accessed at index 2. If no submenu is defined, return is set to -1 instead.

Return Values

userdef.return 0
Same as RETURN. Contains the menu entry ID of the first-layer selection.
userdef.return 1
Contains the menu entry ID of the second-layer selection. If no second layer exists, set to -1.
userdef.return 2
Contains the menu entry ID of the third-layer selection. If no third layer exists, set to -1.
userdef.return 3
Set to -1.

Usage Example

The following example corresponds to the example given in Newgamechoices_(DEF) and defines the logic to send the player to the proper level.

appendevent EVENT_NEWGAMECUSTOM
   ife userdef.return 1 -1 // Case: no submenu
   {
       switch userdef.return 0
       case 1 setu[].m_volume_number 1 break // Lunar Apocalypse
       case 2 setu[].m_volume_number 2 break // Shrapnel City
       case 3 setu[].m_volume_number 3 break // The Birth
       default setu[].m_volume_number 0 break
       endswitch
       setu[].m_level_number 0 
   }
   else ife userdef.return 0 0 // Case: submenu at position 0 (L.A. Meltdown)
   {
       setu[].m_volume_number 0
       switch userdef.return 1
       case 0 setu[].m_level_number 0 break // Hollywood Holocaust
       case 1 setu[].m_level_number 1 break // Red Light District
       case 2 setu[].m_level_number 2 break // Death Row
       case 3 setu[].m_level_number 3 break // Toxic Dump
       case 4 setu[].m_level_number 4 break // The Abyss
       default setu[].m_level_number 0 break
       endswitch
   }
endevent