User Tools

Site Tools


scripting:functions

Functions

Functions are defined in your script as shown in this example:

<codedoc> Function IsItemASword( $itemNum ) {

if ( $itemNum = 112 )		// Sword
{
	return( 1 )
}
else if ( $itemNum = 113 )	// Sword 2	
      {
	return( 1 )
}
return( 0 )

} </codedoc>

This example function would be called from another part of your script like this: <codedoc>

$isSword = IsItemASword( $gTaskItem1 )

</codedoc>

Functions can have any number of parameters, and always return a value.

scripting/functions.txt · Last modified: 2020/01/28 17:50 by 127.0.0.1

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki