Skip to content

Custom guide

Draws its own aim line from the predicted trajectories, with the game’s own guide hidden. Calling pool.paths() keeps the predictor running even with the built-in guide toggled off, so this fully replaces it.

-- hide the built-in guide once, at load; we draw our own instead
pool.toggle("guide", false)
-- pick a colour per ball so lines are easy to tell apart
local function ball_color(number)
if number == 0 then return 235, 235, 235 end -- cue ball, white
if number == 8 then return 30, 30, 30 end -- 8 ball, black
return 90, 170, 255 -- everything else, blue
end
client.set_event_callback("paint", function()
-- paths() gives trajectories for the current aim and the last shot taken
local paths = pool.paths()
if not paths then return end
for _, path in ipairs(paths.shot) do
-- project each table-space point to overlay pixels
local screen = {}
for _, p in ipairs(path.points) do
local sx, sy = renderer.world_to_screen(p.x, p.y)
if sx then screen[#screen + 1] = { x = sx, y = sy } end
end
-- draw the polyline if we have at least two on-screen points
if #screen >= 2 then
local r, g, b = ball_color(path.number)
-- a ball that ends in a pocket is drawn brighter
local a = path.pocketed and 255 or 140
renderer.polyline(screen, r, g, b, a, 2)
end
end
end)