# Script Layer Type

**URL:** https://community.aseprite.org/t/script-layer-type/12138
**Category:** Features
**Created:** [December 15, 2021, 8:25pm UTC](https://community.aseprite.org/t/script-layer-type/12138 "2021-12-15T20:25:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![surt](https://community.aseprite.org/user_avatar/community.aseprite.org/surt/32/7459_2.png) [@surt](https://community.aseprite.org/u/surt)
#### Post date: [December 15, 2021, 8:25pm UTC](https://community.aseprite.org/t/script-layer-type/12138/1 "2021-12-15T20:25:56Z")

</div>

Add the ability to assign a script per-layer to programmatically and non-destructively change the layer value during rendering.  
Either a dedicated Script Layer type which can contain other layers like a Group Layer or an additional layer property so that any layer type can contain a script.  
Lua is probably too slow to do anything too complex, but simple things should be doable.

# Script Entry Points:

- **Pre-render:** perform any expensive precomputations here
- **Per-tile (tilemap only):** takes the layer tile value and returns the script modified value
- **Per-pixel:** takes the current pixel’s composition result and layer pixel value and returns the script modified value
- **Gui:** optionally launch a script settings dialog

# Usage examples:

- Use on an extra Tilemap Layer for per-tile colour offset into subpalettes like NES the palette attribute table (can do this in Pro Motion with a layer effect)
- Similarly use for material mapping, grey scale to multiple colour ramps
- Autotiling by modifying tile value based on neighbours
