The AI Tools extension is designed as a general-purpose toolset for problems which can be solved, or partially solved, using graphs. Example problems include:
Function | | Description |
autoGraph | | Generates a graph from the scene tiles (all layers). Row, column coordinates with no tile collision boxes are marked as nodes.
 |
|
findPath | | Returns a path from the initial point to the goal. The path can either be a list of steps, or a list of visited coordinates. [more discussion]
 |
|
pathCost | | Returns the total cost of travelling along a specified path.
 |
|
autoDrawGraph | | Drawing block that draws the specified graph. Be sure to specify stroke thickness and stroke color (example below). This block is intended to help debug graphs generated by the "autoGraph" block (above), or other graphs that overlay a scene.
 
|
|
createGraph | | Creates an empty graph.
 |
|
setNorm | | Specifies the norm used for the heuristic function. [more discussion]
 |
|
exportGraph | | Returns a list containing the graph data. [more discussion]
 |
|
isConnectionAt | | Returns true if there is an edge connecting the two specified nodes. For one-way connections, the source is the first node, and destination the second.
 |
|
getConnectionName | | Returns the name of the specified connection.
 |
|
setConnectionName | | Sets the name of the specified connection.
 |
|
setConnectionCost | | Sets the cost of the specified connection.
 |
|
connectNode | | Connects two nodes. The connection can be given a name, which will be included in the data "find path" returns. Note that the connection will be one-way, with the source being the first node, and destination the second.
 |
|
deleteConnection | | Deletes the connection linking the two specified nodes. For two-way connections, you will need to call this function for both directions.
 |
|
isNodeAt | | Returns true if there is a node at the specified location.
 |
|
getNodeName | | Returns the name of a node at the specified location.
 |
|
setNodeName | | Sets the name of a node at the specified location.
 |
|
addNode | | Adds a node to the graph at the specified coordinates. The node can be given a name, which will be included in the data "find path" returns.
 |
|
deleteNode | | Deletes the specified node and all connections associated with it.
 |
|
graphList | | Returns a list of defined graphs.
 |
|
deleteGraph | | Deletes the specified graph.
 |
|
graphDefined | | Returns true if the specified graph is defined.
 |
|
mergePath | | Optimizes a list of nodes. mergePath searches for collinear nodes, eliminates interior nodes, and preserves only the endpoints.
 |
|
primCopy | | Creates a new graph with the specified name, which is the result returned by Prim's Algorithm.
 |
|