Skip to content

Instantly share code, notes, and snippets.

View ChapelR's full-sized avatar

Chapel ChapelR

View GitHub Profile
@ChapelR
ChapelR / README.md
Last active January 23, 2020 04:31
Say and Character Macro Set

<<character name imageSrc>> / setup.addCharacter(name, imageSrc)

Add character names to associate with image sources (as URLs). Must be done in StoryInit or the Story JavaScript area. Character names become macros later.

<<say name imageSrc>>...<</say>> / setup.say(outputElement, characterName, text, imageSrc)

Create a speech box with the given character name and image, which says the indicated text content.

Character Name Macros

@ChapelR
ChapelR / typed.min.js
Created June 11, 2020 10:02
typed.js + speechbox
// Tweaked for the speechbox macro set by Thomas Michael Edwards
/*! typed.js integration module for SugarCube */
!function(){"use strict";function getInlineOptions(classNames){var options={},typedRe=/^typed(?:-(\w+))+\b$/,parseRe=/-(speed|delay)(\d+)\b/g,match=void 0;if("typed"!==classNames)for(var classOpts=classNames.toLowerCase().split(/\s+/),i=0;i<classOpts.length;++i)if(typedRe.test(classOpts[i])){for(;null!==(match=parseRe.exec(classOpts[i]));)switch(match[1]){case"speed":options.typeSpeed=Number(match[2]);break;case"delay":options.startDelay=Number(match[2])}break}return options}function typedCallbackFactory(el,callback){return function(){var $outer=jQuery(el),$inner=jQuery('<div class="typedjs-text-wrapper"><span class="typed"></span></div>'),$source=$outer.children('[class|="typed"]'),options=jQuery.extend({strings:["^0 "+$source.html()],typeSpeed:40,startDelay:400,onComplete:function(){$inner.children(".typed-cursor").remove(),callback()},preStringTyped:function(){jQuery.event.trigger(":typedstart"
@ChapelR
ChapelR / gist:bcbcb08d3db2a1df60c16de73344ee20
Last active May 9, 2021 17:49
Harlowe DM Loading patch
// goes in story JS; see conversation below;
// only games played via Twine 2 (web)'s play/test modes have the bug
delete Map.prototype.toJSON; delete Set.prototype.toJSON;
@ChapelR
ChapelR / README.md
Last active September 14, 2020 05:38
Newbie Guide for tw-analytics

This document originally written by Somnium. Thank you for your contribution!

If you are a beginner Twine user and want a little extra help, here is a step-by-step guide for using TW-Analytics to add Google Analytics to your story.

For WINDOWS:

  1. This requires NodeJS; go to this address and install the "LTS" release: https://nodejs.org/en/
  2. Wait for Node.js to finish installing. You will probably need to reboot your PC.
  3. Open the win command prompt (either search for "cmd" in the start menu or presss WIN KEY + R and type cmd and press enter)
  4. The command prompt will open. Type npm i -g tw-analytics and press enter.
@ChapelR
ChapelR / log.css
Last active February 21, 2021 10:15
expanding log
[data-tags~="show-log"] #passages {
margin-bottom: 5em;
}
#log {
position: fixed;
height: 4em;
padding: 1em 4em 0 4em;
z-index: 1;
bottom: 0;
(() => {
"use strict";
function bindEvent (self) {
let $element = self.args[0] && typeof self.args[0] && $(self.args[0].trim());
if (!$element || !($element instanceof $) || !$element[0]) {
$element = $(self.output);
}
$element.ariaClick(self.createShadowWrapper(() => {
$.wiki(self.payload[0].contents);
}));