Function: AddObjectName
Function: AddObjectName

Function: AddObjectName

AddObjectName ( OBJECT, NAME )

Adds an assigned name to an object.


Parameter Type Description
OBJECT OBJECT The object to add to.
NAME VALUE(STRING) The name to add.


Returns nothing. Cannot be used in expressions.

What It Does

This function adds a name to an object, such that it now becomes an interpretable name for referring to the object later. There is no limit to how many objects can have the same name, and no checks are made for duplicates across objects. Adding a name that is already assigned to the provided object does nothing.

Object names, when added to (but not removed from) objects, are sanitized, such that multi-word names only contain one space to separate words. For example, red     paint turns into red paint. Functions that check for matching names do not sanitize the name that is looked for.

If the object also has determiners, each combination of [determiner, name] is prepended to the name before it is added. For example, if the object uses a determiner called "the", adding "wooden key" to the object also adds "the wooden key".

Names are matched case-insensitively.


Object Names Example

object o_ball named "ball" uses determiners "the";

	function nameTest(list)
		local i;
		for (i = 0; i < length(list); i = i + 1)
			textln("Object has name \""+list[i]+"\": " + ObjectHasName(o_ball, list[i]));

		local names = [
			"the ball", 
			"red ball", 
			"the red ball"

		textln("Adding \"red ball\"...");
		addObjectName(o_ball, "red ball");
		textln("Removing \"ball\"...");
		removeObjectName(o_ball, "ball");

See Also

ObjectHasName() — Checks if an object has a specific name.
RemoveObjectName() — Removes an interpretable name from an object.


Modal Header