OnNPCScriptLoad: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
<big>
<poem style="border: 2px solid #d6d2c5; background-color: #f9f4e6; padding: 1em;">
 
Note: The argument params was added in v1.5 only
<poem>'''Description''':  
</poem>
<big><poem>'''Description''':  
::This function is called when a NPC script is loaded.
::This function is called when a NPC script is loaded.
</poem>
</poem>
Line 7: Line 8:


'''Parameters:'''
'''Parameters:'''
<source lang="lua">
<syntaxhighlight lang="lua">params</syntaxhighlight>
This callback has no parameters.
::params : An array containing string values which was passed to the npcscripts via [[ConnectNPCEx]] or npcclient.exe with the usage of -w parameter.
</source>


<poem>
<poem>
'''Return Values:'''
'''Return Values:'''
::This callback does not handle returns
::This callback does not handle returns
Line 18: Line 19:


<source lang="lua">
<source lang="lua">
function OnNPCScriptLoad()
function OnNPCScriptLoad( params )
{
{
print("NPC script loaded\n");
print( "params array length is " + params.len() + "\n" );
print( "arguments passed to script are:\n" );
foreach( arg in params )
print( arg + "\n" );
}
}
</source>
</source>
</big>
</big>

Latest revision as of 07:56, 30 November 2022

Note: The argument params was added in v1.5 only

Description:
This function is called when a NPC script is loaded.


Parameters:

params
params : An array containing string values which was passed to the npcscripts via ConnectNPCEx or npcclient.exe with the usage of -w parameter.


Return Values:
This callback does not handle returns


function OnNPCScriptLoad( params )
{
	
	print( "params array length is " + params.len() + "\n" );
	
	print( "arguments passed to script are:\n" );
	
	foreach( arg in params )
		print( arg + "\n" );
	
}