# Autoplay override

Watches the autoplayer's chosen shot and, when it is about to play, forces a small extra top spin so the cue ball follows through. This is a minimal tweak; the autoplayer still picks the angle and target.

```lua
-- a menu toggle so this can be switched off without unloading the script
local nudge = ui.new_checkbox("Lua", "Pool", "Follow-through spin")

client.set_event_callback("paint", function()
  if not ui.get(nudge) then return end

  local ap = pool.autoplay()
  -- only act when the autoplayer actually has a shot chosen
  if not ap.has_choice then return end

  local c = ap.choice
  -- reuse the chosen angle, power and target; only override the english (spin).
  -- english.y is top/bottom spin, -1..1; add a little top spin, clamped.
  local top = math.min(1.0, (c.english and c.english.y or 0) + 0.25)

  pool.override_shot({
    angle = c.angle,
    power = c.power,
    english = { x = c.english and c.english.x or 0, y = top },
    pocket = c.pocket,
  })
end)

-- drop the override when the feature is switched off, so the autoplayer is free again
ui.set_callback(nudge, function(item)
  if not ui.get(item) then pool.clear_override() end
end)
```