There are many and manifold way to setup a good, but the easy to explain and grasp I think is a simple array. To set it up you'll need an array, which I will just define as a fixed length list of elements. Elements being individual units that make up the array. I'll define these units, elements, as a name and command pair. So if I had an array ten elements long, it would look something like this in a attribute list:
element_0_name
element_0_command
element_1_name
element_1_command
element_2_name
element_2_command
element_3_name
element_3_command
element_4_name
element_4_command
element_5_name
element_5_command
element_6_name
element_6_command
element_7_name
element_7_command
element_8_name
element_8_command
element_9_name
element_9_command
The first step in creating a fixed array is populating it with actual stuff to do. So, I'll do that now.
element_0_name = Element 0
element_0_command = Element 0 clicked
element_1_name = Element 1
element_1_command = Element 1 clicked
element_2_name = Element 2
element_2_command = Element 2 clicked
element_3_name = Element 3
element_3_command = Element 3 clicked
element_4_name = Element 4
element_4_command = Element 4 clicked
element_5_name = Element 5
element_5_command = Element 5 clicked
element_6_name = Element 6
element_6_command = Element 6 clicked
element_7_name = Element 7
element_7_command = Element 7 clicked
element_8_name = Element 8
element_8_command = Element 8 clicked
element_9_name = Element 9
element_9_command = Element 9 clicked
Currently those wouldn't do more then creatively name the buttons element <0-9> and make anyone that click on them say the words "command <0-9>". For the example so far, they don't have to. Next, you need some way to display the menu. There are a couple ways to do that, but the simplest is just brute force. Have a ability macro that as a preset chain of abilities on the character sheet, which I'm going to name 'menu', storing all the above abilities:
Array_0 = [@{element_0_name}](!
@{element_0_command})
Array_1 = %{menu|Array_0}[@{menu|element_1_name}](!
@{menu|element_1_command})
Array_2 = %{menu|Array_1}[@{menu|element_2_name}](!
@{menu|element_2_command})
Array_3 = %{menu|Array_2}[@{menu|element_3_name}](!
@{menu|element_3_command})
Array_4 = %{menu|Array_3}[@{menu|element_4_name}](!
@{menu|element_4_command})
Array_5 = %{menu|Array_4}[@{menu|element_5_name}](!
@{menu|element_5_command})
Array_6 = %{menu|Array_5}[@{menu|element_6_name}](!
@{menu|element_6_command})
Array_7 = %{menu|Array_6}[@{menu|element_7_name}](!
@{menu|element_7_command})
Array_8 = %{menu|Array_7}[@{menu|element_8_name}](!
@{menu|element_8_command})
Array_9 = %{menu|Array_8}[@{menu|element_9_name}](!
@{menu|element_9_command})
Everything to date, had just been getting the buttons in the chat window, and a means to selectively display a fixed number of buttons. It hasn't gotten anywhere near a functioning program or complete GUI. There is where the need to change what each element's name and command are, and the API comes in. Each button command would need to run a tricky to coded macro or call a API script. First the do or evaluate something (the whole point of a GUI). Then to reset the name and command of each element, and redraw the menu with by calling the correct ability Array_<0-9> to create new buttons updated buttons.
For example, You could create a API script make a basic menu labeling the element_0_name "swing a weapon", element_1_name "cast a spell", Having element_0_command element_1_command run a separate API scripts. Then calling Array_1. When each button is clicked the run script to reset the menu to "Power attack with mace +1" or "Cast magic missile at the darkness" and refresh the buttons.
It's not super efficient, and bare bones. It is the basic idea of a interactive interface. (You could do some of this without the API, but not nearly as much or without huge sums of data entry.) Questions?