Well an important question in coding, one of if not the most important, is 'where does this functionality belong?'. When a piece of code (be it function or class or even application) starts developing an awareness of the world beyond it's very discrete purpose, that is a flashing neon sign that it is time to refactor.
So similar to how you refactor to introduce a configuration when it becomes clear a piece of information doesn't belong in the code, you will introduce scripting when it becomes clear that behaviour has no place in the code.
Where that line lies will depend on a lot of factors so is mostly a judgement call. Experience or requirements for a project can allow or force you to make that call early on. But in the absence of those, it simply becomes a matter of 'when it becomes appropriate'.