If you want to implement it on your own you could try this:
(IMHO you only learn if you do so. However if you only copy&paste stuff from one script to another this "won't end well" 🙃 and you're better of asking the original author if he's willing to adjust it for you.)
To do so you can adjust the approach of the dialogs pagination in the Menu() function. You put the index of the animation name (in the animation_names list) on the button and add a line with this index + animation name to the text field of the dialog. (+1 to make it more "human readable")
e.g. Instead of using llListInsertList(...) you can use a loop to generate the button and text field strings and concatenate them into the variables.
// global
list animation_names = [(...)];
Menu()
{
list buttons = ["<<", ">>", "Stop"];
string text = "Choose Animation:\n";
(...)
for(i = start; i <= end; i++) {
string anim = llList2String(animation_names, i);
buttons += [(string)(i+1)];
text += (string)(i+1) + ": " + anim + "\n";
}
llDialog(..., text, buttons, ...);
}
Where start and end are the first and last index to be displayed on the current page. (I haven't checked the original code if the variables there really satisfy these requirements.)
You also have to keep in mind, that the dialog now returns a number to listen(...). You can use this number (-1 see above) as an index in your animation list.
e.g.:
if((integer)msg > 0) {
integer index = (integer)msg - 1;
string anim = llList2String(animation_names, index);
(...)
}
HTH