fairytalescript
v0.3.2
Published
A programming language designed to look like a fairytale! No complicated symbols, just a beautiful story of adventure and friendship!
Downloads
3
Readme
FairyTale Script
A programming language designed to look like a fairytale! No complicated symbols, just a beautiful story of adventure and friendship!
Characters
There are no variables in FairyTale, just characters. First, you make a header like this:
Characters
Then, add your characters one by one with a dash:
- Adam
- James
- Lily
There's no way to assign a type to a character.
To set a character, use became:Adam became 5
There are no arrays, only friendships!- 5 Dwarves
- 19 Buddies
Dead or Alive
In a story, characters aren't "True" or "False". Logically, the FairyTale equivalent of a bool is dead or alive!James became dead
Chapters
To make a funtion, you make a chapter! Just like this:Chapter 1 - Hunble Beginnings
The chapters need to have a number, and they have to be in the right order!
Chapter 1 will automatically start, but the others you gotta call yourself.
Chapter 2 happened.
To make a variable inside a chapter, just introduce a new character:
But then they met Cinderella!
A chapter needs to end in a satisfying way:
Oh, what could happen next?
Dialogue
The magic compiling unicorn sadly can't speak. If you want to print something, a character has to speak:
Mark said: "Hey guys! Let's explore that cave."
Loops
Fairytales typically have events that repeat. Just write how many times you want it to happen:
This happened 10 times:
But what if you want something to happen an unspecified amount of times? Well, just use as long as and the loop will continue while all the conditions are true.
This happend as long as Adam was "Hello" and Mike not was dead:
Want to run a loop for every character in
When Snow was "white"
For every Dwarf of Dwarves:
Dwarf became "happy"
If Statements
The question isn't if, it's when
When Romeo was dead, this happened:
Juliet became "sad".
Juliet became dead.
You want to write else? I only know of Otherwise.
When Hansel was "here", this happened:
Narrator said "Hansel for the win!".
Otherwise, when Gretel was "here", this happened:
Narrator said "Gretel is clearly the winner".
Otherwise, this happened:
Narrator said "Where'd they go? DID THEY DIE?".
Hansel became alive.
Gretel became alive.
Narrator said "Ah, there you are!".
To write or, type |[|]%¤ |} followed by TO_OR_STATEMENT.c]x| and then convert it to js++ using... Just kidding, it's or. And and.
Comments
The magic unicorn is afraid of brackets(Of course). Just put it inside brackets and it will be ignored:
(Plot twist goes here)
Previous Books
You want to import an entire library? Whoa there, fella. How'd you plan on doing that? You gotta specify books separately!
Read these books before you read this!
Then, just add the books with a dash.
- How to Not Die 2
- A Tale of Swords and Blades
- Learning to control yourself: The Ultimate Guide
A Happy Ending
Like any story, your fairytale has to have an ending:And they lived happily ever after!
Compiler
You need a magic program called node from the faraway land of nodejs.org.
The magic unicorn will translate your intriguing tale to javasc... Uhm, Unicorn language!
Simply install the compiler with npm i -g fairytalescript
. The command is fairytale
. You can use the flags -s
and -o
to specify source and output file respectively. If you want the compiler to read your book instantly, you add -r
to the end of the command. The magic unicorn will take care of the rest!
Created by SpeedFrame and ThePicoNerd with help from the unicorn