FinishCommand

Category: Objects / Commands
Since engine version: 4.9.5.0 CE

Description

Ends a command in the command stack of an object.

Syntax

bool FinishCommand (object pObj, bool fSuccess, int iCommandNum);

Parameters

pObj:
Object of which to stop the command.
fSuccess:
Whether to evaluate the ended command as successful.
iCommandNum:
[opt] Index of the command. 0 is the current command, other values indicate the following commands.

Example

public func Production(object clonk)
{
  // Baum suchen
  var pTree;
  if (!(pTree = FindWorkTree(clonk)))
  // Kein geeigneter Baum (fertig)
  {
	Message("$TxtNomoresuitabletrees$",this());
	FinishCommand(clonk, 0, 1);
	return(0);
  }
[...]
}
        
From the sawmill script: FinishCommand is used to inform the following (super-level) commands that automatic wood production has failed. Produktion() is called through a Call command which counts as successful if the function call could be made. That's why FinishCommand must be used.
See also: AddCommand, AppendCommand, GetCommand, PlayerObjectCommand, SetCommand
Günther, April 2004