Decodes the given number String to an integer and writes it as one byte to the output stream.
If the number could not be decoded to an integer, or the integer would not fit in one byte, then the Form’s ErrorOccurred event is triggered and this method returns without writing any bytes to the output stream.
of course then the Arduino receives a number so don't mess up with it subtracting '1'. you want to check what you get (should be between integer 1 and 40 and in that case subtract the integer 1 and you get your index for the function (or send directly the value minus 1)
so what it do is when the click on each animation it shows list of 1 to 40 based on the variable global. when click the specific number those is the value of selection
if you don't fill them up, the there might be nothing selected and when you try to send that it fails.
(you should double check by the way that there is a selection before sending the command)