CS Toggle
The CS_Toggle command calls the candy_toggle() method of nodes in the game world, passing it its three keys unchanged. The node's own script defines the behaviour of the call, so CS_Toggle is a hook for your own code. A target without a candy_toggle() method is reported and skipped.
For example, this method sets one or more bool properties of the node, with Method Bool, Properties a property name or an Array of names, and Value true or false:
func candy_toggle(method, properties, value):
if method != "Bool":
return
if not properties is Array:
properties = [properties]
for property in properties:
if property in self:
set(property, str(value) == "true")
Keys
Every key also accepts a ¢ expression instead of a fixed value, unless its description says otherwise. See CandyRef Expressions.
Targets
Description:
The nodes the command acts on. Each key identifies a node, and its value is a Dictionary of settings for that node (see below), or an empty Dictionary for none. The Engine reports an entry it can't find and skips it, without affecting the others.
Values:
• Container/Name: A node inside one of the containers listed in the Engine's cs_paths, such as Actors/Hero for the node Hero in the Actors container. The name can be a longer path, such as Actors/Hero/Hat.
• Container/°role: The node named after the Actor assigned to that Role, such as Actors/°guard. A Role always needs its container.
• Node path: A path relative to the Engine, or an absolute path such as /root/Game/Hero.
• ¢ expression: Can also return the node itself, such as ¢$Level/Hero (a path from the Engine).
Target Settings
Each target in Targets accepts the following keys.
Method
Description:
Passed to candy_toggle() as its first argument.
Values:
• Any value: Such as Bool in the example above.
Properties
Description:
Passed to candy_toggle() as its second argument.
Values:
• Any value: In the example above, a property name or an Array of property names.
Value
Description:
Passed to candy_toggle() as its third argument.
Values:
• Any value: In the example above, true or false.