Skip to content

Instantly share code, notes, and snippets.

View rileydutton's full-sized avatar

Riley Dutton rileydutton

  • Overland Park, KS
View GitHub Profile
Test: <input type="text" name="attr_Test" /><br />
test: <input type="text" name="attr_test" /><br />
TEST: <input type="text" name="attr_TEST" /><br />
<hr />
SheetWorker: <input type="text" name="attr_SheetWorker" style="pointer-events: none;" /><br />
SHEETWORKER: <input type="text" name="attr_SHEETWORKER" style="pointer-events: none;" />
<script type="text/worker">
on("change:test", function() {
<input name="attr_repeating_test_0_field" type="text" />
<fieldset class="repeating_inventory">
<table>
<tr border="1">
<td><input type="text" style="width:50px" name="attr_weight" value="0" title="item's weight" /></td>
</tr>
</table>
</fieldset>
<script type="text/worker">
// define a function that increments a counter in a loop
function closureExample() {
var i = 0;
for (i = 0; i< 3 ;i++) {
setTimeout(function() {
console.log('counter value is ' + i);
}, 1000);
}
@rileydutton
rileydutton / init.js
Created January 21, 2015 01:53
Mirrorshades Auto-Init Script
//TO USE THIS:
// To make an initiative roll, have the player do their normal intiiative roll, and add "!init" on the end. For example
// /roll 3d6+5 !init
// This will show the roll like normal, plus auto-add turns to the turn tracker for them for each multiple of 7.
//
// The GM can also easy clear the turn tracker by doing:
// !clearinit
//
on("chat:message", function(op) {
@rileydutton
rileydutton / latency.js
Created October 31, 2014 21:45
Firebase latency
var timeoutRef = new Firebase(window.FIREBASE_ROOT + window.campaign_storage_path + "/players/" + window.currentPlayer.id + "/lastActive");
var timeoutTimeout;
var timeoutRefTimedOut = false;
$connerror = $("#connectionerror");
var notifyInterrupted = function() {
console.log("Timeout ref showed error!");
timeoutRefTimedOut = true;
$connerror.show();
EDID report generated by SwitchResX Version 4.4.0 (Intel - 64-bit) for display ASUS PB287Modified
-----------------------------------------------------
------------------- RAW DATA ------------------------
-----------------------------------------------------
0 1 2 3 4 5 6 7 8 9 A B C D E F
-----------------------------------------------------
0 | 00 FF FF FF FF FF FF 00 04 69 A2 28 DA C0 01 00
1 | 10 18 01 04 A5 3E 22 78 3A 1C B5 A3 57 4F A0 27
@rileydutton
rileydutton / savageworlds.css
Created April 7, 2014 15:13
Example Savage Worlds Roll20 sheet
.charsheet label {
display: inline-block;
width: 75px;
text-align: right;
}
.charsheet input {
display: inline-block;
width: 165px;
}
@rileydutton
rileydutton / TheQuietYear.js
Last active December 28, 2015 06:19
"The Quiet Year" Roll20 API Script
//To use this script, create a Roll20 Campaign with 4 decks, each one with only one suit of cards. Then on each player's turn, have them draw from the deck for the current "season" (e.g. Hearts for Spring). After they put the card into their hand, they'll receive a whisper from "The Threads of Fate" telling them what that card 'means' in the game.
//SPRING
var cardIndex = {
"Ace of Hearts": "What group has the highest status in the community? What must people do to gain inclusion in this group? -OR- Are there distinct family units in the community? If so, what family structures are common?",
"Two of Hearts": "There’s a large body of water on the map. Where is it? What does it look like? -OR- There’s a giant, man-made structure on the map. Where is it? Why is it abandoned?",
"Three of Hearts": "Someone new arrives. Who? -OR- Two of the community’s younger members get into a fight. What provoked them?",
"Four of Hearts": "What important and basic tools does the community lack? -OR- Where are yo
on("chat:message", function(msg) {
if(msg.type == "api" && msg.content.indexOf("!show") !== -1) {
var charName = msg.content.replace("!show ", "");
var charToken = findObjs({_type: "graphic", name: charName})[0];
if(!charToken) {
return;
}
if(charToken.get("layer") == "gmlayer"){
charToken.set("layer", "objects");
} else {
on("change:token", function(obj, prev) {
if(obj.get("left") === prev["left"] && obj.get("top") === prev["top"]) return;
var dragon = findObjs({"name": "Dragon"})[0];
if(dragon.get("layer") == "objects") return; //already triggered
if(objInPath(obj, getObj("path", "-It0Qq-YsN3s_oa_a_Zi"))) {
//You woke the dragon!
dragon.set({
layer: "objects"
});