/!\ 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.

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.

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 inserting 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.

(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 travels; 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 playergeth - makes the actor continue moving horizontallygetv - makes the actor continue moving verticallyrandomangle - makes the actor randomly pick a direction and face itfaceplayerslow - makes the actor gradually turn toward the playerspin - makes the actor spin around in a circlefaceplayersmart - makes the actor "lead" at the player, making it have a better chance to hit a moving targetfleeenemy - makes the actor face away from the enemy; enemy being the last thing that it was shot byjumptoplayer - makes the actor attempt to jump toward the playerseekplayer - makes the actor perform a complicated search algorithm to find the nearest playerfurthestdir - makes the actor randomly pick a direction away from the player and face itdodgebullet - 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

(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 properties1 - makes the actor solid2 - makes the actor translucent4 - flips the actor along the X-axis8 - flips the actor along the Y-axis16 - flattens the actor along walls32 - flattens the actor along floors/ceilings64 - makes the actor 1-sided128 - centers the sprite along the texture's center; default is along the bottom256 - makes the actor solid; used with 1 for living actors512 - makes the actor translucent; used with 2 to make the actor very translucent32768 - makes the actor invisible and not solid

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
statement is called.

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 performing one of the following events:

pstanding - True if the player is standingpwalking - True if the player is walkingprunning - True if the player is running; not true if auto-run is enabledpducking - True if the player is duckingpfalling - True if the player is fallingpjumping - True if the player is jumpingphigher - True if the player is higher than the current actorpwalkingback - True if the player is walking backwardprunningback - True if the player is running backward; not true if auto-run is enabledpkicking - True if the player is kicking; not true if quick-kickingpshrunk - True if the player has been hit by the shrinkerpjetpack - True if the player is using the jet-packponsteroids - True if the player's "steroid" item value is not equal to 0 or 400ponground - True if the player is on the ground; true if standing on a solid spritepalive - True if the player is alivepdead - True if the player is deadpfacing - 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: