This quick reference is for content authors new to scripting in Seven Spells of Destruction. It walks you through the basics of adding interactivity using JavaScript inside your paragraphs.
You do not need to be a programmer — just follow these patterns.
Scripts can:
Scripts go inside a <script>
block on a single line, like this:
<script>print("Hello, adventurer!");</script>
Never place the closing </script>
on its own line. Always inline:
✅ Good:
<script>print("Hello");</script>
❌ Bad:
<script>
print("Hello");
</script>
<script>
if (player.gold >= 20) {
player.gold -= 20;
print("You hand over the coins.");
} else {
print("You don’t have enough gold.");
}</script>
<script>
if (player.skill >= 6) {
print("<AUTOLINK=123, Climb the cliff>");
}</script>
The link only appears if skill is 6 or higher.
<script>
if (!get_key("has_met_lord")) {
print("A cloaked man approaches.\n");
set_key("has_met_lord", "true");
}</script>
This only prints once, even if the player comes back.
You can combine scripts with <test>
:
<test luck><script>
if (paragraph.auto_test) {
print("You narrowly escape!");
} else {
print("You trip and fall!");
}</script>
print("...\n")
for new lines.log("...")
for silent debugging.quest_flag_tavern
for clarity.You can do more complex scripting once you’re confident. See the full JavaScript Scripting Guide for details.
Happy scripting!