I guess that the script records the damper position and when it pass a threshold divides the difference of position by the elapsed time between the two position, and it generates a Note Off (or register the Note Off velocity for the next Note Off).
Such a division could be imprecise, perhaps should we take the evolution between two non-consecutive damper-position.
Is this the used algorithm? Or should I know something else? It could be interesting to port it in a Reaper ReaJS script.