# Editor

> Aego 0.12.5 · development; docs build `4a32b816933e02930662f6a443cb25abe6050d090c55e237cbff5c44ae9b25f8`. [Build manifest](/docs-build.json).

The editor's code editor, navigation, completion, hover, library stubs, Problems panel and Profiler sections for scripts are described in [Editor](/editor.md). Unsaved edits are analysed but never run; autosave writes them one second after the last keystroke, on focus loss and before Play.

Run it: in the code editor, hover over `Turret`, `Range` or `Rate` to see the comments above them; the Inspector groups the fields by `category`.

```aes run
package demo

import "aego/log"

// Turret aims at the nearest target. This comment is shown on hover.
script Turret {
    // Range is how far the turret sees, in world units.
    @export(min=0, max=20, unit="u", category="Aim")
    var Range float = 8

    // Rate is shots per second.
    @export(min=0.1, max=10, category="Fire")
    var Rate float = 2

    var cooldown float
    var shots int

    func Update(dt float) {
        cooldown -= dt
        if cooldown <= 0 {
            cooldown = 1 / Rate
            shots++
            if shots % 2 == 0 {
                log.Info("shot " + string(shots) + " at range " + string(Range))
            }
        }
    }
}
```
