ConnectNPC: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
<poem style="border: 2px solid #d6d2c5; background-color: #ffff00; padding: 1em;"> | <poem style="border: 2px solid #d6d2c5; background-color: #ffff00; padding: 1em;"> | ||
Version 1.5 patch2 has added parameter enableconsoleinput. Version 1.1 do not have this parameter. | Version 1.5 patch2 has added parameter enableconsoleinput. Version 1.1 do not have this parameter. | ||
</poem> | |||
<poem style="border: 2px solid #d6d2c5; background-color: #00ff00; padding: 1em;"> | |||
Version 1.6 has added parameter plugins | |||
</poem> | </poem> | ||
{{Welcome| | {{Welcome| | ||
desc=Connect an NPC to the server| | desc=Connect an NPC to the server| | ||
params=<syntaxhighlight lang="lua">(name, script="", enableconsoleinput=false, host="127.0.0.1")</syntaxhighlight> | params=<syntaxhighlight lang="lua">(name, script="", enableconsoleinput=false, host="127.0.0.1", plugins="")</syntaxhighlight> | ||
<poem>::name : The name for the NPC to use. | <poem>::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) | ::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. | ::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 : This | ::host : This parameter is optional. | ||
::plugins : The string containing list of [[NPC Plugins|plugins]] to be loaded. </poem>| | |||
retval= This function always return 1.| | retval= This function always return 1.| | ||
example=<source lang="lua"> | example=<source lang="lua"> |
Revision as of 14:27, 7 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 : This parameter is optional.
plugins : The string containing list of plugins to be loaded.
Return Values:
This function does not return any specific values.
Important Note:
Prior to version 1.5, script was mandatory.
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.