-
-
Save symposion/a1d5ef45629170de3a0dea7d665258d9 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" /> | |
<fieldset class="repeating_skills"> | |
<input type="text" name="attr_skillname" /> | |
<input type="text" name="attr_skilldependent" /> | |
</fieldset> | |
<script type="text/worker"> | |
log("Hello from sheetworker"); | |
on("change:baseattribute", function() { | |
log("Base attribute heard change"); | |
var attrName = 'repeating_skills_' + generateRowID() + '_skillname'; | |
var object = {}; | |
object[attrName] = 'myValue'; | |
setAttrs(object); | |
}); | |
on("change:repeating_skills:skillname", function() { | |
console.info('Here'); | |
log("Repeating section created attribute listener fired"); | |
setAttrs({ | |
repeating_skills_skilldependent: 'testDepValue' | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment