RolePlay onLine RPoL Logo

, welcome to Heaven - Gaming Resources

00:06, 14th December 2024 (GMT+0)

RPoL Tutorials/Scripts (user developed)

Posted by SkaldFor group 0
Skald
GM, 60 posts
RPoL Moderator
Sun 24 Sep 2017
at 05:16
  • msg #1

RPoL Tutorials (user developed)

General RPoL GMing tutorial - link to a message in another game
Skald
GM, 83 posts
RPoL Moderator
Sat 25 Jul 2020
at 05:17
  • msg #2

JS bookmarklet to apply multiple tags to text - by Rathmun

JAVASCRIPT BOOKMARKLET FOR APPLYING MULTIPLE TAGS TO TEXT - BY RATHMUN

When certain characters or situations routinely call for a combination of tags, placing all of them every time can grow awkward and result in mistakes.  For example, if a character uses periwinkle as their voice color, and usually speaks Elven, then you're left applying both tags to all their speech every time.

Most modern browsers support something called a "bookmarklet", where you can place javascript in the destination URL field of a bookmark, which will be executed on the current page when you click on it.  This allows the creation of a single button to apply any number of tags to a selected section of text.

The base form for this useful script is as follows.
javascript:(function(a){a.value=a.value.slice(0,a.selectionStart)+"YOUR STARTING TAGS GO IN THESE QUOTES"+a.value.slice(a.selectionStart,a.selectionEnd)+"YOUR ENDING TAGS GO IN THESE QUOTES"+a.value.slice(a.selectionEnd);})(document.activeElement);

Here are a few examples to illustrate usage.

For a character who speaks with green text, and usually in the Elven language, it would be as follows.
javascript:(function(a){a.value=a.value.slice(0,a.selectionStart)+"[Language Elven: <Green>"+a.value.slice(a.selectionStart,a.selectionEnd)+"</Green>]"+a.value.slice(a.selectionEnd);})(document.activeElement);

For a pixie speaking with small periwinkle text, this will work.
javascript:(function(a){a.value=a.value.slice(0,a.selectionStart)+"<Small><Periwinkle>"+a.value.slice(a.selectionStart,a.selectionEnd)+"</Periwinkle></Small>"+a.value.slice(a.selectionEnd);})(document.activeElement);

Or perhaps you want something for Signage.
javascript:(function(a){a.value=a.value.slice(0,a.selectionStart)+"<Mono><smallcaps><b>"+a.value.slice(a.selectionStart,a.selectionEnd)+"</b></smallcaps></Mono>"+a.value.slice(a.selectionEnd);})(document.activeElement);

To use these, simply create a bookmark, place the script in the destination field, and name the bookmark as you wish.  Personally I usually use the name of the character who uses that set of tags.
Skald
GM, 95 posts
RPoL Moderator
Sat 20 Jan 2024
at 08:45
  • msg #3

Easy Tables and Grids Tutorial - by Horus

Easy Tables and Grids Tutorial - link to a message in another game
Sign In