IAuraTreeScriptingApi provides access to the Aura Tree from scripts. It lets you work with auras, folders, and behavior trees, either by safely searching for them or by retrieving them directly and handling errors through exceptions.
The interface also exposes collections of all available auras, folders, and behavior trees, and lets you get specific triggers and actions from an aura by path.
public interface IAuraTreeScriptingApi : IScriptingApi
The API supports two lookup patterns:
Find...ByPath(...) — returns null if the item is not foundGet...ByPath(...) — throws an exception if the item is not foundIn all cases, the path can be either absolute or relative.
AuraReference to the aura that contains the current script, or null if there is no such aura.
IAuraAccessor Aura { get; }
FolderReference to the folder that contains the current script.
IFolderAccessor Folder { get; }
FoldersContains all folders in the Aura Tree.
IObservableList<IFolderAccessor> Folders { get; }
AurasContains all auras in the Aura Tree.
IObservableList<IAuraAccessor> Auras { get; }
BehaviorTreesContains all behavior trees in the Aura Tree.
IObservableList<IBehaviorTreeAccessor> BehaviorTrees { get; }
FindAuraByPath(string path)Finds an aura by path. Returns null if it is not found.
IAuraAccessor FindAuraByPath(string path);
Example:
var aura = AuraTree.FindAuraByPath("MyFolder/Aura1");
if (aura != null)
{
Log.Info("Aura found!");
}
else
{
Log.Info("Aura not found.");
}
GetAuraByPath(string path)Gets an aura by path. Throws an exception if it is not found.
IAuraAccessor GetAuraByPath(string path);
Example:
try
{
var aura = AuraTree.GetAuraByPath("MyFolder/Aura1");
Log.Info("Aura found!");
}
catch (NotFoundException)
{
Log.Info("Aura not found.");
}
FindFolderByPath(string path)Finds a folder by path. Returns null if it is not found.
IFolderAccessor FindFolderByPath(string path);
Example:
var folder = AuraTree.FindFolderByPath("MyProject/Folders/Folder1");
if (folder != null)
{
Log.Info("Folder found!");
}
else
{
Log.Info("Folder not found.");
}
GetFolderByPath(string path)Gets a folder by path. Throws an exception if it is not found.
IFolderAccessor GetFolderByPath(string path);
Example:
try
{
var folder = AuraTree.GetFolderByPath("MyProject/Folders/Folder1");
Log.Info("Folder found!");
}
catch (NotFoundException)
{
Log.Info("Folder not found.");
}
FindBehaviorTreeByPath(string path)Finds a behavior tree by path. Returns null if it is not found.
IBehaviorTreeAccessor FindBehaviorTreeByPath(string path);
Example:
var behaviorTree = AuraTree.FindBehaviorTreeByPath("MyProject/BehaviorTrees/Tree1");
if (behaviorTree != null)
{
Log.Info("Behavior tree found!");
}
else
{
Log.Info("Behavior tree not found.");
}
GetBehaviorTreeByPath(string path)Gets a behavior tree by path. Throws an exception if it is not found.
IBehaviorTreeAccessor GetBehaviorTreeByPath(string path);
Example:
try
{
var behaviorTree = AuraTree.GetBehaviorTreeByPath("MyProject/BehaviorTrees/Tree1");
Log.Info("Behavior tree found!");
}
catch (NotFoundException)
{
Log.Info("Behavior tree not found.");
}
These methods let you retrieve a trigger or action of a specific type from an aura by path.
GetTriggerByPath<TTrigger>(string path)Gets a trigger of the specified type.
Throws an ArgumentException if:
public TTrigger GetTriggerByPath<TTrigger>(string path) where TTrigger : IAuraTrigger;
Type parameter:
TTrigger — the trigger type to retrieveExample:
try
{
var trigger = AuraTree.GetTriggerByPath<IImageSearchTrigger>("MyAuraPath");
Log.Info($"Trigger found: {trigger.Name}");
}
catch (ArgumentException ex)
{
Log.Info(ex.Message);
}
GetActionByPath<TAction>(string path)Gets an action of the specified type.
Throws an ArgumentException if:
public TAction GetActionByPath<TAction>(string path) where TAction : IAuraAction;
Type parameter:
TAction — the action type to retrieveExample:
try
{
var action = AuraTree.GetActionByPath<ISendSequenceAction>("MyAuraPath");
Log.Info($"Action found: {action.Name}");
}
catch (ArgumentException ex)
{
Log.Info(ex.Message);
}