Created
January 24, 2018 15:59
-
-
Save sfentress/f79fd53693f5dbad11d7fc43bdcdca2d to your computer and use it in GitHub Desktop.
Geniventure dialog script
This file contains 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
json = {...} | |
printDialog = function(lines) { | |
for (line of lines) { | |
console.log(line.character + ": " + line.text) | |
} | |
} | |
levelN = missionN = challengeN = 0 | |
for (level of json.levels) { | |
levelN++ | |
missionN = 0 | |
for (mission of level.missions) { | |
missionN++ | |
challengeN = 0 | |
console.log("") | |
console.log("==== Mission "+levelN + "." + missionN + " ====") | |
console.log("=========================") | |
console.log("") | |
console.log(" == MISSION "+levelN + "." + missionN + " START DIALOG:") | |
console.log("") | |
printDialog(mission.dialog.start) | |
console.log("") | |
console.log(" == MISSION "+levelN + "." + missionN + " MIDDLE DIALOG:") | |
console.log("") | |
printDialog(mission.dialog.middle) | |
console.log("") | |
for (challenge of mission.challenges) { | |
challengeN++ | |
console.log("") | |
console.log("=== Challenge "+levelN + "." + missionN + "." + challengeN + " ===") | |
console.log("-------------------") | |
console.log("") | |
console.log(" == CHALLENGE "+levelN + "." + missionN + "." + challengeN + " START DIALOG:") | |
console.log("") | |
printDialog(challenge.dialog.start) | |
console.log("") | |
console.log(" == CHALLENGE "+levelN + "." + missionN + "." + challengeN + " FAILURE DIALOG:") | |
console.log("") | |
printDialog(challenge.dialog.end.failure) | |
console.log("") | |
console.log(" == CHALLENGE "+levelN + "." + missionN + "." + challengeN + " SUCCESS DIALOG:") | |
console.log("") | |
printDialog(challenge.dialog.end.success) | |
} | |
console.log("") | |
console.log("-------") | |
console.log("") | |
console.log(" == MISSION "+levelN + "." + missionN + " END DIALOG:") | |
console.log("") | |
printDialog(mission.dialog.end) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment