PRIMITIVE LIST  v1-01-2003  Release 1  © RTCM Reaper_Man

/!\ Attention: These FAQ's where written before the development of EDuke, many limits do not apply anymore.

These CON FAQs was written because I believe that there is no one place where CON information can be found - from the simplest ideas to the most complex effects. After the fall of Dukeworld and 3D Portal, a web-edition of the CON FAQ seems to have been lost, and that leaves Duke RTCM as the only other source of CON information. Though they do have information on CONs and how to edit them, I don't believe that this information is easily understood by the newest of newbie's.

The information here is for those newbie's, moderate programmers', and the experts alike. Know one knows everything there is to know about CONs, or any computer programming language for that matter. Everyone has their own style and their own ideas, and that leads to the limitless possibilities.

These FAQs are not a solid piece of work - it is an ever changing, ever evolving compilation of the DukeC programming language - the unofficial name of the CON language. If any new information is brought to my attention, or something that needs to be fixed, I will post updates. You can reach me at http://www.msleeper.com/ as that is my personal site/blog.

Enjoy!

Introduction | Table Of Contents

Introduction

 

To my knowledge, Todd Replogle never named the language that CONs are written written, but it is commonly called "DukeC", since it's syntax resembled the C programming language. It's just a guess, but I think that "CON" means "C On Narcotics". You never know, it could be.

Update! During a conversation between Todd Replogle and I, he told me that the CON files have the extension ".CON" because they CONtrol the game. Oh well, I was close.

As far as I know, this is a complete list of the primitives in DukeC. Primitives are the basic commands that CONs are written in. Most of the primitives I know from memorization, but some were taken from the Duke Nukem 3D: Level Design Handbook by matt tagliferri, and the rest people told/reminded me of.


Table Of Contents


/*
==================
TABLE OF CONTENTS
==================
*/

Basic Primitives
break fall getlastpal killit
nullop operate pkick pstomp
resetactioncount resetcount resetplayer tip
wackplayer

Single Variable Primitives
addkills addphealth cactor count
endofgame globalsound include lotsofglass
mail money paper quote
shoot sound soundonce spawn
spritepal strength

Double Varible Primitives
addammo addinventory addweapon debris
define guts sizeat sizeto

Multiple Varible Primitives
action move ai ai routines
actor useractor cstat cstat values
cstator hitradius palfrom state

If/Else Variable Primitives
ifactornotstayput ifai ifaction ifactioncount
ifangdiffl ifbulletnear ifcansee ifcanseetarget
ifcanshoottarget ifceilingdistl ifcount ifdead
iffloordistl ifgapzl ifhitspace ifhitweapon
ifinwater ifmove ifnotmoving ifonwater
ifp ifpdistl ifphealthl ifpinventory
ifplayersl ifrespawn ifrnd ifspawnedby
ifspritepal ifsquished ifwasweapon

 


/*
================
BASIC PRIMITIVES
================
*/

break: Forces the code to cut from the current "{ }" or state.

fall: Makes the current actor affected by gravity.

getlastpal: Resets the actor's palette to the value previous to the last called spritepal.

killit: Deletes the current actor from the map.

nullop: Primitive identical to insterting a "{ }"; forces the actor to not perform any function.

operate: Makes the actor attempt to use elevators and doors. This does not allow them to use switches.

pkick: Forces the player to do a "quick kick".

pstomp: Forces the player to look down and "stomp". Used when the player is squishing a shrunken enemy.

resetactioncount: Resets the action that is currently being played to the first frame.

resetcount: Sets the internal counter to 0. Each actor has only 1 counter.

resetplayer: In single-play, restarts the map and takes away all key-cards, weapons, and items. In multi-play, takes away the player's weapons and items, giving him the normal health and starting weapons, aswell as placing him at one of the pre-defined starting locations.

tip: Causes the player to play the "tipping" animation, used to give money to strippers. This is useful because you can delete the frames and render the player's use and firing functions useless.

wackplayer: Tilts the player's screen around, simulating a hard hit.

/*
=========================
SINGLE VARIABLE PRIMITIVES
=========================
*/

addkills (value): Adds (value) kills to the player, which is added up at the end of each level.

addphealth (value): Adds (value) to the player's health. Can be a negative number to take health.

cactor (actor): Changes the code from the current actor to (actor), while keeping the current strength, speed, action, palette, size, action and AI of the original actor.

count (value): Changes the current count to (value).

endofgame (time): Ends the current episode in (time) ticks.

globalsound (sound): Plays the defined sound (sound), making it audible to every player.

include (file name): Includes the file (file name) when compiling the CONs before the game starts.

lotsofglass (amount): Spawns (amount) pieces of glass.

mail (amount): Spawns (amount) pieces of mail.

money (amount): Spawns (amount) pieces of money.

paper (amount): Spawns (amount) pieces of paper.

quote (quote number): Displays the defined quote (quote number) at the top of the screen.

shoot (weapon type): Forces the actor to shoot a (weapon type) projectile. Possible projectiles are:
RPG - Rocket
SHOTSPARK1 - Pistol
SHOTGUN - Shotgun
CHAINGUN - Chaingun
SHRINKER - Shrinker
GROWSPARK - Expander
FREEZEBLAST - Freezer
KNEE - Mighty Boot
MORTER - Battlelord's morter
COOLEXPLOSION1 - Octabrain's mind-blast
FIRELASER - Trooper's laser
SPIT - LizMan's spit
BLOODSPLAT1 - Wall blood splash 1
BLOODSPLAT2 - Wall blood splash 2
BLOODSPLAT3 - Wall blood splash 3
BLOODSPLAT4 - Wall blood splash 4
BOUNCEMINE - Underwater mine, as seen in E1L4
sound (sound): Plays the defined sound (sound).

soundonce (sound): Plays the defined sound (sound) only if it is not being currently played by any other actor.

spawn (actor definition): Spawns the actor (actor definition) into the game.

spritepal (value): Sets the sprite's palette to (value).

strength (value): Sets the actor's strength to (value).

/*
=========================
DOUBLE VARIABLE PRIMITIVES
=========================
*/

addammo (weapon) (value): Adds (amount) units of ammo for the weapon (weapon).

addinventory (inventory item) (amount): Sets (inventory item)'s current amout to (amount).

addweapon (weapon) (amount): Gives the player the weapon (weapon) with (amount) units of ammo.

debris (type) (amount): Spawns (amount) pieces of debris type (type).

define (actor) (tile number): Defines the name (actor) to the texture (tile number). This is used for naming actors.

guts (type) (amount): Spawns (amount) pieces of guts type (type).

sizeat (vertical) (horizontal): Instantly resizes the actor to (vertical)/256 by (horizontal)/256.

sizeto (vertical) (horizontal): Gradually resizes the actor to (vertical)/256 by (horizontal)/256.

/*
============================
MULTIPLE VARIABLE PRIMITIVES
============================
*/

action (action definition) (offset) (number of frames) (frame skip) (direction) (tempo): Defines an animation block. Modifiers are not required, and stand for the following:
(action definition) - names the action; this is the only required modifier
(offset) - is the number of frames to skip before starting an action
(number of frames) - is the number of animation frames
(frame skip) - is the number of frames between each frame in (number of frames)
(direction) - is the direction the action traves; 1 or -1
(tempo) - is the speed the action travels at
move (move definition) (vertical) (horizontal): Defines a rate of movement. Modifiers are not required, and stand for the following:
(move definition) - names the movement; this is the only required modifier
(vertical) - is the rate at which the actor will move vertically, along the X-plane
(horizontal) - is the rate at which the actor will move horizontally, along the Y-plane
ai (ai definition) (action) (move) (ai routine): Defines an AI routine. All modifiers are required, and stand for the following:
(ai definition) - names the AI
(action) - is the action sequence to be played when the AI is called
(move) - is the speed at which the actor will travel when the AI is called
(ai routine) - is the basic AI routine the actor will perform when the AI is called
List of the basic AI routines available:
faceplayer - makes the actor face the direction of the player
geth - makes the actor continue moving horizontally
getv - makes the actor continue moving vertically
randomangle - makes the actor randomly pick a direction and face it
faceplayerslow - makes the actor gradually turn toward the player
spin - makes the actor spin around in a circle
faceplayersmart - makes the actor "lead" at the player, making it have a better chance to hit a moving target
fleeenemy - makes the actor face away from the enemy; enemy being the last thing that it was shot by
jumptoplayer - makes the actor attempt to jump toward the player
seekplayer - makes the actor perform a complicated search algorithm to find the nearest player
furthestdir - makes the actor randomly pick a direction away from the player and face it
dodgebullet - makes the actor attempt to dodge incoming projectiles
actor (actor definition) (health) (action) (ai) (code) enda: Code syntax for an actor. Modifiers are not required, and stand for the following:
(actor definition) - names the actor; usually pre-defined
(health) - is the amount of hit-points the actor has
(action) - is the first action the actor performs
(ai) - is the first AI the actor performs
(code) - is where the actor's code is written
useractor (actor type) (actor definition) (health) (action) (ai) (code) enda: Code syntax for a user-made actor. Only the modifier (actor type) is required, and stand for the following:
(actor type) - defines what type of actor the useractor will be either notenemy, enemy, or enemystayput
(actor definition) - names the actor; usually pre-defined
(health) - is the amount of hit-points the actor has
(action) - is the first action the actor performs
(ai) - is the first AI the actor performs
(code) - is where the actor's code is written
cstat (value): Changes physical characteristics of the actor. They can be added for combined effects. Stands for 'C'ombined 'STAT'istics. List of possible (value)s:
0 - resets all cstat properties
1 - makes the actor solid
2 - makes the actor translucent
4 - flips the actor along the X-axis
8 - flips the actor along the Y-axis
16 - flattens the actor along walls
32 - flattens the actor along floors/ceilings
64 - makes the actor 1-sided
128 - centers the sprite along the texture's center; default is along the bottom
256 - makes the actor solid; used with 1 for living actors
512 - makes the actor translucent; used with 2 to make the actor very translucent
32768 - makes the actor invisible and not solid
cstator (value): Adds (value) and the current cstat value. Example:

actor ACTOR 0
cstat 1 // Make actor solid
...
Later in the code
...
cstator 1
enda

1 + 1 = 2. The actor's new cstat would make the actor go from solid to translucent.

hitradius (radius) (strength 1) (strength 2) (strength 3) (strength 4): Used to make a damage-area (radius) wide that will destroy glass, lights, etc. and cause damage type RADIUSEXPLOSION to actors. The damage area is divided into 4 sections, (strength 1) on the outer edge and (strength 4) being in the center.

palfrom (intensity) (red) (green) (blue): Used to change the screen's tint (intensity) strong, with the color of (red), (green), and (blue) combined. Mainly used for when the player picks up items and takes damage from projectiles. Modifiers must be integers from 0 to 63.

state (state definition) (statement code) ends: When used outside of an actor primitive, it defines a block of code that can be called by all other actors following it, and must be ended with ends. When used internally, ends is not used, and the code in the defined statment is called.

/*
==========================
IF/ELSE VARIABLE PRIMITIVES
==========================
*/

The following primitives are modifiers for the basic if/else statement block. An if/else statement block has the same basic syntax:

if (modifier)
{
  ...
  statment block 1
  ...
}
else
{
  ...
  statment block 2
  ...
}

Basically, if modifier is true, then the code in statement block 1 is executed. If it is false, then the code in statement block 2 is execued. If there is no else statement, then nothing happens and the code moves on.

ifactornotstayput: True if the actor is not a stayput actor. Stayput actors are ones that do not leave the sector they started out in.

ifai (ai definition): True if the current AI is (ai definition).

ifaction (action definition): True if the current action is (action definition).

ifactioncount (value): True if the current action count is greater than or equal to (value).

ifangdiffl (value): True if the difference between the current actor's angle and the player's angle is less than (value).

ifbulletnear: True if a projectile is heading toward the actor.

ifcansee: True if the actor can see the player.

ifcanseetarget: True if the player can see the actor.

ifcanshoottarget: True if the actor can shoot at the player, without hitting other actors, walls, etc.

ifceilingdistl (value): True if the distance between the actor and the current sector's ceiling is less than (value). Note: One PAGE-UP in Build is equal to 4.

ifcount (value): True if the actor's counter is greater than or equal to (value).

ifdead: True if the actor's strength is less than or equal to 0.

iffloordistl (value): True if the distance between the actor and the current sector's floor is less than (value). Note: One PAGE-UP in Build is equal to 4.

ifgapzl (value): True if the current sector's height, floor to ceiling, is less than (value). Note: One PAGE-UP in Build is equal to 4.

ifhitspace: True if the player is pressing the use key, spacebar by default.

ifhitweapon: True if the actor was hit by a projectile.

ifinwater: True if the actor is in an underwater sector.

ifmove (move definition): True if the actor is moving at speed (move definition).

ifnotmoving: True if the actor has hit a wall or other object, and is no longer moving at the desired speed.

ifonwater: True if the actor is in an above water sector.

ifp (player event): True if the player is preforming one of the following events:
pstanding - True if the player is standing
pwalking - True if the player is walking
prunning - True if the player is running; not true if auto-run is enabled
pducking - True if the player is ducking
pfalling - True if the player is falling
pjumping - True if the player is jumping
phigher - True if the player is higher than the current actor
pwalkingback - True if the player is walking backward
prunningback - True if the player is running backward; not true if auto-run is enabled
pkicking - True if the player is kicking; not true if quick-kicking
pshrunk - True if the player has been hit by the shrinker
pjetpack - True if the player is using the jet-pack
ponsteroids - True if the player's "steroid" item value is not equal to 0 or 400
ponground - True if the player is on the ground; true if standing on a solid sprite
palive - True if the player is alive
pdead - True if the player is dead
pfacing - True if the player is facing the current actor
ifpdistl (value): True if the player's distance from the actor is less than (value).

ifphealthl (value): True if the player's health is less than (value).

ifpinventory (inventory item) (amount): True if the player's item (inventory item) is NOT EQUAL TO (value). The following code:

ifpinventory GET_BOOTS 100
{
  ...
}

Is NOT the same as:

ifpinventory GET_BOOTS 100 { }
else
{
  ...
}

As James Ferry discovered, the first set of code will be executed if the item (inventory item) is not equal to (value). The second set of code will be executed if the item (inventory item) is equal to (value). This opens up limitless possibilities for CON-made events and triggers. Please read the
Inventory Theory for more information.

ifplayersl (value): True if the current number of players is less than (value).

ifrespawn: True if the game has respawn for enemies and items is on.

ifrnd (value): True if (value) is less than or equal to a number randomly picked between 1 and 255. This random drawing resets itself every game tick.

ifspawnedby (actor definition): True if the actor was spawned by (actor definition).

ifspritepal (value): True if the actor's palette is (value).

ifsquished: True if the actor is in a sector with 0 height.

ifwasweapon (weapon type): Used with ifhitweapon, true if the actor was hit by one of the following projectiles:
RPG - Rocket
RADIUSEXPLOSION - Pipebombs, tripmines, "hitradius", or other explosives
SHOTSPARK1 - Pistol, Shotgun, or Chaingun
SHRINKSPARK - Shrinker
GROWSPARK - Expander
FREEZEBLAST - Freezer
KNEE - Mighty Boot
COOLEXPLOSION1 - Octabrain's mind-blast
FIRELASER - Trooper's laser