Now it is time to add some actions to those buttons. First lets do the getvert_button. Type:
on GetVert_Button pressed do (Alright, a lot to explain here. The buttons work this way, you hit a button and the script looks through the defined "on statements" for what to do when that button is pushed.
parentOBJ = $
vertnum = (getvertselection parentOBJ)
vertnumL.text = "Vertex Number: " + (vertnum as string)
VertPicked = true
if ChildPicked == true do LinkME_Button.enabled = on
) -- Close on GetVert
This piece of script does this, "on Button_Name pressed do (........)"
is the generic form of the action. The only thing different with ours is we substituted GetVert_Button in for Button_Name.
It is easy to remember the syntax too. It is a shorten version of "When the button _____ is pressed do the following" All buttons, spinners, checkboxs, etc have syntax similar to this, however each one is slightly different.
The next line is "parentOBJ = $". The "$" is the character for
"the currently selected object". Since you are getting the selected object's vertex the script needs to know what object it is.
The "parentOBJ" is just a variable that I am assigning that object to.
So in the scene I provided, the parentOBJ will be the box. Now the next line is a little tricky.
"vertnum = (getvertselection parentOBJ)" this assigns the vertex that is currently selected with the meshselect or editmesh modifiers to the variable "vertnum". The "getvertselection parentOBJ"
this is the actual function that gets the vertex number.
getvertselection takes one parameter (a mesh), in this case it is our parent object or the box.
The getvertselection function gives an array (fancy name for a list) back of all the selected vertices. Since we are only going to select one vertex the array will only have one number in it. This is where the "" comes in. An array in MAXScript looks like this #(1,3,69,13).
To access the individual numbers in this array we use the following syntax.
Myarray This will output 1, the first number in the array. Or Myarray will output 3 or the second number in the array.
Since the getvertselection gives us the vertex in an array we have to extract that vertex number from the array.
By extracting the integer we can deal with a number (or integer) instead of a list of numbers. This is why the  is at the end of it. It outputs the first and only number in the array (our vertex) as an integer and saves it as the variable vertnum.