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

Get Value From Colour Picker Or a Player Entered Value Plus Alternative to Roll Template

Hi folks, I am working on a feature to allow players and GM to control various characteristics of the map they are on.&nbsp; I'm currently using a roll template where the buttons launch map hex related API commands from a script that I developed after searching the forum as to whether I could have players affect their grid properties and finding this from DriftingNitro with help from The Aaron. <a href="https://app.roll20.net/forum/post/8318133/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/8318133/slug%7D</a> Here's what I have now and all works well as the GM and using a separate player account in a private window.&nbsp; "Current Configuration" has been clicked and the chat results show below it.&nbsp; The other API commands for gridlabels true/false, showgrid true/false, and set to defaults (my defaults) work fine. Two Questions concerning the API: Can the colour picker normally found in various dialogs be invoked and the colour code be retrieved so the API can apply it to gridcolor? Can an input box or slider of some sort be generated to take a number and apply it to grid_opacity? Finally, is there some other way to give the player buttons in the chat text window besides the roll template?&nbsp; This one is not an urgent issue and at the moment I am using a token menu item to call the macro for the roll template. Thanks in advance for any guidance, -- Tim
1600966627
GiGs
Pro
Sheet Author
API Scripter
Tim M said: Two Questions concerning the API: Can the colour picker normally found in various dialogs be invoked and the colour code be retrieved so the API can apply it to gridcolor? Can an input box or slider of some sort be generated to take a number and apply it to grid_opacity? Finally, is there some other way to give the player buttons in the chat text window besides the roll template?&nbsp; This one is not an urgent issue and at the moment I am using a token menu item to call the macro for the roll template. There's no way to generate dialogs in roll20 other than the standard query dialog which contains just a single textbox or dropdown, and you cant easily generate even those from an API script. You need to post a button to chat, so that there is a "player context" when the button is clicked. So the answer to your first question is no. The answer to your second question is also no, because we have no access to directly modifying CSS. CSS does support templates, so you could have preset values, and then have those values stored in an attribute, and then use the class of the input that contains that attribute to set the specific CSS you want. See Jakobs Better Default roll Template in the wiki for an example of this. It's very convoluted, and you need to have all possible values set up ahead of time. It's not truly dynamic. For your question about rolltemplates and buttons. You can print a button to chat without a rolltemplate - and text printed to chat can include a button.
GiGs said: Really appreciate the quick reply.&nbsp; I'll probably put in raise and lower "contrast" buttons for grid_opacity to step it up .05 or .1 at a time.&nbsp; Perhaps a few basic colour choices.