Skip to content

Instantly share code, notes, and snippets.

@keithcurtis1
keithcurtis1 / gmnote.js
Created June 12, 2018 06:41
This pulls the GM notes from a token on Roll20 and whispers them to the chat
on('ready',function(){
'use strict';
const decodeUnicode = (str) => str.replace(/%u[0-9a-fA-F]{2,4}/g,(m)=>String.fromCharCode(parseInt(m.slice(2),16)));
on('chat:message',function(msg){
if('api' === msg.type && msg.content.match(/^!gmnote/) && playerIsGM(msg.playerid) ){
let match=msg.content.match(/^!gmnote-(.*)$/),
regex;
@keithcurtis1
keithcurtis1 / CharNotes.js
Last active June 15, 2018 16:29
this calls the Bio Tab notes of a character and whispers them to the GM
//!cbio
//!cgmnotes
//!cbio-Some Line Beginning
//!cgmnotes-Some Line Beginning
on('ready',function(){
'use strict';
const decodeUnicode = (str) => str.replace(/%u[0-9a-fA-F]{2,4}/g,(m)=>String.fromCharCode(parseInt(m.slice(2),16)));
@keithcurtis1
keithcurtis1 / PCNotes.js
Last active June 15, 2018 16:30
This calls the Bio of a character, but sends it openly to the chat.
//!cbio
//!cgmnotes
//!cbio-Some Line Beginning
//!cgmnotes-Some Line Beginning
on('ready',function(){
'use strict';
const decodeUnicode = (str) => str.replace(/%u[0-9a-fA-F]{2,4}/g,(m)=>String.fromCharCode(parseInt(m.slice(2),16)));
@keithcurtis1
keithcurtis1 / ShapedTempHP.js
Created March 28, 2019 14:39
Constrains HP to 0-Max, and applies dead status to Shaped Roll20 token
/* global TokenMod, ChatSetAttr */
on('ready', () => {
// Configuration parameters
const HPBarNum = 1;
const TempHPMarker = 'yellow';
const DeadMarker = 'dead';
const TempHPAttributeName = 'temp_hp';
/////////////////////////////////////////////
[css]
bg {
background-image: url('https://i.imgur.com/vjL1blE.jpg');
padding: 30px;
!chatmenu @{selected|character_id} {template:npcaction}{{rname=@{selected|character_name}}}{{name=@{selected|class_display}
@{selected|race_display}, @{selected|background}
**Jump** - Long [[(@{selected|strength}/2)]] / [[@{selected|strength}]]ft. | High [[((@{selected|strength_mod}+2)/2)]] / [[@{selected|strength_mod}+2]] ft.
**HP: **@{selected|hp} / @{selected|hp|max} | ** AC: ** @{selected|ac} | **Spd: ** @{selected|speed} | **Passive: ** @{selected|passive_wisdom}}}{{description=CHATMENU }} --separator: |   --title:Ability Rolls --**Str @{selected|strength}** *(@{selected|strength_mod})* ,strength|**Dex @{selected|dexterity}** *(@{selected|dexterity_mod})*,dexterity|**Con @{selected|constitution}** *(@{selected|constitution_mod})* ,constitution|**Int @{selected|intelligence}** *(@{selected|intelligence_mod})* ,intelligence|**Wis @{selected|wisdom}** *(@{selected|wisdom_mod})*,wisdom|**Cha @{selected|charisma}** *(@{selected|charisma_mod})*,charisma --title:Saving Throws --Str,strength_save|Dex,dexterity_
!chatmenu @{selected|character_id} {template:npcaction}{{rname=@{selected|character_name}}}{{name=@{selected|npc_type}
**HP: **@{selected|bar1} / @{selected|hp|max} | ** AC: ** @{selected|npc_ac} | **Spd: ** @{selected|npc_speed}
**Languages: **@{selected|npc_languages}
**Senses: **@{selected|npc_senses}
 **Resists:: **@{selected|npc_resistances}
 **Immune: **@{selected|npc_immunities}
 **Cond. Immune: **@{selected|npc_condition_immunities}}}{{description=CHATMENU}} --separator: | --title:Ability Rolls --**Str @{selected|strength}** *(@{selected|strength_mod})* ,strength|**Dex @{selected|dexterity}** *(@{selected|dexterity_mod})*,dexterity|**Con @{selected|constitution}** *(@{selected|constitution_mod})* ,constitution|**Int @{selected|intelligence}** *(@{selected|intelligence_mod})* ,intelligence|**Wis @{selected|wisdom}** *(@{selected|wisdom_mod})*,wisdom|**Cha @{selected|charisma}** *(@{selected|charisma_mod})*,charisma --title:Saving Throws --Str,npc_str_save|Dex,npc_dex_save|Con,npc_con_save|Int,npc_in
EXPAND ALL SPELLS
!setattr --sel --mute --repeating_spell-cantrip_$0_details-flag|''
!setattr --sel --mute --repeating_spell-cantrip_$1_details-flag|''
!setattr --sel --mute --repeating_spell-cantrip_$2_details-flag|''
!setattr --sel --mute --repeating_spell-cantrip_$3_details-flag|''
!setattr --sel --mute --repeating_spell-cantrip_$4_details-flag|''
!setattr --sel --mute --repeating_spell-cantrip_$5_details-flag|''
!setattr --sel --mute --repeating_spell-cantrip_$6_details-flag|''
!setattr --sel --mute --repeating_spell-cantrip_$7_details-flag|''
!setattr --sel --mute --repeating_spell-cantrip_$8_details-flag|''
@keithcurtis1
keithcurtis1 / Token Actions
Last active January 4, 2022 06:58
Creates token action buttons for every action on a D&D5e for Roll20 NPC Sheet, or does the same for every attack on a PC sheet. I did not write this (Kevin did), but modified it to reduce less-used buttons. Command is !ta Original source is https://app.roll20.net/forum/post/5608775/script-update-tokenaction-creator-for-5e-ogl-sheet-version-2-dot…
var tokenAction = tokenAction || (function() {
'use strict';
var version = '0.2.5',
sheetVersion = '5th Edition OGL by Roll20 2.0',
checkInstall = function() {
log('TokenAction v'+version+' is ready! Designed for use with the '+sheetVersion+' character sheet!');
},
@keithcurtis1
keithcurtis1 / Lighting Macro
Last active March 11, 2023 17:18
DEPRECATED. THIS WAS FOR THE OLD LIGHTING SYSTEM. DO NOT USE. This requires the Token-Mod API script to be installed. This creates buttons for controlling common lighting and vision settings, and is intended to be inserted into a roll template for use as a chat menu..
BARE MACRO
[Snuff](!token-mod --set light_otherplayers|off light_radius|0 light_dimradius|0 light_angle|360) | [Sight](!token-mod --on showname light_hassight light_angle|360) | [Blind](!token-mod --off showname light_hassight light_angle|360) | [Spot](!token-mod --set light_otherplayers|on light_radius|5 light_dimradius|0 light_hassight|on light_angle|360) | [GM](!token-mod --set light_otherplayers|off light_hassight|off light_radius|5 light_dimradius|5 light_angle|360)
[Moonlight](!token-mod --set light_otherplayers|on light_radius|15 light_dimradius|=-15 light_angle|360) | [Starlight](!token-mod --set light_otherplayers|on light_radius|7 light_dimradius|=-15 light_angle|360) | [Touch](!token-mod --set light_otherplayers|on light_radius|4 light_dimradius|=-5 light_angle|360)
[Candle](!token-mod --set light_otherplayers|on light_radius|5 light_dimradius|0 light_angle|360) | [Lamp](!token-mod --set light_otherplayers|on light_radius|30 light_dimradius|15 light_angle|360) | [Torch](!token-mod --set light_other