An important consideration is that there are various things that scripts do that custom functions can't, and various things custom functions can do that scripts can't (esp with respect to where and how you can use them). So in fact the number of cases where you have a problem that could be solved in its entirety by either a script or a custom function is a fairly small subset of the possible development scenarios you will face.
Essentially, scripts do calculations along with a host of other things, but depend on the interface and must be called (explicitly or implicitly) procedurally. Custom functions *only* do calc tasks but can be called from within code anywhere in your solution (in schema as well as in interface and even within scripts).
So the cases where your question arises exist but are a minority (i.e. only a minority of scripts could be replaced in their entirety by custom functions, and vice versa).
Having said that, my view is that there is no absolute answer. Some of the things that can be done (adequately and completely) by either a script or a custom function are much better done with a script. Others may be better (more cleanly, easily or efficiently) done using a custom function, and with just a few it's evenly balanced. Even then, the choice would depend on the context - the demands of the solution or the client, access to FileMaker Pro Advanced, modularity of the code - and also on the personal preferences and skill set of the developer.
In short, while I think it's an interesting question to pose, I don't believe there's a simple or single answer for all cases.
R J Cologon, Ph.D.
Director of Development
NightWing Enterprises, Melbourne, Australia
Custom Functions (CF) as the name implies are based on the paradigm of functional programming which has many advantages like side-effect free coding (if you don't assign global variables) easy to debug and easier to proof correctness. where scripts are based on the concept of procedural programming with its purpose of side effects (changing contexts, data etc.) . proof of correctness highly complex etc .. all very well explained on the web ..
IMHO: Do as much as you can in custom functions - context free - since filemaker is highly context sensitive try to express as much as possible within functions and using scripts where the limitations of CFs (max of 50.000 sub-calls) and assigning of values can't be accomplished.
Custom Functions (I call them CusFun - because sometime you was to curse at them and sometimes they are a barrel of laughs!)
It's easier to debug a script if you break the parts into separate steps (such a setting variables). However, if you find that you have the *perfect* script and it could be converted to a Custom Function and you need to call the function many times, then by all means create the CusFun!!
Just remember that the _creation_ of Custom Functions requires FileMaker Pro Advanced and most users may only have FMPro. Once created (by FMPro Advanced) and installed in a database, all users can call the Custom Function.