ConnectNPC: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
No edit summary
No edit summary
Line 20: Line 20:
}
}
</source>|
</source>|
note=The parameter enableconsoleinput=true on Linux causes a bug. The bug being the program stops working and Enter Key presses are needed to 'awaken it'|
note=The parameter enableconsoleinput=true on Linux causes the program to wait for 'Enter' key indefinitely. This is fixed in v1.6 beta.|
relfuncs=*[[ConnectNPCEx]]
relfuncs=*[[ConnectNPCEx]]
*[[IsPlayerNPC]]
*[[IsPlayerNPC]]
}}
}}

Revision as of 16:07, 31 January 2023

Version 1.5 patch2 has added parameter enableconsoleinput. Version 1.1 do not have this parameter.

Version 1.6 has added parameter plugins


Description:
Connect an NPC to the server


Parameters:

(name, script="", enableconsoleinput=false, host="127.0.0.1", plugins="")

name : The name for the NPC to use.
script : The script NPC must use. This script must reside in npcscripts folder.(with the ".nut" extension)
enableconsoleinput : true/false. If true, text typed in the console is passed to the npcscript by calling the function OnConsoleInput, if available. If true, the console will not be hidden. If false, text cannot be typed in the console and visibility of console depends on ShowNPCConsole called earlier.
host : The IP address of the host running vcmp server.
plugins : The string containing list of plugins to be loaded.


Return Values:
This function does not return any specific values.

Important Note:
The parameter enableconsoleinput=true on Linux causes the program to wait for 'Enter' key indefinitely. This is fixed in v1.6 beta.

Example

function onScriptLoad()
{
	ConnectNPC("[Bot]John", "test.nut");
}

Related Functions

The following functions may be helpful as they relate to this function in one way or another.