# brainAI DOCUMENTATION

Version 5, codename "Krang", by Austin Heilman.

## npcNerves.inc

npcNerves.inc Functions
Constants
The following constants are inside npcInit.inc
// Nerve flags const NF_NO_FLAGS := 0x0; const NF_CONTINUE_ON_SLEEP := 0x1;
GetNerveFlags
Parameters
(mobile, nerve_name)
Name | Type
mobile | NPC to get the nerve information from.
nerve_name | Name of the nerve to get the information for.
Explanation
Retrieves the flag setting for a nerve.
Return Values
Returns 1 or error.
GetNerveNameByPid
Parameters
(mobile, pid)
Name | Type
mobile | NPC to get the nerve information from.
pid | Process ID to search for.
Explanation
Finds the name of a nerve by its pid. This function searches through all nerves by their key name until it finds one with a match.
Return Values
Returns a string - key name of the nerve.
GetNerveProcess
Parameters
(mobile, nerve_name)
Name | Type
mobile | NPC to get the nerve information from.
nerve_name | Name of the nerve to get the information for.
Explanation
Retrieves a reference to a running nerve script.
Return Values
Returns a script reference or error.
KillNerves
Parameters
(mobile)
Name | Type
mobile | NPC the nerves will be stopped on.
Explanation
Forces all nerve scripts that are running on an npc to stop.
Return Values
Returns 1.
LoadNerves
Parameters
(mobile)
Name | Type
mobile | NPC to get the nerve information from.
Explanation
Loads nerve information for an NPC.
Return Values
Returns a dictionary.
SaveNerves
Parameters
(mobile, nerve_dict)
Name | Type
mobile | NPC to get the nerve information from.
nerve_dict | Dictionary containing nerve information.
Explanation
Saves nerve information for an NPC.
Return Values
Returns 1 or error.
StartNerve
Parameters
(mobile, nerve_name, nerve_script, data:=array, flags:=NF_NO_FLAGS)
Name | Type
mobile | NPC to get the nerve information from.
nerve_name | The name the nerve script will be run under. Example: "Combat", "EnterReact", "Beer".
data | Array of data to send to the nerve script when it starts.
flags | Can contain anything - but should use NF_* flags for bitwise checks.
Explanation
Starts up a nerve script. Notes: * data[1] - Will contain the mobile argument. * data[2] - Will contain the nerve name argument. * If data is not an array, it will be placed at data[3]. * If data is sent as an array, it will begin at the index of [3].
Return Values
Returns a script reference to the nerve script.
StopNerve
Parameters
(mobile, nerve_name)
Name | Type
mobile | NPC to get the nerve information from.
mobile | The name of the nerve script to stop. Example: "Combat", "EnterReact", "Beer"
Explanation
Stops a nerve script.
Return Values
Returns 1 or error