Naming Conventions

It's important to name your scripts in a consistent manner so that you know what they do and you know where to find them when you need them. Here is some information to help with naming.

CODI naming conventions

Barry The Hatchet posted a good roll up of the script naming conventions the CODI project came up with in NWN1. Here's the link: http://nwcitadel.forgottenrealmsweave.org/showthread.php?t=1131

Here's the actual list:

Include Scripts
Include scripts should be prefixed with INC_

Event Driven Scripts
Following the prefix for EVENT driven scripts, this is the majority; you have 1 letter denoting the object type that has the event this script goes in, they are as follows:
* N - NPC
* M - Monster/Creature
* A - Area
* O - Module
* P - Placable
* T - Trigger
* D - Door
* R - Trap
* C - Conversation
* E - Encounter
* I - Item - This script is not placed on an item per se, but called by module level scripts.
* X - No Object - Use this for a script that is called by other scripts. Executable scripts.

This character is followed by a two character short for the event it goes in, by category:

* N, M
o CO - onConversation
o DI - onDisturbed
o PA - onPhysicalAttacked
o SP - onSpawn
o UD - onUserDefined
o SC - OnSpellCastAt
o BL - onBlocked
o DM - onDamaged
o HB - onHeartbeat
o DE - onDeath
o CR - onCombatRoundEnd
o PE - onPerception
o RE - onRest

* A
o EN - onEnter
o EX - onExit
o HB - onHeartbeat
o UD - onUserDefined

* O
o CE - onClientEnter
o CL - onClientLeave
o PR - onPlayerRest
o RS - onRespawn
o DY - onPlayerDying
o DE - onPlayerDeath
o LE - onPlayerLevelUp
o IA - onItemActivated
o IQ - onItemAquired
o UI - onUnaquireItem
o ML - onModuleLoad
o HB - onHeartBeat
o UD - onUserDefined
o EI - onEquipItem

* P
o US - onUsed
o HB - onHeartBeat
o DE - onDeath
o AT - onAttacked
o SC - onSpellCastAt
o DM - onDamaged
o OP - onOpen
o OC - onClosed
o DI - onDisturbed
o LO - onLocked
o UL - onUnlocked
o UD - onUserDefined

* T
o CL - onClick
o EN - onEnter
o EX - onExit
o HB - onHeartBeat
o UD - onUserDefined

* D
o AT - onAreaTransitionClick
o OC - onClosed
o DM - onDamaged
o DE - onDeath
o FO - onFailedToOpen
o HB - onHeartBeat
o LO - onLocked
o OP - onOpened
o AT - onAttacked
o SC - onSpellCastAt
o UL - onUnlocked
o UD - onUserDefined

* R
o DI - onDisarmed
o TT - onTrapTriggered

* E
o EN - onEnter
o EX - onExit
o OE - onExhausted
o HB - onHeartBeat
o UD - onUserDefined

* C
o AT - Actions Taken
o AP - Appears When (StartingConditional Script)
o AB - onConversation Aborted
o EN - onConversation end

* I
o US - Called when the item is used.
o AQ - Called when the item is Aquired.
o UA - Called when the item is UnAquired.

Prefix examples

Module OnClientEnter script prefix: OCE_
Area OnEnter script prefix: AEN_
Placeable OnUsed prefix: PUS_
__________________
Just bend the pieces 'til they fit.

Official Documentation: Script Naming Conventions

buried in the official Toolset documentation is a section about naming conventions for scripts. I've replicated it here for easy reference.

All scripts in NWN2 are are prefixed with one of the following:

  • “g” for global scripts
  • “i_” for item related scripts (these are also global)

Item Scripts

Use the following for item scripts:

i_<Item Tag>_ac

script to execute when item activated

i_<Item Tag>_aq

script to execute when item acquired

i_<Item Tag>_ua

script to execute when item unacquired

i_<Item Tag>_eq

script to execute when item equipped

i_<Item Tag>_ue

script to execute when item unequipped

The module events will be written to automatically execute the proper script.

Conversation Scripts

Conversations have 2 script types.

a_<Speaker>…

actions taken

c_ <Speaker>…

conditional (Text appears when...)

Event Scripts

Scripts for events on objects should have a prefix to indicate the Object Type. If an object has multiple events, a suffix should be added each script to indicate the Event Type.

 

Object Type

Abbreviation

Area

use area num

Creature (Being)

b

Door

d

Encounter

e

Merchant

m

Placeable

p

Trigger

tr

 

Event

Abbreviation

Area**

Creature

Door

Encounter

Merchant

Placeable

Trigger

blocked

bl

X

click*

ck

X

X

close*

cs

X

X

X

combat round end*

ce

X

conversation

co

X

damaged

da

X

X

X

death

de

X

X

X

disturbed

di

X

X

enter

en

X

X

X

exhausted*

ed

X

exit

ex

X

X

X

fail to open

fa

X

heartbeat*

hb

X

X

X

X

X

X

lock

lo

X

X

open

op

X

X

X

perception

pe

X

physical attacked

at

X

X

X

rested

re

X

spawn

sp

X

spell cast at

ca

X

X

X

unlock*

ul

X

X

used

us

X

user defined*

ud

X

X

X

X

X

X

* These abbreviations don’t use the first 2 letters of the event name.

** Areas don’t need abbreviations.

Boldfaced events are defaults and are assumed if no event is given.

Other Scripts

Scripts not covered above should use these prefixes

inc_

include file

ai_

artificial intelligence (combat ai)

n_

extra miscellaneous script