Created
October 26, 2016 14:08
-
-
Save rileydutton/b988f2e1d05ff625674f89e39ee732b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//To test, just add the script and the sheet to any blank game, then create a new blank Character in the game, then do any chat message. | |
//Expected behavior: | |
// "Found webworker script" | |
// "API Ready." | |
// "Hello from sheetworker" | |
// "Creating baseattribute..." | |
// "Base attribute heard change" | |
// "Created attribute heard change" | |
on("chat:message", function() { | |
//Find the first character and just use it | |
var firstChar = findObjs({type: "character"})[0]; | |
if(!firstChar) { | |
log("You must make a character manually"); | |
return; | |
} | |
log("Creating baseattribute..."); | |
var newattrib = createObj("attribute", {characterid: firstChar.id, name: "baseattribute"}); | |
newattrib.setWithWorker({ | |
current: "1" | |
}); | |
}); | |
on("ready", function() { | |
log("API Ready."); | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type="text" name="attr_baseattribute" /> | |
<input type="text" name="attr_createdattribute" /> | |
<script type="text/worker"> | |
log("Hello from sheetworker"); | |
on("change:baseattribute", function() { | |
log("Base attribute heard change"); | |
setAttrs({ | |
"createdattribute": "12" | |
}); | |
}); | |
on("change:createdattribute", function() { | |
log("Created attribute heard change"); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment