Here is a widget that improves the autoretreat feature
https://pastebin.com/UhHyAtvQ What it adds
[Spoiler] (settings under Settings → Unit Behaviour → Auto Retreat Plus):
Enemy avoidance: each visible enemy gets a danger circle of weapon range + its speed × a reach time (default 2 s) + a margin. Retreating units are routed around these circles, and the route is recalculated as enemies move.
It only counts weapons that can hit the retreating unit, so ground units ignore anti-air and gunships avoid it.
Unidentified radar dots count as a small generic threat.
Long-range artillery is ignored, since you can't walk around it.
Stop while being repaired (on by default): a retreating unit that a constructor is repairing stops and waits. It keeps running if it's inside an enemy's danger circle or taking damage. Once the repair has stopped for 1.5 s, it moves on.
Go back to where it was: a toggle. It's on by default to match the built-in behaviour; turn it off and units stay in the retreat zone at full health.
Return to patrol route (on by default): the patrol points are recorded when the retreat starts. If the patrol orders are gone at full health, the unit walks back onto the loop and patrols it again.
Retreat zone engineers (on by default): idle constructors inside a retreat zone, including ones that retreated there, repair damaged allies in reach. Retreating units go first, then the most damaged.
They walk up to 150 elmos past their build range to reach a unit, then walk back.
Route display: selected retreating units show their planned route.
bonus widgets , lotus script and eco helper (sets storages to high priority if excessing and sets energy buildings to high priority if stalling energy)
eco helper
https://pastebin.com/xz4aHLeLlotus script ( dont use in large team games due to lag )
https://pastebin.com/LYW3Lx0N