Template name in current macro, optionally as a relative folder path such as "buttons/top/attack".
Required · Positional only
No default
Returns
Template
Behavior / side effects
Template image wrapper. You can scale/crop an existing template, save it as a new template name, or check existence.
Execution
Blocking: Conditional
Thread safety: Not guaranteed
Parallel execution: Conditional
Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.
Example
base = Template("enemy_head")
variant = base.scale(0.9).crop(Region(0, 0, 64, 64)).save_as("enemy_head_small")
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
Related APIs
None
Fields
Name
Description
nameString?
Template name or relative folder path when this object points to a named template in current macro.
Constructor example
base = Template("enemy_head")
Methods
5 methods
Template.exists
Static Method
Check whether a template name exists in the current macro.
Syntax
Template.exists(name)
Parameters
Name
Description
nameString
Template name or relative folder path to check.
Required · Positional or named
No default
Returns
Boolean — true if the template exists.
Behavior / side effects
Check whether a template name exists in the current macro.
Execution
Blocking: Conditional
Thread safety: Not guaranteed
Parallel execution: Conditional
Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.
Example
if Template.exists("enemy_head"):
text("ready")
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
Check whether this Template object still points to an existing file.
Syntax
template.exists()
Parameters
None
Returns
Boolean — true if the backing template file exists.
Behavior / side effects
Check whether this Template object still points to an existing file.
Execution
Blocking: Conditional
Thread safety: Not guaranteed
Parallel execution: Conditional
Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.
Example
t = Template("enemy_head")
if t.exists():
text("ok")
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
Create a scaled template copy and return it as another Template object.
Syntax
template.scale(scale, scale_y=None)
Parameters
Name
Description
scaleNumber
Scale factor for X axis (and Y axis when scale_y is omitted).
Required · Positional or named
No default
scale_yNumber
Optional Y-axis scale factor.
Optional · Positional or named
Default:scale
Returns
Template — Scaled template object.
Behavior / side effects
Create a scaled template copy and return it as another Template object.
Execution
Blocking: Conditional
Thread safety: Not guaranteed
Parallel execution: Conditional
Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.
Example
t = Template("enemy_head")
small = t.scale(0.8)
hit = Region(0, 0, 1080, 2400).find(small, 3000)
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
Crop this template by a region in template-local pixels and return a new Template object.
Syntax
template.crop(region)
Parameters
Name
Description
regionRegion
Crop region in template-local coordinates.
Required · Positional or named
No default
Returns
Template — Cropped template object.
Behavior / side effects
Crop this template by a region in template-local pixels and return a new Template object.
Execution
Blocking: Conditional
Thread safety: Not guaranteed
Parallel execution: Conditional
Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.
Example
t = Template("enemy_head")
face = t.crop(Region(10, 10, 60, 60))
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
Save this template object into current macro templates using a new name or relative folder path.
Syntax
template.save_as(name)
Parameters
Name
Description
nameString
New template name, optionally including folders such as "buttons/top/attack".
Required · Positional or named
No default
Returns
Template — Saved named template object.
Behavior / side effects
Save this template object into current macro templates using a new name or relative folder path.
Execution
Blocking: Conditional
Thread safety: Not guaranteed
Parallel execution: Conditional
Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.