Function: RemoveObjectTag
Function: RemoveObjectTag

Function: RemoveObjectTag

RemoveObjectTag ( OBJECT, TAG )

Removes a tag from an object.

Parameters

Parameter Type Description
OBJECT OBJECT The object to remove from.
TAG VALUE(STRING) The tag to remove.

Returns

Returns nothing. Cannot be used in expressions.

What It Does

This function removes a tag from an object. Removing a tag that is not assigned to the provided object does nothing.

Unlike names, tags are not sanitized on assignment to objects - they are added as-is.

Tags are matched case-insensitively.

Example

Object Tags Example


action general a_quit named "quit";
action transitive a_eat named "eat", "consume";
action transitive a_drive named "drive";
action transitive a_examine named "examine", "look at", "x";
action modal a_make named "make the thing", "make thing" 
	uses modes "edible", "not edible", "not driveable", "driveable", "inert";

object o_thing named "thing" uses determiners "the"
{
	onAction(a_eat)
	{
		if (objectHasTag(this, "edible"))
			textln("You ate the thing. Delicious!");
		else
			textln("You can't eat this.");
	}

	onAction(a_drive)
	{
		if (objectHasTag(this, "driveable"))
			textln("You drive the thing. Vroom!");
		else
			textln("You can't drive this.");
	}

	onAction(a_examine)
	{
		local edible = objectHasTag(this, "edible");
		local driveable = objectHasTag(this, "driveable");

		if (edible && driveable)
			textln("It's a driveable, edible thing.");
		else if (edible)
			textln("It's an edible thing.");
		else if (driveable)
			textln("It's a driveable thing.");
		else
			textln("It's a thing.");
	}

}

world
{
	init()
	{
		giveObject(this, o_thing);
	}

	start()
	{
		textln("There's a thing here.");
		textln(
			"You can change the characteristics of the thing by typing \"make the thing\" and a"
			+ "mode: \"edible\", \"driveable\", \"not edible\" or \"not driveable\". Then you can "
			+ "\"eat\" or \"drive\" it."
		);
		textln("Typing \"make the thing inert\" will remove those characteristics.");
		textln("");
		textln("Type \"quit\" to quit.");
	}

	onAction(a_quit)
	{
		quit;
	}

	onModalAction(a_make, "edible")
	{
		addObjectTag(o_thing, "edible");
		textln("The thing is now edible.");
	}

	onModalAction(a_make, "driveable")
	{
		addObjectTag(o_thing, "driveable");
		textln("The thing is now driveable.");
	}

	onModalAction(a_make, "not edible")
	{
		removeObjectTag(o_thing, "edible");
		textln("The thing is now not edible.");
	}

	onModalAction(a_make, "not driveable")
	{
		removeObjectTag(o_thing, "driveable");
		textln("The thing is now not driveable.");
	}

	onModalAction(a_make, "inert")
	{
		removeObjectTagFromAllIn(world, "edible");
		removeObjectTagFromAllIn(world, "driveable");
		textln("The thing is now inert.");
	}

}

See Also

ObjectHasTag() — Checks if an object has a specific tag.
AddObjectTag() — Adds a tag to an object.
AddObjectTagToAllIn() — Adds a tag to each object in an object container element.
RemoveObjectTagFromAllIn() — Removes a tag from each object in an object container element.

×

Modal Header