Skip to content

Instantly share code, notes, and snippets.


Thomas M. Edwards tmedwards

  • USA
View GitHub Profile
tmedwards /
Last active Aug 24, 2020
Date & Time Widgets for the Gregorian Calendar

Date & Time Widgets for the Gregorian Calendar

The widgets use the JavaScript Date object to provide the inner workings of a Gregorian Calendar (a.k.a. Christian/Western calendar).

Set the initial date to the date/time you want and all players should see the same game world dates and times.


The widgets within the date_time_widgets.txt file (see below) should be pasted into a widget tagged passage. After doing so, the initial game date/time must be set within the setup section. Each of the printing widgets may be customized.

tmedwards / sugarcube.d.ts
Last active Jul 25, 2020
sugarcube.d.ts — SugarCube v2 Ambient Module
View sugarcube.d.ts
sugarcube.d.ts — SugarCube v2 Ambient Module (for: v2.32.0, updated: 2020-07-25)
Copyright © 2020 Thomas Michael Edwards <>. All rights reserved.
Use of this source code is governed by a BSD 2-clause "Simplified" License.
tmedwards / binary-to-unicode.js
Last active Oct 21, 2019
Binary text to Unicode functions.
View binary-to-unicode.js
Functions to covert binary text to Unicode.
Param: `inputString` - Binary string to convert (1-byte per char).
Returns: The converted Unicode string.
setup.unicodeFromBinary(inputString) Unicode string.
Param: `inputString` - Binary string to convert (2-bytes per char).
Returns: The converted Unicode string.
tmedwards / textboxplus-macro.min.js
Created Jun 28, 2019
<<textboxplus>> macro for SugarCube v2
View textboxplus-macro.min.js
/*! <<textboxplus>> macro for SugarCube v2 */
!function(){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};if("undefined"==typeof version||void 0===version.title||"SugarCube"!==version.title||void 0===version.major||version.major<2||void 0===version.minor||version.minor<22)throw new Error("<<textboxplus>> macro requires SugarCube 2.22.0 or greater, aborting load");Macro.add("textboxplus",{isAsync:!0,tags:null,handler:function(){var _this=this;if(this.args.length<2){var errors=[];return this.args.length<1&&errors.push("variable name"),this.args.length<2&&errors.push("default value"),this.error("no "+errors.join(" or ")+" specified")}if("string"!=typeof this.args[0])return this.error("variable name argument is not a string");var varName=this.args[0].trim();if("$"!==varName[0]&&"_"!==varName[0])return this.error('variable n
tmedwards / snippet-phoenix-with-qn-qp.gcs
Created May 1, 2019
Code snippet to add QN/QP to the core attribute section of the Phoenix character sheet for GCA4.
View snippet-phoenix-with-qn-qp.gcs
'basic attributes'
'setup for the basic attributes & (optionally) Tech Level
CurrentY = CurrentTop
StatLeft = CurrentLeft
StatRight = StatLeft + SubColWidth
'print the basic attributes
PrimaryStats_RenderItem "ST", StatLeft, StatRight, StatHeight, True, True
tmedwards / t8n-typewriter-module-for-sugarcube-v2.js
Created Aug 9, 2018
t8n-typewriter module for SugarCube v2
View t8n-typewriter-module-for-sugarcube-v2.js
/*! t8n-typewriter module for SugarCube v2 */
!function(){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),Furl=function(){function Furl(current,append){if(_classCallCheck(this,Furl),Object.defineProperties(this,{node:{value:current},childNodes:{value:[]},value:{writable:!0,value:""},append:{writable:!0,value:!!append},abortTyping:{writable:!0,value:!1}}),this.node.nodeValue&&(this.value=this.node.nodeValue,this.node.n
tmedwards / sc-i18n-example-2.twee
Last active Jul 26, 2018
SugarCube v2 basic internationalization (i18n) example using a switching method (in Twee notation)
View sc-i18n-example-2.twee
:: StoryTitle
SugarCube i18n example
:: Language Switching [script]
;(function () {
Set up a `i18n` object on SugarCube's `setup` object.
setup.i18n = {
tmedwards / move-ui-bar-right.css
Last active Jan 24, 2018
Move the SugarCube v2 UI bar to the right side.
View move-ui-bar-right.css
Move the UI bar to the right side.
#story {
margin-left: 2.5em;
margin-right: 20em;
transition: none;
transition: margin-right 200ms ease-in;
#ui-bar.stowed ~ #story {
tmedwards / scroll-to-element-bottom.twee
Created Jan 2, 2018
Scrolls element(s), which are set to scroll, to the their bottoms.
View scroll-to-element-bottom.twee
:: Story JavaScript [script]
postdisplay['scroll-box'] = function (taskName) {
setTimeout(function () {
$('.scroll-box').each(function () {
var $this = $(this);
$this.scrollTop($this.prop('scrollHeight') - $this.height());
}, Engine.minDomActionDelay);
tmedwards / sc-i18n-example.twee
Last active Oct 8, 2019
SugarCube v2 basic internationalization (i18n) example using the Settings menu (in Twee notation)
View sc-i18n-example.twee
:: StoryTitle
SugarCube i18n example
:: Language Switching [script]
;(function () {
Set up a `i18n` object on SugarCube's `setup` object.
setup.i18n = {
You can’t perform that action at this time.