Getting the lower variable
From what I've found by Googling, I haven't found any built in Min/Max functionality, however you can easily write your own:

    to min(n1,n2)
       if n1 &lt; n2 then
--&gt; change "&lt;" to "&gt;" to make a max handler
           return n1
       else
           return n2
    end min


After you've written that function (called a handler in AS), whenever you need to set a variable to the lower of two values, you can:

set smallerNumber to min(numberOne, numberTwo)