Harlowe doesn't have any sort of clamping function, but you can shorten your expressions using the (min:) macro. For example:
(set: $points to (min: $points + 1, 20))
You could use a (display:) macro to do the deed quickly as well. Say you write a passage called "check points" and put this in it:
{
(if: $points > 20)[
(set: $points to 20)
]
}
Then when you raise your points, you can do this:
(set: $points to it + 1)
(display: "check points")
The other alternative is to use a header- or footer-tagged passage and include basically the same code as in the "check points" passage, but this will not prevent the number of points from going over twenty at any time, only when passages change, meaning its not really ideal for this purpose.
The other potential solution is to write a JavaScript function that clamps things for you, but this is probably overkill.
window.clamp = function (val, max) {
max = max || 20;
return (val > max) ? max : val;
};
Then, in your passage code:
(set: $points to clamp($points + 1))
Note that I didn't test any of these, so it's possible I made an error in logic or syntax.