# Semicolon; Advanced GIF Animator
## Overview
The GIF Animator system allows you to animate textures on a prim using sprite sheets (textures arranged in grids). It supports configuring multiple animated textures, switching between them by menu or via another prim (button), and saving all animation settings per texture.
---
## Main Features
- **Animated GIF effect via sprite sheet**: Animate any texture with grid frames.
- **Multiple texture configurations**: Save unique frame and FPS settings for each texture.
- **Texture switching**: Instantly swap between different configured textures using a button or menu.
- **Face selection**: Choose which prim face to animate.
- **Resizing options**: Change prim size via menu.
- **FPS control**: Adjust animation speed.
- **Owner-only controls**: Only the object's owner can use the menus or switch textures.
---
## How to Use
### 1. Setup
- Place the **GIF Animator script** in the target prim (the one displaying the animation).
- Place your sprite sheet textures (must be full permissions) in the same prim's inventory.
- Place the **Texture Switcher script** in a different prim (the button/controller), and set the `screen_link_num` variable to the link number of the animated prim.
- Link the button and the screen prim together (button must not be the root prim).
---
### 2. Using the Menu (Owner Only)
**Touch the animated prim** to open the menu. The menu offers:
- **Done**: Close the menu.
- **Select Face**: Choose which face (0-7) to animate.
- **Textures**: Select a texture to configure or animate.
- **FPS Options**: Adjust or reset animation speed (frames per second).
- **Adjust Length**: Resize the prim (10% increments, height/width adjustment).
**Texture Configuration:**
- When you select a texture, you can:
- **Edit X Frames**: Set how many frames horizontally.
- **Edit Y Frames**: Set how many frames vertically.
- **Edit Total Frames**: Total frames in the animation.
- **Save**: Save current settings for this texture.
- **Cancel**: Return to previous menu.
Each texture keeps its own configuration.
---
### 3. Switching Textures with a Button
- **Touch the button prim** (with Texture Switcher script) to switch to the next configured texture on the animated prim.
- Only the owner can use this button.
---
## Functions Summary
### In the GIF Animator Script
- `saveConfigs() / loadConfigs()`: Save/load texture animation settings in the prim's description.
- `showMenu(key user)`: Main menu dialog.
- `showMenuFace(key user)`: Select face dialog.
- `showMenuTextures(key user)`: Texture selection dialog.
- `showTextureConfigMenu(key user, string texture)`: Configure frames and FPS for a selected texture.
- `setCurrentTextureConfig(string texture)`: Load config for a texture or initialize if new.
- `saveCurrentTextureConfig(string texture)`: Save config for a texture.
- `startAnim()`: Start animation with current settings.
- `applyTextureByIndex(integer index)`: Switch to a texture by index (used for button switching).
### In the Texture Switcher Script
- **Sends a link message** (`"TROCA_TEXTURE"`) to the animated prim to switch to the next texture.
---
## Tips & Notes
- **Sprite sheets** must have frames arranged in a grid. Configure X (horizontal) and Y (vertical) frames to match your image.
- **Total Frames** should match the number of frames in your sprite sheet.
- **Owner-only**: Only the object owner can access controls or switch textures to prevent griefing.
- The system saves all configuration (per texture) in the prim description. Do not overwrite the description manually.
- The button prim must have its `screen_link_num` correctly set to target the animated prim.
---
## Troubleshooting
- **Menu not showing?** Make sure you're the owner.
- **Textures not animating?** Check if X, Y, and total frames match your sprite sheet layout.
- **Switch button not working?** Ensure correct link number and that both scripts are present and running.
