### artfile DEF command examples Source: https://wiki.eduke32.com/wiki/Artfile_%28DEF%29 Two examples of the artfile DEF command. The first loads an ART file with its default starting tile number. The second overrides the starting tile number with the tile sub-token, useful when the ART file's internal tilestart is not desired. ```text artfile { file "whatever.art" } // loads whatever.art just as if it had been named TILES020.ART ``` ```text artfile { file "whatever.art" tile 2000 } // loads whatever.art starting at index 2000 instead of the tilestart value contained within it ``` -------------------------------- ### Install build toolchain packages Source: https://wiki.eduke32.com/wiki/Building_EDuke32_on_Windows Install the necessary toolchains for building EDuke32. ```bash pacman -S --needed --noconfirm mingw-w64-{i686,x86_64,ucrt-x86_64,clang-x86_64}-toolchain make nasm yasm ``` -------------------------------- ### DMFLAGS GameVar Examples Source: https://wiki.eduke32.com/wiki/NetDuke32 Examples for checking and setting DMFlags. ```text ifvarand DMFLAGS 4 { spawn LIZTROOP } orvar DMFLAGS 256 ``` -------------------------------- ### EDuke32 qsprintf example with gamevar and quote placeholders Source: https://wiki.eduke32.com/wiki/Qsprintf Shows how to use qsprintf to replace %d with a gamevar and %s with quotes. The example defines placeholder quotes, uses getplayer to get the player's kill count, redefines a quote with %d, calls qsprintf to substitute the variable, and prints it with gametext. It also demonstrates using %s placeholders with two quotes and printing the result with quote. ```eduke32 gamevar TEMP 0 1 definequote 254 PLACEHOLDER definequote 7 WASTED! definequote 12 USED STEROIDS onevent EVENT_DISPLAYREST getplayer[THISACTOR].actors_killed TEMP // Get the number of kills the player has redefinequote 254 ALIENS KILLED: %d // Redefine a placeholder quote **qsprintf** 254 254 TEMP // Place our variable into the %d string gametext STARTALPHANUM 10 10 254 0 0 0 ZERO ZERO xdim ydim // And print to the upper left! redefinequote 254 %s! %s **qsprintf** 254 254 12 7 quote 254 // print: "USED STEROIDS! WASTED!" endevent ``` -------------------------------- ### Install version control packages Source: https://wiki.eduke32.com/wiki/Building_EDuke32_on_Windows Install Subversion and Git for use within the MSYS2 shell. ```bash pacman -S --needed --noconfirm subversion git ``` -------------------------------- ### Install Clang compiler packages Source: https://wiki.eduke32.com/wiki/Building_EDuke32_on_Windows Install Clang and LLD as additional compiler options. ```bash pacman -S --needed --noconfirm mingw-w64-{x86_64,ucrt-x86_64,clang-x86_64}-{clang,lld} ``` -------------------------------- ### Install EDuke32 via CLI Source: https://wiki.eduke32.com/wiki/APT_repository Update your package list and install the eduke32 package. ```bash sudo apt-get update sudo apt-get install eduke32 ``` -------------------------------- ### Vaca+ profile example with multiple sub-profiles Source: https://wiki.eduke32.com/wiki/E32_Profiles The example shows a base profile with several sub-profiles, each using 'tie' or 'depend' to create dependencies, and nesting of sub-profiles within sub-profiles. ```profile profile { name { proper "Duke Caribbean: Life’s A Beach Plus" reference "vaca_plus" } base game "duke3d" version 4.0 commands { dir "vaca_plus" grp "vacation.grp" con_module "Vacation.con" def_module "Vacation.def" } profile { name { proper "Caribbean Duke Plus Extension" reference "vaca_plus_dp" } commands { con_module "VacaDP.con" def_module "VacaDP.def" } tie "dukeplus" } profile { name { proper "Caribbean XXX" reference "vaca_plus_xxx" } commands { con_module "VacaXXX.con" def_module "VacaXXX.def" } depend "xxx_pack" } profile { name { proper "Duke Caribbean: Life’s A Beach HRP" reference "vaca_plus_hrp" } commands { def_module "vacation_hrp.def" } // depend "vaca_plus" // not needed as it is a sub-profile tie "duke3d_hrp" profile { name { proper "Caribbean HRP XXX" reference "vaca_plus_hrp_xxx" } commands { def_module "vacation_hrp_xxx.def" } depend "vaca_plus_xxx" } } } ``` -------------------------------- ### Profile syntax: basic and sub-profile example Source: https://wiki.eduke32.com/wiki/E32_Profiles The first example shows a profile with nested sub-profile using the 'profile' block, and an alternative method using the 'depend' attribute. Demonstrates both syntaxes for defining sub-profiles. ```profile profile { name { proper "Name of Profile" reference "profile1" } version 1.0 game "global" commands { con_module "con_module.con" def_module "def_module.def" } profile { name { proper "Sub-Profile" reference "profile1_1" } // etc... } } // alternate method of defining sub-profile: profile { name { name "Sub-Profile 2" reference "profile1_2" } depend "profile1" // note how the first use of depend here makes it a sub-profile } ``` -------------------------------- ### Console Output for Event Chaining Example Source: https://wiki.eduke32.com/wiki/Event The resulting console output when starting a level, showing the execution order of the defined events. ```text -2 -1 0 1 2 ``` -------------------------------- ### Three-Player Hosted Game Launch Source: https://wiki.eduke32.com/wiki/Command_line_options Example commands for hosting and joining a three-player game session. ```bash voidsw -net -n0:3 voidsw -net -n0 host1 voidsw -net -n0 host1 ``` -------------------------------- ### Example Use of -autonet Source: https://wiki.eduke32.com/wiki/Command_line_options An example of the -autonet parameter with 10 comma-separated arguments. ```bash -autonet 0,0,1,1,1,0,3,2,1,1 ``` -------------------------------- ### Install SDL Wii libraries Source: https://wiki.eduke32.com/wiki/EDuke32_Wii Command to install the compiled SDL Wii libraries into the devkitPPC folder. ```bash make install ``` -------------------------------- ### Install build dependencies via Homebrew Source: https://wiki.eduke32.com/wiki/Building_EDuke32_on_macOS Installs the required build tools and libraries using Homebrew. Requires Xcode command line utilities to be installed first. ```bash brew install make sdl2 flac libvpx ``` -------------------------------- ### gametext usage example with variable setup Source: https://wiki.eduke32.com/wiki/Gametextz Example of using gametext to print a quote. It sets variables for position, shade, palette, tile number, orientation, and a quote, then calls gametext. The comment notes that x=320 centers text and that the quote uses ^10 to tint 'red' red. This command only works during events. ```eduke32 setvar x 320 // "x=320" centers text setvar y 100 setvar shade 0 setvar pal 0 setvar tilenum STARTALPHANUM setvar orientation 26 setvar TEMP 100 redefinequote TEMP This is ^10red // tints the word "red", 10 is red. gametext tilenum x y TEMP shade pal orientation ZERO ZERO xdim ydim ``` -------------------------------- ### Install build dependencies on Debian/Ubuntu Source: https://wiki.eduke32.com/wiki/Building_EDuke32_on_Linux Installs the required development packages for building EDuke32 on Debian or Ubuntu, including build-essential, nasm, SDL2, OpenGL, FLAC, VPX, GTK2, and freepats. ```bash sudo apt-get install build-essential nasm libgl1-mesa-dev libsdl2-dev flac libflac-dev libvpx-dev libgtk2.0-dev freepats ``` -------------------------------- ### Install development tools group on Fedora 44 Source: https://wiki.eduke32.com/wiki/Building_EDuke32_on_Linux Installs the basic development tools group on Fedora 44 using dnf. ```bash sudo dnf group install "development-tools" ``` -------------------------------- ### Load a shade table with 32 steps Source: https://wiki.eduke32.com/wiki/Palookup_%28DEF%29 This example demonstrates the basic syntax for loading a shade table using the palookup command. ```DEF palookup 0 { raw { file "shade.raw" } } ``` -------------------------------- ### EVENT_VALIDATESTART implementation for Ion Fury Source: https://wiki.eduke32.com/wiki/EVENT_VALIDATESTART This example demonstrates how to adjust the level number for invalidated save loads in Ion Fury to ensure the player starts at the correct map. ```CON // Code by Jonathan Strander, Fox Martins, Richard Gobeille, and Evan Ramos // All code as written belongs to Voidpoint and the respective authors. // (c) 2019 Voidpoint, LLC appendevent EVENT_VALIDATESTART ife userdef .return 0 EP_PREVIEW { switch userdef .return 1 case 1 setu .return 1 0 break case 3 case 4 setu .return 1 2 break endswitch } endevent ``` -------------------------------- ### myos command example Source: https://wiki.eduke32.com/wiki/Myos Sets variables and calls myos with the specified parameters, including orientation 1 for transparency. ```EDukeScript setvar x 30 setvar y 30 setvar tilenum 3350 setvar shade 0 setvar orientation 1 // transparency **myos** x y tilenum shade orientation ``` -------------------------------- ### Install build dependencies on Fedora 44 Source: https://wiki.eduke32.com/wiki/Building_EDuke32_on_Linux Installs the required development packages for building EDuke32 on Fedora 44, including g++, nasm, OpenGL, SDL2, ALSA, VPX, GTK2, and FLAC. Note that freepats is not packaged in Fedora and must be installed separately. ```bash sudo dnf install g++ nasm mesa-libGL-devel SDL2-devel alsa-lib-devel libvpx-devel gtk2-devel flac flac-devel ``` -------------------------------- ### Precache command usage Source: https://wiki.eduke32.com/wiki/Precache Example of using the precache command to load tiles #1 through #10 unconditionally. ```text precache 0001 0010 1 ``` -------------------------------- ### Set PATH for MinGW-w64 Source: https://wiki.eduke32.com/wiki/Building_EDuke32_on_Windows Example command to prepend the MinGW-w64 bin directory to the current session's PATH variable. ```batch set PATH=C:\MinGW-w64\mingw64\bin;%PATH% ``` -------------------------------- ### Useractor Example with Conditional Logic Source: https://wiki.eduke32.com/wiki/Actor A practical example defining an actor with the notenemy type and using ifpdistl to trigger a palfrom effect when the player is within a specific distance. ```CON define MYACTOR 3585 **useractor** notenemy MYACTOR 0 ifpdistl 1024 { palfrom 32 0 16 0 } enda ``` -------------------------------- ### settiledata example with gettiledata and SFLAG_BADGUYSTAYPUT Source: https://wiki.eduke32.com/wiki/Settiledata Shows how to read a gameflags value with gettiledata, set the SFLAG_BADGUYSTAYPUT flag, and write it back with settiledata. The example uses THISACTOR as the tile ID and the gameflags member. ```eduke32 gettiledata[THISACTOR].gameflags temp or temp SFLAG_BADGUYSTAYPUT settiledata[THISACTOR].gameflags temp ``` -------------------------------- ### Performance profiling example using getticks to compare loop orders Source: https://wiki.eduke32.com/wiki/Getticks Measures the time taken to loop from 0 to NUMWALLS-1 versus from NUMWALLS-1 to 0. The example defines two states (process_normal and process_backward) and uses getticks before and after each state to log the elapsed time. The output shows that reverse order is faster. ```CON gamevar i 0 0 gamevar j 0 0 // Loop from 0 to NUMWALLS-1 state process_normal setvar j 0 whilevarn j 1000 { setvar i 0 whilevarvarn i NUMWALLS { addvar i 1 } addvar j 1 } ends // Loop from NUMWALLS-1 to 0 state process_backward setvar j 0 whilevarn j 1000 { setvarvar i NUMWALLS subvar i 1 whilevarn i -1 { subvar i 1 } addvar j 1 } ends onevent EVENT_ENTERLEVEL gamevar val1 0 0 gamevar val2 0 0 addlogvar NUMWALLS getticks val1 state process_normal getticks val2 subvarvar val2 val1 addlogvar val2 getticks val1 state process_backward getticks val2 subvarvar val2 val1 addlogvar val2 endevent /* output CONLOGVAR: L=1266 NUMWALLS (read-only) (Global) =14793 CONLOGVAR: L=1272 val2 (Global) =1628 // normal CONLOGVAR: L=1278 val2 (Global) =1285 // reverse It shows how that processing in reverse order is faster. */ ``` -------------------------------- ### Defineprojectile example with RPG-like behavior Source: https://wiki.eduke32.com/wiki/Defineprojectile Example of a working user-defined projectile using the defineprojectile command. The projectile has WORKSLIKE flags PROJECTILE_FLAG_NOAIM, PROJECTILE_FLAG_LOSESVELOCITY, PROJECTILE_FLAG_RPG, and PROJECTILE_FLAG_BOUNCESOFFWALLS, resulting in an RPG-like projectile that fires in an arc, slows down during flight, and bounces off walls. ```text defineprojectile 1653 PROJ_WORKSLIKE 6150 defineprojectile 1653 PROJ_SPAWNS EXPLOSION2 defineprojectile 1653 PROJ_VEL 1000 defineprojectile 1653 PROJ_EXTRA 300 defineprojectile 1653 PROJ_DROP -200 defineprojectile 1653 PROJ_ISOUND PIPEBOMB_EXPLODE defineprojectile 1653 PROJ_HITRADIUS 2560 defineprojectile 1653 PROJ_BOUNCES 5 defineprojectile 1653 PROJ_OFFSET 224 defineprojectile 1653 PROJ_CLIPDIST 24 defineprojectile 1653 PROJ_TRAIL SMALLSMOKE ``` -------------------------------- ### Get and set structure member syntax Source: https://wiki.eduke32.com/wiki/Getactor Shows the syntax for get and set commands used to access structure members. The get command fetches a member into a gamevar, while the set command assigns a value to the member. The can be omitted to imply THISACTOR. ```eduke32 con get[]. set[]. ``` -------------------------------- ### betaname command example Source: https://wiki.eduke32.com/wiki/Betaname Commented-out example of the obsolete betaname command found in a leaked pre-1.0 prototype of the shareware version of Duke Nukem 3D. The command is deprecated and not recommended for use. ```plaintext // betaname John Doe (214) xxx-yyyy ``` -------------------------------- ### Gamevar arithmetic operations example Source: https://wiki.eduke32.com/wiki/Add Demonstrates initializing a global gamevar and performing sequential arithmetic operations including assignment, addition, and multiplication. ```CON var temp 0 0 // initialize a global variable with initial value 0 set temp 1 // assigns a value of 1 to the gamevar _temp_. add temp 1 // adds 1 to _temp_, causing its value to become 2. mul temp 2 // multiplies _temp_ by 2, causing its value to become 4. ``` -------------------------------- ### Quick access example: userdef[].executions Source: https://wiki.eduke32.com/wiki/Category%3AStructure_access Shows quick access to a struct member in a condition. The example checks if the userdef executions member is 10000 and then redefines and echoes quote 117. Quick access is read-only; using a gamevar-writing command on it causes a compiler error. ```CON ifvarg userdef[].executions 10000 { redefinequote 117 You have way too much time on your hands. echo 117 } ``` -------------------------------- ### Maphack file (*.mhk) header and sprite angoff example Source: https://wiki.eduke32.com/wiki/Maphack_Language Example maphack file (*.mhk) showing header comments and a sprite angoff line. Demonstrates the format for maphack files used with the Duke Nukem 3D High Resolution Pack. ```unknown // Maphacks for the Duke Nukem 3D High Resolution Pack (HRP) // Title : Hollywood Holocaust // Author : Allen H. Blum III // Filename : E1L1.MAP // mapmd4 : a1ce0037911b2625781a2623588c8b90 // 1996-12-11 (Atomic GRP) // Curr. HRP: r5.4.726 sprite 79 angoff 1024 // tile0026 heavyhbomb (multiplayer) ``` -------------------------------- ### Event Chaining Example with onevent and appendevent Source: https://wiki.eduke32.com/wiki/Event Demonstrates the execution order of multiple EVENT_ENTERLEVEL definitions using both onevent and appendevent. ```CON definequote 666 placeholder appendevent EVENT_ENTERLEVEL redefinequote 666 0 echo 666 endevent appendevent EVENT_ENTERLEVEL redefinequote 666 1 echo 666 endevent onevent EVENT_ENTERLEVEL redefinequote 666 -1 echo 666 endevent appendevent EVENT_ENTERLEVEL redefinequote 666 2 echo 666 endevent onevent EVENT_ENTERLEVEL redefinequote 666 -2 echo 666 endevent ``` -------------------------------- ### Basic rotatesprite usage Source: https://wiki.eduke32.com/wiki/Rotatesprite Example of setting up variables and calling the rotatesprite command to draw a sprite. ```EDuke32 Script setvar x 164 setvar y 176 setvar z 65536 setvar ang 0 setvar tilenum RPGGUN setvar shade 0 setvar pal 0 setvar orientation 0 **rotatesprite** x y z ang tilenum shade pal orientation windowx1 windowy1 windowx2 windowy2 ``` -------------------------------- ### Define music mappings Source: https://wiki.eduke32.com/wiki/Music_%28DEF%29 Examples of mapping game identifiers to audio files using the music command. ```text music { id "E1L1" file "stalker1.ogg" } music { id "intro" file "grabbag.ogg" } music { id "briefing" file "briefing.ogg" } music { id "loading" file "menusng2.flac" } ``` -------------------------------- ### Basic sound definition Source: https://wiki.eduke32.com/wiki/Sound_%28DEF%29 Example of defining a sound replacement using the sound command with an ID and a filename. ```DEF sound { id "249" file "bonus.ogg" } ``` -------------------------------- ### Reference for external dependency packages Source: https://wiki.eduke32.com/wiki/Building_EDuke32_on_Windows Reference commands for installing external dependencies, though these are typically included as prebuilt static libraries in the source. ```bash pacman -S --needed --noconfirm `pacman -Ssq sdl` `pacman -Ssq flac` `pacman -Ssq libvpx` ``` -------------------------------- ### Contextual Placement for SUSHIPLATE99 Source: https://wiki.eduke32.com/wiki/Confaq42 Example of where to place the define statement within the existing defs.con structure. ```CON define MASKWALL13 830 define HURTRAIL 859 ``` -------------------------------- ### Gamevar operator example: set, add, mul Source: https://wiki.eduke32.com/wiki/Addvarvar Shows the modern syntax for binary operators on gamevars, where the operator is written without the deprecated var or varvar suffix and accepts either a constant or a gamevar as the second argument. The example initializes a global variable with var, then uses set, add, and mul to assign, increment, and multiply its value. ```CON var temp 0 0 // initialize a global variable with initial value 0 set temp 1 // assigns a value of 1 to the gamevar _temp_. add temp 1 // adds 1 to _temp_, causing its value to become 2. mul temp 2 // multiplies _temp_ by 2, causing its value to become 4. ``` -------------------------------- ### Reuse code with defstate Source: https://wiki.eduke32.com/wiki/Defstate An example showing how to define a spawnblood state and call it from multiple useractor definitions. ```EDuke32 define MYACTOR1 3585 define MYACTOR2 3586 define MYACTOR3 3587 defstate spawnblood ifhitweapon { guts JIBS6 12 spawn BLOODPOOL killit } ends useractor notenemy MYACTOR1 2 state spawnblood enda useractor notenemy MYACTOR2 2 state spawnblood enda useractor notenemy MYACTOR3 2 state spawnblood enda ``` -------------------------------- ### Define EVENT_NEWGAMECUSTOM logic Source: https://wiki.eduke32.com/wiki/EVENT_NEWGAMECUSTOM This example demonstrates how to handle menu selections by checking userdef.return values to set the appropriate volume and level numbers for the game. ```EDuke32 Script 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 ``` -------------------------------- ### Embed a small view near the top left Source: https://wiki.eduke32.com/wiki/Showviewq16 Example script to retrieve player data and render a small sub-viewport. ```text getplayer[THISACTOR].posx x getplayer[THISACTOR].posy y getplayer[THISACTOR].posz z getplayer[THISACTOR].ang ang getplayer[THISACTOR].horiz horiz getplayer[THISACTOR].horizoff temp addvarvar horiz temp updatesectorz x y z sect showviewunbiased x y z ang horiz sect 16 8 56 39 ``` -------------------------------- ### Define BIGALPHANUM character mapping Source: https://wiki.eduke32.com/wiki/Tilefont_%28DEF%29 This example configures the BIGALPHANUM tilenum (2940) to display characters using the tilenums starting from 2822. ```DEF tilefont 2940 { chr "!" 2822 // chr """ 2823 chr "#" 2824 chr "$" 2825 chr "%" 2826 chr "&" 2827 chr "'" 2828 chr "(" 2829 chr ")" 2830 chr "*" 2831 chr "+" 2832 chr "," 2833 chr "-" 2834 chr "." 2835 chr "/" 2836 chr "0" 2837 chr "1" 2838 chr "2" 2839 chr "3" 2840 chr "4" 2841 chr "5" 2842 chr "6" 2843 chr "7" 2844 chr "8" 2845 chr "9" 2846 chr ":" 2847 chr ";" 2848 chr "<" 2849 chr "=" 2850 chr ">" 2851 chr "?" 2852 chr "@" 2853 chr "A" 2854 chr "B" 2855 chr "C" 2856 chr "D" 2857 chr "E" 2858 chr "F" 2859 chr "G" 2860 chr "H" 2861 chr "I" 2862 chr "J" 2863 chr "K" 2864 chr "L" 2865 chr "M" 2866 chr "N" 2867 chr "O" 2868 chr "P" 2869 chr "Q" 2870 chr "R" 2871 chr "S" 2872 chr "T" 2873 chr "U" 2874 chr "V" 2875 chr "W" 2876 chr "X" 2877 chr "Y" 2878 chr "Z" 2879 chr "[" 2880 // chr "\" 2881 chr "]" 2882 chr "^" 2883 chr "_" 2884 chr "`" 2885 chr "a" 2886 chr "b" 2887 chr "c" 2888 chr "d" 2889 chr "e" 2890 chr "f" 2891 chr "g" 2892 chr "h" 2893 chr "i" 2894 chr "j" 2895 chr "k" 2896 chr "l" 2897 chr "m" 2898 chr "n" 2899 chr "o" 2900 chr "p" 2901 chr "q" 2902 chr "r" 2903 chr "s" 2904 chr "t" 2905 chr "u" 2906 chr "v" 2907 chr "w" 2908 chr "x" 2909 chr "y" 2910 chr "z" 2911 chr "{" 2912 chr "|" 2913 chr "}" 2914 chr "~" 2915 } ``` -------------------------------- ### Get floor Z coordinate with getflorzofslope Source: https://wiki.eduke32.com/wiki/Getflorzofslope Example usage of getflorzofslope in conjunction with updatesectorz to determine the floor height at an actor's current position. ```EDuke32 getactor[THISACTOR].x x getactor[THISACTOR].y y getactor[THISACTOR].z z updatesectorz x y z temp getflorzofslope temp x y temp2 ``` -------------------------------- ### Detecting MasterSwitch motion with EVENT_KILLIT Source: https://wiki.eduke32.com/wiki/Checkactivatormotion This example demonstrates how to track MasterSwitch motion by catching the sprite deletion in EVENT_KILLIT and updating a subscription variable. ```EDuke32 var MASTERSWITCH_SUBSCRIPTION 0 2 var MASTERSWITCH_RETURN 0 2 var temp 0 2 var temp2 0 2 appendevent EVENT_KILLIT ifactor MASTERSWITCH { for temp sprofstat 1 { getav[temp].MASTERSWITCH_SUBSCRIPTION temp2 ife temp2 sprite[].lotag setav[temp].MASTERSWITCH_RETURN 1 } } endevent useractor notenemy MASTERSWITCHHANDLER // this actor has to do something if it detects the masterswitch is moving set MASTERSWITCH_SUBSCRIPTION ife MASTERSWITCH_RETURN 1 { // do stuff set MASTERSWITCH_RETURN 0 // remember to reset this or whatever code will keep triggering } enda ``` -------------------------------- ### Set floor palette for all sectors using whilevarvarn Source: https://wiki.eduke32.com/wiki/Whilevarvarn This example iterates through all sectors in a map using a whilevarvarn loop to set the floor palette to 1. ```EDuke32 gamevar TEMP 0 0 onevent EVENT_LOADACTOR setvar TEMP 0 whilevarvarn TEMP NUMSECTORS { setsector[TEMP].floorpal 1 addvar TEMP 1 } endevent ``` -------------------------------- ### setuptile command syntax Source: https://wiki.eduke32.com/wiki/Setuptile_%28DEF%29 Defines properties for a single highres replacement tile. ```text setuptile ``` -------------------------------- ### Add repository to sources.list.d Source: https://wiki.eduke32.com/wiki/APT_repository Add these lines to /etc/apt/sources.list.d/eduke32.list, replacing codename with your distribution version. ```text deb http://apt.duke4.net codename main deb-src http://apt.duke4.net codename main ``` -------------------------------- ### nextsectorneighborz Source: https://wiki.eduke32.com/wiki/Nextsectorneighborz Finds the nearest sector to the starting sector based on z position by searching for a ceiling or floor from the starting z, scanning up or down. The function returns the sector number found, or -1 if nothing is found. ```APIDOC ## nextsectorneighborz ### Description Finds the nearest sector to based on z position by searching for a from the , and scanning . The only valid values for the last two parameters are -1 or 1. RETURN will be the sectnum found. If RETURN is -1, then nothing was found by the search. ### Parameters - **starting sector** (integer) - Required - The sector to start the search from. - **starting z** (integer) - Required - The z coordinate to start searching from. - **ceiling or floor** (integer) - Required - Specifies whether to search for a ceiling (-1) or floor (1). - **up or down** (integer) - Required - Specifies whether to scan up (1) or down (-1). ### Return Value - **sectnum** (integer) - The sector number of the found sector. Returns -1 if no sector is found. ``` -------------------------------- ### Reset Weapons Event Example Source: https://wiki.eduke32.com/wiki/Gotweapon An example of using EVENT_RESETWEAPONS to remove the pistol from the player on E1L1. ```EDuke32 Script appendevent EVENT_RESETWEAPONS // remove the player's pistol if they spawned on E1L1 ``` ```EDuke32 Script ifvare VOLUME 0 ifvare LEVEL 0 { setplayer[THISACTOR].**gotweapon** PISTOL_WEAPON 0 setplayer[THISACTOR].ammo_amount PISTOL_WEAPON 0 } endevent ``` -------------------------------- ### Create and mount a FAT32 filesystem for case-insensitive modding Source: https://wiki.eduke32.com/wiki/Cross-Platform_Modding This Linux-specific sequence creates a 1GiB FAT32 filesystem in a file and mounts it as a loopback device to allow running mods that rely on case-insensitive file paths. Replace uid and gid with your own values obtained via the 'id' command. ```bash mkdosfs -F 32 -n 'Duke3DMods' -C dukemods.fat 1048576 # create a 1GiB FAT32 filesystem as dukemods.fat file on the local filesystem mkdir mods sudo mount dukemods.fat mods/ -o loop -o uid=1000 -o gid=1000 # mount as loopback device. uid and gid should be yours, get them with "id -u" and "id -g" cd mods && unzip /someplace/YourFavouriteMod.zip && cd YourFavouriteMod && eduke32 # you get the idea ``` -------------------------------- ### palfrom color examples Source: https://wiki.eduke32.com/wiki/Palfrom Example invocations of the palfrom command for various colors. The intensity parameter is shown as a placeholder; replace it with a value from 0-255. The color values are 0-63, and the examples show how to specify red, green, blue, and combinations. ```eduke32 palfrom 64 // Red palfrom 0 64 // Green palfrom 0 0 64 // Blue palfrom 32 16 // Brown palfrom 64 32 // Orange palfrom 64 64 // Yellow palfrom 64 0 64 // Purple palfrom 0 64 64 // Aqua palfrom 32 32 32 // Gray palfrom 64 64 64 // White ``` -------------------------------- ### Build EDuke32 via command line using nmake Source: https://wiki.eduke32.com/wiki/Building_EDuke32_on_Windows Command to initiate the build process from the platform/Windows directory using the Microsoft Visual Studio makefile. ```batch nmake -f msvc.mak ``` -------------------------------- ### Import GPG public key with sudo Source: https://wiki.eduke32.com/wiki/APT_repository Download and add the GPG public key to authenticate packages using sudo. ```bash wget -q http://apt.duke4.net/key/eduke32.gpg -O- | sudo apt-key add - ``` -------------------------------- ### setuptilerange command syntax Source: https://wiki.eduke32.com/wiki/Setuptile_%28DEF%29 Defines properties for a range of highres replacement tiles. ```text setuptilerange ``` -------------------------------- ### Build grpextract from source Source: https://wiki.eduke32.com/wiki/Utilities Use the GCC compiler to build the grpextract command-line utility from its source file. ```bash gcc grpextract.c -o grpextract ``` -------------------------------- ### Import GPG public key with su Source: https://wiki.eduke32.com/wiki/APT_repository Download and add the GPG public key to authenticate packages using su. ```bash su && wget -q http://apt.duke4.net/key/eduke32.gpg -O- | apt-key add - ``` -------------------------------- ### Build with Clang Source: https://wiki.eduke32.com/wiki/Building_EDuke32_on_Windows Compiles the project using the Clang compiler by setting the CLANG flag. ```make make RELEASE=0 -j4 eduke32.exe CLANG=1 ``` -------------------------------- ### Example actor using pitchroll state Source: https://wiki.eduke32.com/wiki/How_to_Make_Models_Pitch Shows how to use the pitchroll state in an actor definition. The line '**state pitchroll**' is placed in the actor's fall state. This example uses the CHAINGUNSPRITE actor. ```CON actor CHAINGUNSPRITE fall **state pitchroll** // This is where I have placed the state. ifmove RESPAWN_ACTOR_FLAG state respawnit else ifp pshrunk nullop else ifp palive ifpdistl RETRIEVEDISTANCE ifcount 6 ifcanseetarget { ifgotweaponce 0 break addweapon CHAINGUN_WEAPON 50 quote 54 ifspawnedby CHAINGUNSPRITE state getweaponcode else state quikweaponget } enda ``` -------------------------------- ### addammo example in useractor Source: https://wiki.eduke32.com/wiki/Addammo Example of using addammo to give ammo to the nearest player. The code checks if the player is alive, within distance, and can see the target before adding ammo. If the player already has full ammo, execution halts. ```CON useractor notenemy AMMO fall ifmove RESPAWN_ACTOR_FLAG state respawnit else ifp pshrunk nullop else ifp palive ifcount 6 ifpdistl RETRIEVEDISTANCE ifcanseetarget { **addammo** PISTOL_WEAPON PISTOLAMMOAMOUNT quote 65 ifspawnedby AMMO state getcode else state quikget } enda ``` -------------------------------- ### return keyword example with output Source: https://wiki.eduke32.com/wiki/Category%3AEvent_manipulation Shows that return aborts the entire block chain, so only the first appended event executes. The output confirms only the first two prints appear. ```eduke32 con definequote 666 This will print. definequote 616 This will never print. appendevent EVENT_ENTERLEVEL echo 666 endevent appendevent EVENT_ENTERLEVEL echo 666 return echo 616 endevent appendevent EVENT_ENTERLEVEL echo 616 endevent ``` ```output This will print. This will print. ``` -------------------------------- ### skybox DEF example with six faces Source: https://wiki.eduke32.com/wiki/Skybox_%28DEF%29 Example of a skybox definition using the tile and pal tokens, and specifying all six faces (front, right, back, left, top, down) with PNG files and the nocompress option. All six faces are required. ```DEF skybox { tile 3586 pal 0 front "mymod/sky_1.png" nocompress right "mymod/sky_2.png" nocompress back "mymod/sky_3.png" nocompress left "mymod/sky_4.png" nocompress top "mymod/sky_5.png" nocompress down "mymod/sky_6.png" nocompress } ``` -------------------------------- ### Build EDuke32 and Mapster32 Source: https://wiki.eduke32.com/wiki/Building_EDuke32_on_Windows Standard command to build the executables from the base source directory. ```make make ``` -------------------------------- ### Step 3: Create Diagonal Sectors Source: https://wiki.eduke32.com/wiki/Sliding_Doors Create sectors 'f' and 'g' and ensure they are valid player spaces using Alt-S in 2D mode. ```text *=============* | | | a | *-------------* | | | b | *------*------* |\ ¦ /| | \ ¦ / | Make sure sectors 'f' and 'g' are valid player spaces. |f * ¦ * g| (Alt-S in 2D mode). | / c1 ¦ c2 \ | |/ ¦ \| *------*------* | | | d | *-------------* | | | e | *=============* ``` -------------------------------- ### Step 1: Initial Sector Layout Source: https://wiki.eduke32.com/wiki/Sliding_Doors Create the initial sectors 'a' through 'e' to define the corridor and the door area. ```text *=============* | | Sectors 'a' and 'e' are the corridor in which | a | the door will be made. *-------------* | | | b | *-------------* | | | | Sector 'c' will be the actual door. | | | c | | | *-------------* | | | d | *-------------* | | | e | *=============* ``` -------------------------------- ### Get team palette Source: https://wiki.eduke32.com/wiki/NetDuke32 Retrieves the team's palette number. ```CON getuserdef[].teampal 2 TEMP // Gets team's palswap. ``` -------------------------------- ### Example: Define and call a state in multiple actors Source: https://wiki.eduke32.com/wiki/Ends Defines a state named spawnblood that spawns blood and kills the actor when hit by a weapon, then uses it in three different user actors. The state is called with the state token. ```eduke32 define MYACTOR1 3585 define MYACTOR2 3586 define MYACTOR3 3587 defstate spawnblood ifhitweapon { guts JIBS6 12 spawn BLOODPOOL killit } ends useractor notenemy MYACTOR1 2 state spawnblood enda useractor notenemy MYACTOR2 2 state spawnblood enda useractor notenemy MYACTOR3 2 state spawnblood enda ``` -------------------------------- ### Get team frag count Source: https://wiki.eduke32.com/wiki/NetDuke32 Retrieves the team's frag count. ```CON getuserdef[].teampal 2 TEMP // Gets team's frag count. ``` -------------------------------- ### Load multiple lookup palettes from one file Source: https://wiki.eduke32.com/wiki/Palookup_%28DEF%29 This example shows how to load three distinct lookup palettes from a single file by utilizing the offset token. ```DEF palookup 1 { raw { file "pals.raw" noshades } } palookup 2 { raw { file "pals.raw" offset 256 noshades } } palookup 3 { raw { file "pals.raw" offset 512 noshades } } ``` -------------------------------- ### Animation example using getticks in EVENT_DISPLAYMENU Source: https://wiki.eduke32.com/wiki/Getticks Uses getticks to animate a sprite by calculating the time difference between frames. The example sets up gamevars for previous and current ticks, computes the delta, scales it, and rotates a sprite. It includes a check to reset the y position after a certain threshold. This is intended for visual animation, especially in EVENT_DISPLAYMENU. ```CON gamevar prevtick -1 0 gamevar curtick 0 0 gamevar tmp 0 0 // =curtick-prevtick gamevar y 0 0 onevent EVENT_DISPLAYMENU getticks curtick ifvare prevtick -1 setvar tmp 0 else { setvarvar tmp curtick subvarvar tmp prevtick } mulvar tmp 8800 addvarvar y tmp ifvarg y 13107200 setvar y 0 // 200*65536=13107200 rotatesprite16 0 y 65536 0 0 0 0 26 0 0 xdim ydim setvarvar prevtick curtick endevent ``` -------------------------------- ### Loop Through Teams GameVar Source: https://wiki.eduke32.com/wiki/NetDuke32 Example of looping through the number of currently defined teams for TDM. ```text whilevarvarl TEMP numteams { addvar TEMP 1 } ``` -------------------------------- ### Build EDuke32 using gmake Source: https://wiki.eduke32.com/wiki/Building_EDuke32_on_macOS Commands to compile the project. Use the standard build command or specify RELEASE=0 for a debug build. ```bash gmake -j4 ``` ```bash gmake RELEASE=0 ``` -------------------------------- ### digitalnumber example: print actor health to screen Source: https://wiki.eduke32.com/wiki/Digitalnumber Example usage of the digitalnumber command in an EDuke32 CON script. It sets variables for position, shade, palette, tile number, and orientation, then retrieves the current actor's health into TEMP and calls digitalnumber to draw it. Note that digitalnumber only works during screen drawing events. ```eduke32 con setvar x 300 setvar y 10 setvar shade 0 setvar pal 0 setvar tilenum DIGITALNUM setvar orientation 26 getactor[THISACTOR].extra TEMP digitalnumber tilenum x y TEMP shade pal orientation ZERO ZERO xdim ydim ``` -------------------------------- ### Ion Fury: Aftershock grpinfo configuration Source: https://wiki.eduke32.com/wiki/Grpinfo Example of a grpinfo file named 'fury.grpinfo' used by Ion Fury: Aftershock, placed in the same directory as the binary. ```text grpinfo { name "Ion Fury: Aftershock" scriptname "scripts/main.con" defname "ashock.def" size 160826590 crc 0xE175FB41 flags 1664 dependency 0 } ``` -------------------------------- ### Load multiple blend tables from a single file Source: https://wiki.eduke32.com/wiki/Blendtable_%28DEF%29 This example demonstrates how to load three distinct blend tables from the same raw image file by specifying different offsets. ```text blendtable 0 { raw { file "blend.raw" } } blendtable 1 { raw { file "blend.raw" offset 65536 } } blendtable 2 { raw { file "blend.raw" offset 131072 } } ``` -------------------------------- ### Update MSYS2 packages Source: https://wiki.eduke32.com/wiki/Building_EDuke32_on_Windows Run this command to verify the installation and update all packages to the latest versions. ```bash pacman -Syuu ``` -------------------------------- ### HRP profile example Source: https://wiki.eduke32.com/wiki/E32_Profiles Shows a profile for the High Resolution Pack, using the 'autoload' attribute and a version of 6.0, with commands to load a directory and zip file. ```profile profile { name { proper "High Resolution Pack" reference "duke3d_hrp" } autoload version 6.0 game "duke3d" commands { dir "polymer_hrp" zip "duke3d_hrp.zip" } } ``` -------------------------------- ### Draw to the upper left pixel Source: https://wiki.eduke32.com/wiki/Showviewq16 Example of using showview to target exactly the upper left pixel. ```text showview x y z a h s 0 0 0 0 ``` -------------------------------- ### CON example: initialize and manipulate a gamevar Source: https://wiki.eduke32.com/wiki/Setvarvar Shows the basic EDuke32 CON syntax for declaring a gamevar with 'var' and then using 'set', 'add', and 'mul' operators. The first argument is the destination gamevar and the second can be a constant or gamevar. ```EDuke32 CON var temp 0 0 // initialize a global variable with initial value 0 set temp 1 // assigns a value of 1 to the gamevar _temp_. add temp 1 // adds 1 to _temp_, causing its value to become 2. mul temp 2 // multiplies _temp_ by 2, causing its value to become 4. ``` -------------------------------- ### Set LOGO_FLAGS to 0 and enable startup animations on first launch Source: https://wiki.eduke32.com/wiki/LOGO_FLAGS Defines LOGO_FLAGS with a default value of 0 to suppress the startup logo sequence, then sets it to 255 in the EVENT_INITCOMPLETE event to only show the startup animations on the first launch of the game session, not when returning to the title menu. ```eduke32 gamevar LOGO_FLAGS 0 0 // Only execute the startup animations on first launch onevent EVENT_INITCOMPLETE set LOGO_FLAGS 255 endevent ```