fly me to the moon

WRITING IN KAWARI

Writing in Kawari needs some special considerations. Some limited writing can be done the same as in Kawari as in standard writing. However, most cannot. Kawari was written with Japanese text in mind, and so our script has to be adapted for English writing.

We'll cover how to format your dialogue in a way that is both human readable and acceptable in Kawari's code syntax. This is intended for people who have never touched a coding language in their life. If you'd instead like to cover the basics of Kawari coding, please take a look at Basic Coding.

Basics

Let's say you have a back and forth between two characters written out.
Sonic: Hey, that's...
Shadow: That blue hedgehog again, of all places!
Sonic: I found you, faker!
Shadow: Faker? You're not even good enough to be my fake.
Sonic: I'll make you eat those words!!
This isn't quite ready to be placed into the code. Kawari has special commands it looks for. These commands make up Kawari's 'syntax'. Notably, for English usage, ' and " will cause errors if not properly accounted for. Commas (,) will, too, but commas cause a logic error (an error in the code's logic giving an improper result) instead of a syntax error (an error made by writing improper commands and halts the program).

' and " tend to give errors because they mark the beginning and ends of what is known as a 'string literal', in Kawari. Markers like these are what we call delimiters. Don't get nervous, string literals are easy to understand.

A string literal is an arbitrary sequence of characters stored as a value, verbatim. A string literal can be a word ("cat"), phrase ("Do it!"), numbers ("100"), special characters ("@","$", etc.), and any combination of those things. When the program calls for it, it will receive the string literal exactly as you typed it, minus the delimiter. (' or ", depending on which you used.)

That might sound complicated, but all you really need to understand is this important function of string literals: when ' or " are enclosed inside of the other, they will not break the code. All syntax inside of a string literal will be ignored by Kawari. Including commas, single and double quotes, and all other commands. If you would like to use the word "don't", write it just like that. "don't".

Remember:
If you need to use single quotes (or apostrophes), enclose the phrase in double quotes.
If you need to use double quotes, enclose the phrase in single quotes.


Let's return back to our dialogue and adjust it accordingly.
"Sonic: Hey, that's..."
"Shadow: That blue hedgehog again, of all places!"
"Sonic: I found you, faker!"
"Shadow: Faker? You're not even good enough to be my fake."
"Sonic: I'll make you eat those words!!"
This'll do just fine.

Common Mistakes

Now, if you reference the properly formatted example above, you'll see I put quotes around each piece of dialogue. This is because Kawari expects there to be enclosing quotes for each string of characters on a new line. An incorrectly formatted dialogue looks like this:
"Shadow: Faker? I think you're the fake hedgehog around here.
You're comparing yourself to me? Hah!
You're not even good enough to be my fake."
Kawari is reading this as individual pieces. Each time you press Enter, you'll need to encase the line in quotes. If you don't, you'll run into the same syntax error we were trying to prevent; quotes without their matching pair.

There's nothing stopping you from writing it as so:
"Sonic: Hey, that's... Shadow: That blue hedgehog again, of all places! Sonic: I found you, faker! Shadow: Faker? You're not even good enough to be my fake. Sonic: I'll make you eat those words!!"
But it's not nearly as easily readable, and doesn't take advantage of one of the more useful features of Kawari. The default standard in Kawari is to read every line in one section of code. This is like most programming languages.

What if you need to use an apostrophe while quoting someone? Or, any other situation where you need to mix quotes? As previously said, you can't normally use the same type of quotes to define a string literal. It'll give you a syntax error, and break the Ghost. But this can be handled a few ways. The easiest way is to 'escape' them by using \. To escape a quote, place \ before it, as so:
"Shadow: \“Faker\“? You're too good to be my fake."
'Sonic: I\'ll make you eat those words!'
Escaping a quote tells the program that this next quote is not a piece of code. This allows you to have more freedom when writing, as you can mix and match double or single quotes.

Placing your Dialogue

Now our dialogue can be safely placed inside the Ghost. It's not yet tagged for a Ghost, but it won't break it. The next question is: how exactly do we place it?

Your most common dialogue in a Ghost is called 'random talk' or 'AI talk'. This is dialogue that the ghost will say while idling, and no particular events are happening. In most Kawari Ghosts, they draw upon a pool of dialogues all held in the entry 'sentence'.

For CHIPS, specifically, you're going to want to navigate to the 'ghost-aitalk.kis' file. You'll see a lot of comments and examples if you downloaded Vanilla CHIPS, which I do recommend reading. In this file, we need to create an 'entry'. Entries are specific to Kawari, and they act as a way of holding all our data. As previously stated, the entry for AI talk in Kawari is 'sentence'.

To create a new entry in sentence, you'll write:
sentence : [insert text here]
When writing multiple lines, you'll also enclose your dialogue in parentheses. This style is called a block, and lines are read from top to bottom. Let's go ahead and add the dialogue we prepped.
sentence : (
"Sonic: Hey, that's..."
"Shadow: That blue hedgehog again, of all places!"
"Sonic: I found you, faker!"
"Shadow: Faker? You're not even good enough to be my fake."
"Sonic: I'll make you eat those words!!"
)
Now, your dialogue will be added to the possible pool of things your Ghost can say when idle. One thing to keep in mind, however, is this is still not tagged to look right in your Ghost. If this dialogue did occur, it'd come out something like this:



That doesn't look how you hoped, right? Don't worry, there's a lot of options for formatting in Ghosts. If you'd like to know how to format dialogue for Ghosts, please move onto Writing with SakuraScript.

SakuraScript is a language of formatting tags that Ghosts use to display dialogue neatly and uniquely. It's in your best interest to learn it, and should soon become quite easy to read and write.

If you're not confident you've mastered Writing in Kawari, I suggest re-reading the page while doing the steps along the guide yourself. I also suggest reading the AI Talk file in the CHIPS Ghost. It has a different approach to teaching the basics of Kawari, which may help you more.

While I encourage you to understand how and why the way it's written works, you do not have to understand it to use it. You may be saved much frustration with working out errors by understanding it, but it will be perfectly functional with "copy and paste, and replace" method. If you absolutely cannot figure it out, that's OK.

jump

Index
Introduction
Glossary
Writing
Writing in Kawari
Writing with SakuraScript
Shells
Shell Overview
Coding
SHIORI Event Overview Basic Coding
Advanced Coding

credit

walkthrough by Okuajub
design by almost sweet - resources