Function: RemoveObjectName
Function: RemoveObjectName

Function: RemoveObjectName

RemoveObjectName ( OBJECT, NAME )

Removes an assigned name from an object.

Parameters

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

Returns

Returns nothing. Cannot be used in expressions.

What It Does

This function removes a name from an object, such that it ceases being an interpretable name for referring to the object later. Removing a name that is not 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 removed. For example, if the object uses a determiner called "the", removing "wooden key" from the object also removes "the wooden key".

Names are matched case-insensitively.

Example

Object Names Example


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

world
{
	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]));
	}

	start()
	{
		local names = [
			"ball", 
			"the ball", 
			"red ball", 
			"the red ball"
		];
		nameTest(names);

		textln("Adding \"red ball\"...");
		addObjectName(o_ball, "red ball");
		nameTest(names);
		
		textln("Removing \"ball\"...");
		removeObjectName(o_ball, "ball");
		nameTest(names);
		quit;
	}
}

See Also

ObjectHasName() — Checks if an object has a specific name.
AddObjectName() — Add an interpretable name to an object.

×

Modal Header