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

[Script] Easy-Utils

1734954420

Edited 1734958297
I created a script called   Easy-Utils , a library of basic functions designed to help speed up the process of making Roll20 mods. There's also an example script,   easy-util-menu.js , that demonstrates how to use the library in a practical way. easy-utils.js easy-utils-menu.js Features 1.   Dynamic Module Loading Dynamically load and manage utility functions. Its uses closures to customize functions for the retrieving module and memory efficinecy. Avoid redundant code with a centralized, reusable library. A special global Object called a Forge contains Factories that present API for specialized use across all APi scripts making use of EASY_UTILS. These factories are Phrase, Template, and Theme factories. 2.   Advanced Logging System Log messages in a structured, syslog-like format to enhance debugging and traceability. Multilingual logging support through   PhraseFactory . 3.   Translation Support Integrate with   PhraseFactory   to support multilingual scripts. Players can select from available languages that they want their whispers displayed in. Multilingual AT THE SAME TIME. Script makers can upload custom dictionaries for different languages. dictionaries that are not used by any players are unloaded form memory. 4.   Use CSS and HTML 4.   Use CSS and HTML There is a collection of functions that make working with raw HTML and CSS easy. The CSS works with universal (*), Element, Ids, Class, Attributes, :root and nth-child pseudo classes More rules can be added in the future You can use handle bar expressions   {{ ... }}   in HTMl templates for placeholders. You can use   var()   in CSS to apply universal color palettes. *Note the menu is different for GMs. 5.   Override Templates and Themes Replace template expressions ( {{..}} ) and CSS variables to override colors and structure. Reuse the same HTML template and CSS theme to display different types of messages. With players picking their own language, or defaulting to every "EASY" module to a different language. 6.   Developer Convenience Functions like   logSyslogMessage   enable structured and consistent logging across scripts. Quickly build new APi scripts using a shared library of utility functions. easy-utils-menu.js   is an example of how a mod might look.
1734981061
Gold
Forum Champion
Thanks for your hard work & sharing,  Mhykiel 
I have updated the Utils to include  "convertMarkdownToHtml" function. It converts markdown into HTML that can then be used with CSS to stylize content. You can see a working script here: easy-markdown-handouts.js There are still some bugs to work out when it comes to dealing with code blocks. I think that has to do with the encoding and decoding from handouts. There is another beautiful script made by Stephen S. markdownDocumentation Which I have been using myself. However, this code here in Easy-Utils is different than Stephen's.
1735157397
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
This is very intriguing. I am running into issues with Stephen's script under Jumpgate.
keithcurtis said: This is very intriguing. I am running into issues with Stephen's script under Jumpgate. Hello Keithcutis, You were one of the "Shoulder's of Giants" I stood upon to make these mods. I just tested in Jumpgate and the conversion actually looks BETTER! With the only real issue being inline code blocks, which I think I can fix by escaping special characters inline as well. I really liked Stephens script, I plan to make something very similar soon. Thank you for taking time to look at my code and implementation.