Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account
This post has been closed. You can still view previous posts, but you can't post any new replies.

Graphical user interface

September 01 (9 years ago)

Edited September 01 (9 years ago)
I find my self with a idea that I can't currently implement. (Life happens.)

I learned how to make chat buttons to run commands from Silvyre, link.
I learned you can use attribute fields to store and run macros (AKA RAM and CPU cache) from Dalton H., link.
I learned that the API can adjust and question properties (AKA push and pop) of a character sheet from the wiki, link.

If there are any computer science geeks out there that are even vaguely familiar the inner works of C/C++ or assembly, you just learned you can make chat bound, but complete graphical user interface systems in Roll20. (Something in the vein old school text based adventures like Zork, but ...) I thought I'd share that gem as I can't act on it (yet).

How? (It's 4:42AM here, I'm sleep drunk and it's not quite master's level computer science.) I'll post more when time permits, but hey! GUI! Thought I'd toss that seed out there...
September 01 (9 years ago)
The Aaron
Pro
API Scripter
=D   I've mentioned before that now that we have API buttons it would be fun to implement Zork as a chat panel game.  Similarly though, I haven't the time for it.  
September 01 (9 years ago)

Edited September 01 (9 years ago)
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?
September 02 (9 years ago)
Lithl
Pro
Sheet Author
API Scripter

The Aaron said:

=D   I've mentioned before that now that we have API buttons it would be fun to implement Zork as a chat panel game.  Similarly though, I haven't the time for it.  
The C source for the original Zork is in the public domain, I believe. (Or if it isn't actually PD, it's widely available anyway.) You you just have to translate the C into JavaScript, and then massage it into something Roll20 can work with. =P