SetName

Category: Objects / Status
Since engine version: 4.9.1.0 GWE (extended in 4.9.6.0 CR)

Description

Changes name of an object or a definition for the duration of the round.

Syntax

bool SetName (string szNewName, object pObj, id idDef, bool fSetInInfo, bool fMakeValidIfExists);

Parameters

szNewName:
New name. If 0 (not ""!) the object's name is reset to the definition value or the original crew member's name.
pObj:
[opt] Object you want to rename. Can be 0 in local calls.
idDef:
[opt] If specified, the pObj value is ignored and the name of the definition is changed instead.
fSetInInfo:
[opt] For crew members only: if true, the name is changed permanently in the crew info in the player file. There may be no duplicate names within a player file. From CR.
fMakeValidIfExists:
[opt] Determines what should happen if a clonk of the same name already exists in the player's crew. If false, the function call will fail. If true, a unique name is created by appending a number. From CR.

Remark

Before CE, a call of this function for a crew member woud result in a permanent name change in the player file and a call for a normal object would rename all objects of the same type.

Example

protected func InitializePlayer(iPlr)
  {
  SetName("Strunzmuffel", GetHiRank(iPlr));
  return(1);
  }
Scenario script: the highest ranking clonks of joining players get different names in this round.
See also: GetName, MakeCrewMember
Sven2, Juni 2003