While this may sound scary, you honestly need to know very little SakuraScript to get by, and it's really very simple conceptually! So while you MUST be able to understand and apply the principles on this page, they hopefully will not be too difficult to grasp.
So please read this page carefully as many times as you have to, and keep it open for reference as you work as well in case you forget.
Now, to begin. By now, you've done a little bit of poking around the files and (possibly) made your shell. In the process of looking around, you may have noticed that the main character and side character of your ghost are referred to in certain ways.
The Main Character is referred to as Sakura and the number 0. (Girl in the template)
The Side Character is referred to as Kero and the number 1. (Triangle)
SakuraScript is where those numbers become very, very important.
What SakuraScript is is basically a type of formatting for the text within a ghost's .dic files. It determines who's talking, how and when they pause, what expression they have, the font color and size, bringing up menus, running functions, the list goes on and on.
Because the vast majority of the coding for the template has been done for you, mostly what you will need to learn is how to determine who's talking, how to set poses, how to end dialogue, how to space dialogue, how to switch between characters, and how to pause. I'll go into a few other SakuraScript functions you may use, but those are the main ones you will absolutely need to learn.
Now, here's a simple line of formatted dialogue as an example.
"\0\sThis is a single line of dialogue for the main character. There is no response.\e"
You'll find this in aitalk.dic. Now, here's a more complicated line.
"\0\sThis is a long piece of dialogue.\w8\1\sThis is my first response.\w8\0\s\n\n[half]This is my response to that.\w8\1\s\n\n[half]This is my second response.\w8\0\s\n\n[half]And this is my last response.\w8\1\s\n\n[half]This is my final word.\e"Also found in aitalk.dic. These may seem confusing and strange right now, but by the end of this page, you will hopefully be able to break them down and understand how they work.
Let's take a look at the heart and soul of your ghost. Go into your ghost/ghost/master folder. You should see a wide variety of files. You won't be touching any of the .dll files, .cfg files, .dau files, or the profile folder, so don't worry about any of those. And by now, you should already have descript.txt filled out. What you will be focused on will be the .dic files. These files contain all of the dialogue and coding for your ghost. They break down like so.
aitalk.dic - the random dialogue for your ghost
anchor.dic - the anchor words for your ghost
bootend.dic - your ghost's boot and close dialogue
commu.dic - ghost communication
etc.dic - extra functions for the ghost
menu.dic - your ghost's menus
mouse.dic - mouse settings for your ghost like for clicking or petting
nameteach.dic - for setting the user's name
shiori3.dic - the hard coding for the ghost, do not touch this
string.dic - customization of the right-click menu
word.dic - unique envelope words
Now, this probably seems like a lot of files, and some of them can seem intimidatingly long or complicated, but don't worry! I left extensive and hopefully very thorough commentary in each of them telling you just where to edit and what each thing inside them does. Some of the files are even super short! So don't be afraid just yet.
We are going to be using Notepad++ to open these files for a number of reasons. Go ahead and boot up Notepad++ and open them all up. You should be able to easily flip between them via the tabs. Now, for each file, you're going to want to go into the Languages menu at the top of Notepad++ and set it to C - C.
Right here. When done correctly, you should see a lot of the file turn green. All commented lines will turn green, and other bits of code will highlight in different ways. I'm going to continue from this point as if you're using Notepad++ and can thus see the appropriate color highlighting, so again, I urge you to pick it up. If not, just make sure to pay very close attention to what you're doing.
IMPORTANT NOTE: MAKE SURE YOU DO NOT HAVE SMARTQUOTES ON WHILE WRITING YOUR SCRIPTS. I don't think Notepad++ does this but maybe it does, but smartquotes WILL break a ghost. If anytime you save a .dic file it breaks, it could be smartquotes behind it! Turn them off, or use a different text editor without them instead.
What file you start with is up to you. Most of them can stand on their own, I think, and some are much longer or shorter than others. I personally began doing the commentary on bootend, but that does start with some fairly heavy and possibly scary looking code. aitalk.dic may be a bit more accessible, but it's up to you. You can glance through each file quickly to get an idea of what's in them and what seems the most approachable, but either way, we're not going to get into them just yet. Before you do any kind of editing, you have to understand the basics of SakuraScript.
As you look in the files in Notepad++, you'll notice that most lines of dialogue are grey. Properly formatted lines of dialogue will almost always be grey, and a black line of dialogue is a big indicator that something is wrong. It turns grey because the quotation marks around the bit of dialogue are closed. One of the most important parts of coding is making sure all your tags like quotation marks and brackets are closed, and Notepad++ helps a lot with helping you spot these kind of things.
There is an exception to this in bootend.dic in the OnFirstBoot dialogue, which you will notice when you see it, and rarely in some other functions, but I will always point these out in the files when they come up and tell you where your text should go, so don't worry.
You can think of SakuraScript as being broken down into a series of tags, each beginning with a \ slash. Tags can be layered one after the other and in fact, often will be, but they will always be broken up with that slash.
Do you remember the numbers I mentioned up there for the main character and the side character? This is when they come into play. \0 is the main character and \1 is the side character, in accordance with their numbers in the other files. You'll see 0=main and 1=side in other places as well if you look. But this is how you determine who is speaking. \0 means the main character is talking, and \1 is the side character.
"\0I am the main character."
"\1I am the side character."
As you can see, \0 is for the main and \1 is for the side. You may also notice that there is no space between a tag and dialogue. SakuraScript doesn't need it. If you add in an extra space, you may end up spacing things more than you intended.
\0 and \1 are the base building blocks for ghost dialogue, and you will see them everywhere. Almost everything you do with ghost dialogue will be built on these two tags, so keep an eye out for them.
Also notice that the dialogue is within quotation marks. ALL DIALOGUE MUST BE WITHIN QUOTATION MARKS. NO EXCEPTIONS.
Now for perhaps the second most important SakuraScript tag. This one determines what expression your ghost will have at any point.
\s[number]Do you remember setting up surfaces.txt? Or at least looking through it? Go and look through it now if you haven't. Notice that every Surface has a number associated with it. Surface1 is Girl's embarrassed pose, Surface12 is Triangle's surprised pose, Surface14 is Triangle's sad pose, and so on. Well, this is where these numbers become extremely important (and this is also why I told you to make a note of what expression was what number if you were making your own). That number is what you append to \s to change the character's expression.
"\0\sThis is my embarrassed pose."
Here, you can see that we are calling Surface1 (the embarrassed pose) as defined in surfaces.txt by adding the tag \s. Because it was preceded with \0, that means that it is the main character, Girl, whose pose will change. \s would call Triangle's surprised pose, \s would call Triangle's sad pose, and so on for all the numbers defined in Surfaces.txt.
"\0\sThis is dialogue with my embarrassed pose."
"\1\sThis is also dialogue with my embarrassed pose."
Here, you can see that \s, Girl's embarrassed pose, is preceded with \0, and \s, Triangle's embarrassed pose, is preceded with \1. This is the most common and frequent combination of Sakura tags you will see - the focus (\0 or \1) and the pose (\s[number]).
The \s tag is flexible, and can be placed anywhere in the line of dialogue.
"\0\sIn this dialogue, I will go from happy \sto sad."
As you can see here, by adding \s in the middle of the dialogue, you change the character's expression from \s to \s. You can do this as many times in a sentence as you want to have your character go through many different expressions if you want. Mostly, think about the expressions you defined back while doing your shell. Think about how your character would look while saying the line, and change their pose with \s[number] as you need to.
\s is the default pose for the main character, and \s for the side character. This is why you will see \0\s and \1\s the most often in the files by far.
You can also use combinations of these to change the other character's pose while one character is speaking.
"\0\sI am saying something surprising. \1\s\0\sTriangle is surprised."
Look carefully at what happens here. Girl says her sentence, then there is a series of tags. Breaking it down, you can see that it starts with \1, switching the focus to Triangle. It's followed by \s, which changes his pose to his surprised pose. However, right after that, there's a \0 tag, switching the focus BACK to Girl, then a \s tag to put her in her default pose. Thus, to the user, it looks like Triangle reacts while Girl is talking and doesn't interrupt her at all. You can switch focus between characters like this without having them say anything for similiar effects, depending on what you have in mind.
Oh yeah, and if you want to make your character disappear, use \s[-1]. They will vanish from the screen for a short period until OnSurfaceRestore (in aitalk.dic) brings them back.
There is a related tag to \s known as \i. I talk about this more in surfaces.txt in the shell. What \i does is call a specific interval on that surface. So for example, if surface20 has intervals numbered 14 and 16, you can call them with a surface by stacking the tag. Something like \s\i\i. You can use this along with the never tag in surfaces.txt to set up intervals that only appear when you want them to. Thus you can have one surface be a "base" where you can layer on all your separate effects using intervals. I use this a lot for things like eyebrows, eye shape, arm movements, ear movements, things like that. Whether or not anyone else will ever do this idk, but for my own reference here it is.
Pauses help create a natural rhythm for your dialogue, and also can help out slow readers and space out messages coming too quickly.
The tag to create a pause is \w and then a number. It can range from \w1 to \w8, possibly \w9 but I'm not sure, but not higher than that. The number indicates how long to pause in I think milliseconds, so \w1 is one ms and \w8 would be eight milliseconds.
EXAMPLEAs you can see, you can also insert \w into any part of the dialogue that you like. Most typically, you'll see it spacing out dialogue between characters, like this.
"\0\sHere is a \w4pause for four ms."
"\0\sThis is a two line piece of dialogue.\w8\1\sThis is the second line."
Here, \w8 is used to create a pause when switching from the main character \0 to the secondary character, \1. I highly recommend always adding in a \w8 pause when switching between characters like this.
You can use multiple pauses in one sentence, like so.
"\0\sI am pausing \w4for dramatic \w6emphasis. P\w6 - \w6A - \w6U - \w6S - \w6E."
You can see here all the \w tags scattered in the dialogue, pausing between \w4 and \6 depending. You can use this to make characters spell things out slowly if you want, or linger for emphasis.
If you want to pause for longer than 8 or 9 milliseconds, then all you have to do is stack \w tags, like so.
\w5\w8Here, the pause would be 13 ms long, because 5 plus 8 is 13. You can stack \w tags as long as you want, like \w5\w5\w5\w5\w5\w5\w5\w5 to pause for 40 ms, although it seems very unlikely your ghost will have to pause that long.
EXAMPLELike so. You'll see \w tags around a lot probably, at the very least the very common \w8 one when the focus switches between characters.
"\0\sI am pausing for 40 ms.\w5\w5\w5\w5\w5\w5\w5\w5 Done."
Now, here's something VERY IMPORTANT. You CANNOT have a paragraph break inside a piece of dialogue in your code. In Notepad++, all dialogue bits will appear grey when properly coded, but will turn black when broken. A good way to see that is to hit enter in the middle of a line of dialogue.
"\0\sThis is a two line piece of dialogue.\w8
\1\sThis is the second line."
This, for example, would break your line of dialogue and possibly the entire ghost if you didn't fix it. All lines of dialogue must be ONE SINGLE UNBROKEN LINE. So, how do you space out your lines then when they appear in the balloon? You'll want to use one of these two tags.
\n inserts a paragraph break into your dialogue, just as if you hit enter once. Therefore, if you wrote...
"\0\sThis dialogue is on one line.\nThis line is on another."It will display like this in your ghost's balloon.
This dialogue is on one line.
This line is on another.
"\0\sThis dialogue is on one line.\n\n[half]This line is on another."would appear in your ghost's balloon like
This dialogue is on one line.
This line is on another.
"Why not just use two \n tags?" you may be wondering, and that is a totally valid option! For some balloons, \n\n looks better than \n\n[half]. It depends on the font used by your balloon and the line spacing. Experiment with your dialogue in your balloon and see what kind of line spacing you prefer.
As you go through the files, you'll notice that almost every single line ends with the same tag.
\e\e tells the code that the line is over. Every single line of dialogue you write should end with \e. The only exception would be if you want to close the ENTIRE program at once, where you would use \- instead, but 99% of the time you will end a line with \e. Somewhere at the end of a line, \e will be there. Or should be there.
"\1\sThis is a single line of dialogue for the side character.\e"
"\1\sThis is a two line piece of dialogue.\w8\0\sThis is the second line.\e"
You can see \e at the end of both these lines, and you'll see it at the end of every line from this point onwards. Always make sure your lines end with \e.
%(thing)"thing" in there is standing in for whatever envelope you want to call. You can define any amount of envelopes you want in word.dic, but there are a few that you are going to be using a lot fairly universally.
%(username) - One of the most common, this is the stand-in for your user's name. Anytime your ghost refers to the user by their name, they'll be using %(username).
EXAMPLEHere is the %(username) envelope in practice. If your username was, for example, Lola, then this line would appear in the ghost's balloon as
"\0\sThis is dialogue referring to %(username).\e"
This is dialogue referring to Lola.%(username) is by far the one you'll be using the most, but there are a few others you'll be using. If you're using my template, there'll be a set that will keep track of pronouns the user has set, so the ghost will use the right ones in a sentence should the need arise. The pronoun set goes like this.
%(heshe) - The stand-in for he, she, or they.
%(hisher) - The stand-in for his, hers, or theirs.
%(himher) - The stand-in for him, her, or them.
When sentences come up where a ghost would refer to the user in the third person, you'd use these envelopes to make it read right.
"\0\s%(heshe) went to the store and got %(himher)self some milk for %(hisher) cat.\e"
When you saw this dialogue in the balloon, it would appear as
she went to the store and got herself some milk for her cat.if your pronouns were set to she/her/her. If you set your pronouns to he/his/him or they/them/their, they'll change appropriately.
There's more about envelopes in word.dic, but these four - %(username), %(heshe), %(himher), %(hisher) - are the ones you will probably be using the most, regardless of what unique envelopes you set up in word.dic.
These aren't the only envelopes available to you though! There are many default ones included in SakuraScript, but I won't get too much into them here. Those curious though can read more about the available ones at the CROW - SSP Reference Site, although that site is in Japanese as a note. I ran it through Google Translate and was able to pick up most of it though, so it won't be too dense, hopefully.
If you can grasp these SakuraScript concepts and use them correctly, then you can write dialogue for your ghost now! For most beginner users, you won't ever need to venture further from these tags. Anything more complicated has been done for you already within the template. Feel free to skip down to "Editing Dialogue".
\0 - main character
\1 - side character
\s[#] - surface change
\w1-8 - pause
\n - new line
\n[half] - half a new line
\e - end a script
%(username) - user's name
%(heshe) - he/she/they pronoun
%(hisher) - his/her/their pronoun
%(himher) - him/her/them pronoun
However, for those who want to know what else you can do with SakuraScript, read on.
Here are some tags that, while you may not use them as often as the above, may still come up relatively frequently. It'd be a good idea to get an idea of how they work and what they do.
Now, if you made your own balloon, by now you know that there are two types of balloon - a big one and a small one. If you look in the SSP\balloon\z_simple folder for the balloon template, you can see what I mean. The big balloons are usually used for menus, while the small balloons are used for dialogue. However, to get the big balloon to come up for a menu, you have to specifically call it with a tag.
\b[number]You'll see this in action in menu.dic. Add \b to a line of dialogue, and it'll bring up the big balloon. This applies to the side character as well, their big balloon is also brought up with \b. If you made extra balloons for whatever reason, you're going to want to use \b or \b or whatever the number of the file is for your extra balloon (if you made your own balloon, you will probably know what this number is). Charger's balloon for example is called using \b for her small one and \b for her big one.
Don't worry about doing the number that's facing the right way - if the ghost is close to the side of a screen, it'll flip the balloon anyway, and if it's already been flipped from right to left, it will automatically stay consistent. Just do the one that's facing right.
EXAMPLEAs you can see, just add the \b tag wherever you want the big balloon to appear. Usually this'll be at the beginning of your statement, but maybe you want the balloon to get big halfway through, I don't know. As a note, you will have to re-add the \b tag if you're say, going through menu pages or something.
"\0\s\bThis text will be in a big balloon.\e"
So, let's say for some reason, you wanted both your characters to say something at the same time. There's a certain tag that will let you do this.
\_sWhat you'll want to do is set up both your character's expressions, then put \_s before the text you want them to say. Here's an example.
EXAMPLEBoth characters will speak the same words at the same time. Make sure you set up their poses before hand, as they won't be easy to change mid-sentence.
"\0\s\1\s\_sWe are saying this dialogue at the same time.\e"
Maybe your balloon has too much text in it from a really long conversation, or perhaps your ghost was explaining something and it took a while, so you want to clear out the balloon for some more dialogue.
\c\c will clear all text in your balloon so it'll start fresh. This is commonly paired with \x below, since \c will clear the balloon immediately unless offset with \w tags, so you'd better hope your user is a fast reader in that case.
EXAMPLEIf you run this example line through the Script Input, you'll see just how it works. The \w8 in there pauses it a little so it doesn't instantly wipe. As mentioned, primarily used when a balloon is filled with text and you want to start anew.
"\0\sI will clear this text from the balloon.\w8\cThe text has been cleared.\e"
\xWhat \x does is that it will pause the balloon and wait, usually flashing an arrow at the user to indicate it's waiting for something. The user will have to click on the balloon to continue the dialogue. This is often used to give the user a second to digest what they just heard during a long speech, such as in OnFirstBoot in bootend.dic. Once the balloon has been clicked, the dialogue will continue.
This is most often paired with \c in the form of \x\c, so that when the user clicks the balloon, the balloon will clear of text and begin with a clean slate for new information.
EXAMPLEYou can try this line of dialogue using Script Input to see how it works.
"\0\sI will wait for user input.\x The input has been given.\e"
Maybe you have a ton of text you want to get on the screen and you're tired of watching it scroll by slowly.
\_q\_q will make all text for that line appear instantly in the balloon. This is extremely useful for menus, as you'll see in menu.dic. You don't want to make your user sit through each menu option being scrolled through, right?
EXAMPLEYou can also put \_q halfway through a sentence, if you only want the last part to appear quickly for some reason.
"\0\s\_qThis text will appear instantly.\e"
"\0\sThis text will \_qappear instantly.\e"
\_a[http://www.website.com/]Text\_aFirst, you start with \_a, then you put the address you want to go to in brackets, so \_a[address]. After that, you put what you want the link to say, like Cool Site or Screamer Video or Picture of a Tree or whatever, it's up to you. You then add one more \_a to close the link.
EXAMPLEIt's not too far off from html or bbs code, I think.
"\0\sHere's a link to a website. \_a[http://www.website.com/]Right here.\_a Enjoy.\e"
If for some reason you want a small soundclip to play, there is a SakuraScript tag that will allow you to do that. I originally thought you had to have the file in your root directory, but that's actually not the case! You can put it in a folder within your ghost/master directory, as long as you then point the tag to the right place.
\_vThe basic format for \_v is \_v[filename.wav] or whatever extension your file has. If you put the sound file into its own folder in your ghost\master directory, like a folder called "sfx", you'd want to add that to the tag. Such as, \_v[sfx\sound.wav].
"\0\sHere is a sound. \_v[sound.wav]\e"
You should be able to hear the sound when you test the line in Script Input if you've done it properly. If you aren't hearing anything, check your preferences in the SSP menu and make sure you have sounds turned on. I think it's in one of the ghost preference tabs.
NOTE: Use this SPARINGLY. In fact, most of the time, I wouldn't use it at all. Don't make your ghost constantly sigh or squirm or chirp or giggle, that would get really irritating really fast. Personally, I have used \_v for punch sounds when you hit a character, and for a high-five sound when you give someone a high five, but really, that's it. Don't abuse this feature.
\4You'll see this in aitalk.dic in the OnSecondChange section. There are probably other uses you could find for it though.
EXAMPLEEither character can move away from the other, depending on who's the focus when you put in the \4 tag. Since \0 was the focus here, Girl moves away. If I used the \4 tag when Triangle was the focus, he would move away instead.
"\0\sI am moving away from the other character.\4\e."
\5Much like the above, you can use this to bring your characters closer together. Note though that it will not bring them close enough to overlap, if that's what you were hoping for.
"\0\sI am moving towards the other character.\5\e."
Also like the above, the character who moves depends on who the focus is when the \5 tag is used.
--These double dashes (VROOM) are used, in this situation, to help separate a set of dialogue within a bracket. In aitalk, you'll notice that there are some bits of dialogue within the RandomTalk function that are encased in brackets. Within those chunks, you'll have bits of dialogue split up by these double dashes.
"\0\sSay either black or white.\w8\1\sWhat if I say "
" instead?\w8\0\n\n[half]\sThen you're not really cooperating.\w8\1\n\n[half]\sSounds about right.\e"
Those double dashes basically split the dialogue into three different parts. So there is an intro, a middle part, and a third part. If there are multiple options in one of the parts, then the ghost will randomly choose one of the options in that part when doing this line of dialogue. Thus, Triangle could say green OR red OR purple OR orange OR yellow OR magenta. The other place you'll see dashes is with choices such as in menu.dic.
EXAMPLEHere you can see the -- breaking the dialogue into two pieces - the introductory dialogue and the choices themselves. Note that the dialogue in the first part does not end with \e - it continues onwards past the dashes, and only ends with \e at the end of the menu options.
"\1\s This is a menu introduction dialogue."
Again, -- is a flexible bit of scripting that can be used in many ways, but getting into the many things you can do with it here seems a bit like overkill. If you're interested, check the more advanced coding pages for more examples.
\b - change balloon
\_s - synchronize dialogue
\c - clear a balloon
\x - make a paused balloon that waits for user input to continue
\_q - text appears instantly
\_a - make a link
\_v - play a sound
\4 - make a character move away from the other
\5 - make a character move closer to the other
-- - breaks up dialogue within an enclosed set
Here are tags that won't come up very often, but when they do, they can be very tricky and involved. You need to be careful with these.
/Yes, it's simply a slash pointing the other direction. What this will let you do is use a paragraph break within the code itself, even though normally that breaks things. You'd put this at the end of a line and then continue on the next.
"\0\sI am talking. /
\1\sI am also talking.\e"
This dialogue will display just as a normal piece of dialogue on one line would.
You may be thinking, "why didn't you tell me about this before, Zar, this makes writing long pieces of dialogue so much easier! I can just use the slash to break up the lines!" and I'm telling you, it's not a good idea. Without the proper highlighting, it is extremely easy to mess up using this slash, and any mistakes you make will break your ghost until you fix them. It's FLIRTING WITH DISASTER I TELL YOU. But if you feel confident you CAN use the / to break up lines like this. Just be careful.
The other downside to this is that you cannot use Script Input to test lines broken up this way, it won't read them properly. So that's another big con to using these too frequently, in my opinion.
\![*]\q[Displayed Name,linkedfunction]Actually this is cheating a bit, the option for menus is really just \q, but \![*] uses the little sstp icon thing from your balloon to put in front of the choice and it looks nicer.
Anyway, the way to set up a choice is \q, although it has some values afterwards. Displayed Name is what will show up in the menu or balloon, such as Option 1, Pick This, Go There, yada yada. It's what the user will see. linkedfunction on the other hand is where the choice will lead. So when you click the option, it will go to OnMenuRun, or OnTimeCheck, or OnJuniperGo or whatever function you want it to run.
You may have noticed all the examples started with On. If a function starts with On, then a choice like this can call it from anywhere, any .dic file. If it doesn't have On though, you'll have to use select.linkedfunction when writing where it goes in the code. I get more into this in the .dic files themselves if you want more details.
Now, setting up choices is one of the times when you really are going to want to use the slash I just mentioned above. It makes it much easier to break up your choices and keep track of them. The general format I follow for setting up choices goes...
"\0\sHere is a question."I use the -- to split up the text from the choices, then space them using \n\n[half] as appropriate. You can see at the end of each line the / slash that lets me hit enter to move down to the next line. Adding more choices to a set like this is just a matter of copying one line, changing the values, and readjusting as needed.
However, there are some situations in which you might not be able to use this kind of format for a choice. The RandomTalk function in aitalk.dic is a good example of this... choices set up like this won't work, maybe because of the /, I'm not sure. You can still set up choices though, they'll just be one line of dialogue. Here's the same thing from above, condensed into one line.
"\0\sHere is a question.\n\n[half]\![*]\q[Answer 1,answer1]\n\![*]\q[Answer 2,answer2]\n\n[half]\![*]\q[Cancel,CANCEL]\e"Exactly the same, just in one line. This line will be grey in Notepad++, and will work in almost any place. You can definitely format your menu choices like this if you want! It just makes them a bit harder to read or edit if you're not good with SakuraScript. But if you want to add a choice to a place where you don't have too much flexibility, this may be the way to go about it.
If you point a choice at a function that doesn't exist, don't worry. The ghost will do nothing, not crash, so you won't break anything. Pointing a ghost at nothing is one way to do a cancel option if you're lazy, as a matter of fact.
\p[number]What you're going to do is use \p[number] where you would use \0 or \1. What number you decide on for your \p is up to you.
EXAMPLEAs you can see, once you define \p and a number, you have to use \s[number] to give it a surface just like you would for \0 or \1. You can set up multiple \p[number], I forget the exact limit but it seems really unlikely to me that anyone will ever reach it.
"\0\sAnother entity is going to appear using my sad pose.\p\s\e"
A few notes about this "extra character":
If you right click them, it'll treat them like the secondary character.
If they speak, they'll use the secondary character's balloons unless you specify differently using \b (above).
Once they're on the screen, they will stay there until you get rid of them using the \s[-1] tag. So remember to clean up after any extra characters you call up.
You cannot use OnSurfaceRestore on them in aitalk.dic, so once they are stuck in a pose, they will be stuck in it until something jars them out of it or you make them disappear.
You can set individual mouse functions with them and give them their own menu if you want. It involves some coding though, so study mouse.dic carefully. I laid out the basic concepts for how to set it up there.
EXAMPLENotice how things are getting strung together here. There's a pause before the third character speaks, they're set to surface12, they use their own balloon, then once they're done speaking, they disappear.
"\0\sHow are you, third character?\w8\p\s\bI am fine, thank you.\s[-1]\e"
\_l[x,y]For this tag, you'll want to put in the xy values for where you want the thing you're spacing to go.
EXAMPLEThis text will remain within the text area you've defined for your balloon, so you can't space something outside your balloon or anything if you're worried about that. To find the exact xy coordinates you'll want for your spacing, you're probably going to have to go through a lot of trial and error. Put in a new set of xy numbers, test the line, adjust, test, until the thing you're trying to move is where you want it.
"\0\sThis text is over there. \_l[155,175]This side.\e"
Again, this mostly has application in menus, like having the time aligned on the right side or things like that. I'm not sure how it'd come up in casual ghost dialogue. But either way, that's how it works.
You can also put centerx or centery instead of the xy coordinates to presumably center the text in your balloon. This used to work for me but hasn't lately, but perhaps it will work for you. It'd look something like
if you were going to do that.
\_b[filename,x,y]Note the underscore here to differentiate it from \b above. You can see there are three vaues you need to add to \_b - the filename of the image you're using, the x coordinate where you want it, and the y coordinate where you want it.
The default directory for the image file will be your ghost/master/ directory, where all your .dic files are. If you want to get the file from somewhere else, you'll have to add that to the filename. I would recommend making an "img" folder within your master directory just to keep all your in-balloon images in one place so they won't clutter up your .dic files. So...
\_b[file.png,x,y]would point at a file within your master directory, and
\_b[img\file.png,x,y]would pull it from the /master/img folder. I would NOT recommend putting your images in a folder above master because I'm not really sure how you'd even get to them that way.
Now, there are a few things you can do with the x and y coordinates. Like above, you can put centerx or centery to center the image along either axis, although that hasn't been working for me lately. It may work for you though. Finding the right coordinates for your image will take a lot of trial and error as above. Put in values, test, adjust, test, adjust until it's right.
Another important way you can format this line is \_b[filename,inline]. Inline takes the place of both the x and y coordinates, and it will display the image like it was the next text character of the word balloon. If you wanted your image to show up after a sentence, this is what you're going to want to do. Little things like hearts, stars, horseshoes, clovers, blue moons, symbols of any kind, you'll probably want to use this. However, make sure you test your inline image to make sure it looks right to you. The thing about inline is that you can't adjust the x or y if it's too high or low, it's just there.
EXAMPLEIf there's no image or the filename is wrong, nothing will appear. It won't break anything though at least.
"\0\sI am displaying an image. \_b[file.png,centerx,16].\e"
"\0\sI am displaying an image. \_b[file.png,45,centery].\e"
"\0\sI am displaying an image. \_b[file.png,12,25].\e"
"\0\sI am displaying an image. \_b[file.png,inline].\e"
There's a whole series of mostly similar tags used to adjust the font in a balloon. Like the tags used to link to something, font tags need a closing tag as well, otherwise the font change will go through all your text.
\f[change,true/false]Almost all font adjustments will follow this basic format. The "change" there is the adjustment you're making - underline, bold, italic, whatever, and the true/false determines whether it applies or not. So, here's a list of variants on this tag you can use for text.
EXAMPLEAs you can see here, the strikethrough is turned on at the beginning of the statement and then turned off after you're done with the use of the same tag, just changed to default or false. There's a big paragraph showing all these in aitalk.dic. You can crib from that if you're lazy about getting a font effect.
"\0\s\f[strike,true]These words are struck out.\f[strike,false]\e"
Now we're entering the realm of \! tags. These tags can do a lot of different things and can easily mess things up, so make sure you're careful with any \! tag.
Perhaps after a line of dialogue, you want your ghost to do something else as specified in the code.
\![raise,Functionname]Functionname here is a stand-in for the name of whatever function it is you want to call. As long as it has a name, you can call it with Raise. You'd usually want to append this to the end of your dialogue.
EXAMPLEHere, we're calling a hypothetical function called OnTimeCheck. If you're coming up with a lot of different new functions and want to call them in dialogue, you'll probably use Raise for most of them.
"\0\sAfter this dialogue, I will do the time check.\![raise,OnTimeCheck]\e"
Along the same lines, if you need to open up an input box for the user to put it in some kind of value, we'll be using another \! tag.
\![open,inputbox,Functionname,timeouttime]Technically, you can use the \![open] tag to run or open a few different SSP related things, like your calendar or configuration dialogue and such, but for the purposes of this walkthrough, we'll focus on inputboxes. If you want to read more about \![open], you can read the SakuraScript section of the Crow-SSP reference site, but it is in Japanese, as a note, so you'll have to run it through Google Translate probably.
To break down the strip of code above, basically you have open, the command; inputbox, what it's being told to open; Functionname, what function this input box will connect to; and timeouttime, which is how long it'll take for the box to time out (if set to -1, it should never time out). You'll probably see this mostly for things like changing the user's name.
EXAMPLEThis opens an input box where the values it collects from the user will be connected to the function called RandomInput. You'll primarily want to put this at the end of your dialogue.
"\0\sI will open an inputbox.\![open,inputbox,RandomInput,-1]\e"
As a note, I'd point an input box to a function that starts with On, like, OnIceCreamInput, or OnNameInput, or something like that. It just seems to work better.
You may recall a move command from surfaces.txt, if you've gone through that file already. This tag is much along the same lines. What this tag does is move a character on the screen. This has a lot of tricky variables to it, so pay very close attention.
\![move,x,y,travel time,character to reference,reference character move point,moving character move point]Using \!move can sometimes be a nightmare, as you can probably guess. Let's break it down. The first part, \![move] sets up the function, and the rest are values you can add. More confusingly, you don't even need to have all the values depending on what you're doing!
x, y - These are the x and y coordinate of where you want your character to move. If you don't have any specific place mapped out in pixels, you can leave them both at 0. You can also set one to fix to make it so the movement is fixed along one axis.
travel time - This is how long it'll take the character to move in milliseconds.
character to reference - Here's where things start to get confusing. This is the number of the character you're moving towards or away from, if you're using them as a reference point. So, if you were moving towards your secondary character, this number would be 1. For your main, it'd be 0. The same numbers you should know well by now.
reference character move point - I THINK this is one of the points on your reference character you want the thing you're moving to move to. This is broken down into categories like left, right, base, and center, as well as top, bottom, base, and center. Not only that, you can stitch these two things together to create things like right.top or left.bottom. So right.top would move the thing you're moving to the right side of the top of your reference character.
moving character move point - the same as the above, except regarding where the moving character is oriented. So if you wanted the bottom of the character to move to the place, you'd put bottom, or if you want the top of your character to move to the location in mind, you'd put top.
If this makes no sense, I feel you, believe me. I've struggled quite a bit to get move to do what I wanted, so this is one of those functions where again you'll just have to do a lot of trial and error to get it right. But here are a few examples.
\![move,100,100]- Moves instantly to the upper left part of the desktop, 100 x 100 as defined by the x y.
\![move,200,fix]- Moves instantly to the left 200 pixels on the screen on a fixed horizontal axis.
\![move,100,100,3000]- Over the course of three seconds, moves to the 100x100 part of the screen.
\![move,-100,100,,screen,right.top]- Moves instantly to right top of the screen, I think.
\![move,100,,1000,me]- Moves 100 pixels to the right over the course of a second, all the way off the screen if you keep doing it. I'm not sure what the me tag does in this case, honestly. Possibly it's using itself as a reference point?
\![move,0,0,0,1,right.bottom,left.bottom]- Moves instantly to the right side of the secondary character.
As you can see, a versatile tag but one that can be a royal pain to use.
EXAMPLELike many of the things in this section, experimenting with this tag yourself is a good way to familiarize yourself with how it works.
"\0\sI am going to move.\![move,0,0,1000,0,center,top]\e."
At the moment, I can't think of any other tags I've used very frequently, so for now let's move on.
/ - add a paragraph break within code
\![*] - add an SSTP marker in front of a choice
\q[Displayed Name,linkedfunction] - add a choice
\p[number] - add another entity on the screen
\_l[x,y] - space something in a line
\_b[filename,x,y] - put an image in a balloon
\f[change,true/false] - change an aspect of the font
\![raise,functionname] - start a function
\![open,inputbox,Functionname,timeout] - open an input box
\![move] - move something across the screen
Alright, you've read the previous sections, or just the beginner section, and now you're ready to begin writing dialogue. Great!
Now, up to this point, editing things on your ghost has been fairly low-risk. If you messed up something in surfaces.txt or the descript files, it probably didn't affect things too much. Likewise, if your images looked odd, they'd just look odd.
Now that we're going to be editing dialogue within the .dic files, the stakes are a little bit higher. Messing up stuff in the .dic files can cause your ghost to break. This means that when you reload or run your ghost, it won't appear and when you right click the tray icon, much of the menu will be grayed out. If this happens to you, this means something's wrong, and you're going to have to track it down and fix it.
Because the files can be fragile, heed my advice at this point: Save and reload your ghost often. Don't go through an entire file, save, and reload only to find out once it's done that you broke something. Even worse, don't do this with multiple files, because then you're going to have to go back through each one until you can find the one place you messed up. This happened to me (while making the template as a matter of fact!) and it sucks.
The best way to avoid this is to check your work constantly. When you change something, save and reload. If your ghost comes back, you are safe! If your ghost breaks, then you know exactly where you went wrong! All you have to do is undo your changes until your ghost unbreaks and try again. Inching forward like this one step at a time will save you a big headache later.
So as we edit, make sure to check your ghost constantly. Every time you finish editing a line of dialogue actually would be a good time to save your ghost and reload, just to make sure it's still functioning.
But what about the actual editing itself? Where to start?
Like I said, I started writing up stuff with bootend, but that may be a bit intimidating for a new user. One file that's relatively lightweight in terms of hard coding and heavy on dialogue would be aitalk.dic, so that may be a nice easier way to ease into this. As you look in the file, you'll see a lot of my notes, and you'll also see a lot of lines in grey. Remember when I said above that a working line of dialogue is in grey? Always make sure all your lines of dialogue are also in grey with closed quotation marks.
The easiest way to do this is simply to follow my guidelines within aitalk. Replace my text with your own. Keep the quotation marks in place, and just replace whatever's within them with what you like. But remember the SakuraScript you just learned! Set up your characters, set up their poses, space the lines with \w and \n, and make sure your line ends with \e. As you begin editing and replacing dialogue, you'll start to get a feel for how it works.
Now, let's say you just finished writing a hilarious bit of text for your ghost, but how to test it? Well, you can use your test variable in menu.dic (which I did for a long time), but that does require copying and pasting and reloading your ghost each time, which can get tiresome. Luckily, there is a much easier way to test a line of dialogue.
Open up the developer panel in your ghost, and you'll see a button in the panel reading "Script Input". When you click it, an input box will come up.
What you're going to want to do is put your line of dialogue, minus the quotation marks, into the input box. So if you had
in the code, you would paste
into the Script Input box. When you hit enter or ok, the ghost should read your dialogue! You should see it just as you would if the ghost was doing it naturally. You can make them redo the line as many times as you like just by hitting enter again, or reinputting the line into Script Input. Adjust your pauses, poses, spacing, whatever you need to do until it looks right. ALWAYS TEST YOUR DIALOGUE. It takes you like two seconds and it'll save you pain in the long run.
Once it looks right, you are set! Save, and reload your ghost. If your ghost appears again, you are safe! If it breaks, you may have broken something. If you're only writing or replacing a simple line of dialogue, the easiest way to break something is just to hit enter by accident, which will turn your line black instead of grey. If you're playing with the advanced / tag, your line will appear black either way, so that won't help you. Carefully read over your line. Are your quotation marks closed? ARE YOU SURE? Check again. Does it end with the right tag? Are your slashes the right direction? Are you using the right tags? Did you put quotation marks inside the quotation marks? If you can't pin it down, try erasing the line and starting from scratch, or using an existing working line as a base until you can pinpoint the problem.
Well, any way that works for you, but for the sake of the walkthrough, here's my method.
First, I write out a loose line of text in a simple script format. At this point, it's easy to adjust, rewrite, or remove a character's line if I don't like it.
"G: Yo, I'm Girl. T: I'm Triangle. G: We're here to serve as examples for this ghost layout thing. T: It's thrilling work, definitely. G: What, like triangles have so much to do every day? T: You are the dumbest person alive.\e"
Here's a quick example of what it might look like. I just use a single letter for each character and you can see there's no formatting here aside from keeping it within quotation marks and making sure it ends with \e.
If you've been following my template, your surfaces and files should be nicely organized and fairly easy to follow. Girl and Triangle's poses should match even, like Girl's sad pose is 4 and Triangle's is 14 - all you have to do is add a one to get them to match. This is for YOUR BENEFIT. I didn't organize my files like at ALL while doing my Hunter Smoker ghost, and as such finding the right pose for them takes forever also because they have like a million poses. Hopefully for you, this part will only take a few moments.
Anyway, at this point I would pick a character and do all their tags. Let's say I started with Girl.
"\0\sYo, I'm Girl. T: I'm Triangle.\w8\0\s\n\n[half]We're here to serve as examples for this ghost layout thing. T: It's thrilling work, definitely.\w8\0\s\n\n[half]What, like triangles have so much to do every day? T: You are the dumbest person alive.\e"
You can see that along with the \0 and \s[number] tags for Girl as needed, I also added the \w8 tag before each change from \0 to \1 to time things right, and a \n\n[half] whenever the focus would go back to Girl to space her dialogue properly. In fact, because this set of tags is so consistent throughout, I can just copy "\w8\0\s\n\n[half]" and then replace \s with whatever pose number I need. Easy! Then when Girl was done, I'd do Triangle next.
"\0\sYo, I'm Girl.\w8\1\sI'm Triangle.\w8\0\s\n\n[half]We're here to serve as examples for this ghost layout thing.\w8\1\s\n\n[half]It's thrilling work, definitely.\w8\0\s\n\n[half]What, like triangles have so much to do every day?\w8\1\s\n\n[half]You are the dumbest person alive.\e"And done! I'd test the line in Script Input to make sure it looks right and the poses are right, save, and move on to the next line. When I'm on a roll with conversation ideas, I don't want to get bogged down with thinking about the SakuraScript, so sometimes I'll just write a bunch of lines in the simple script format, then go back and add the SakuraScript once I'm done actually writing the dialogue. That way, you can just have a clear focus on your characters while writing and worry about setting up their poses and everything afterwards.
Don't forget to add in your SakuraScript afterwards though, otherwise your user's going to see your unedited script and it's going to look odd.
aitalk.dic is the random conversations your ghost will have. This file is heavy on dialogue, but light on hard coding. This may be a good place to start if you are scared of coding and just want to get used to formatting SakuraScript. This file is fairly long and can get longer, depending on how much dialogue you want to add. You can always go back and update this with more dialogue any time you want.
anchor.dic deals with anchor words, certain words that will automatically become links when your ghost says them. You can use this to link your user to information consistently. For the truly creative, you can also use anchor to change one set of text to something entirely different for whatever reason you may come up with. For the lazy, there is a way to disable this feature entirely, in which case you won't have to really edit anything in this file. But I go more into that in the .dic file itself.
bootend.dic deals with the booting and closing of your ghost. This file does include a lot of hard code right at the beginning which can be intimidating, but I try my best to explain it. Even if you don't understand most of it, all you have to do in this file is just replace dialogue as appropriate. There is also some extra stuff in here getting things like the date and time and messages for changing ghosts or shells, but most of it you will not have to worry about. It's a fairly long file, but you'll probably only have to go through it once. For those afraid of code, again, all you will have to do is replace dialogue as directed.
commu.dic is extremely short and actually deals with an aspect of ghosts that I don't really understand. I think it's their potential to talk to other ghosts, I don't know. Anyway, this file is super short and you pretty much won't have to edit much of anything. Maybe in the future once I get a better grasp on this feature of ghosts I'll come back and add more to this.
etc.dic has many of the extra functions of your ghost, like checking mail, adjusting the time, setting up updates, reacting to your screensaver, things like that. While there is a lot of code in here, again, all you'll be doing is replacing dialogue where appropriate. It is a long file, but one you'll probably only have to do once.
menu.dic deals with the menus your ghost will have. What those menus can have depends on your willingness to learn code or expand them or add what you like. Otherwise, they're simple things and you'll just be replacing dialogue again.
mouse.dic deals with how your mouse interacts with your ghost. You're going to want to know the names of your collisions that you set up in surfaces.txt while making your shell for this. You'll mostly be adjusting those to match and writing dialogue for your ghosts when pet or clicked.
nameteach.dic deals with the user changing their name. It's pretty short and you'll only have to adjust a few lines in here.
shiori3.dic has the hard coding for the version of AYA this template uses. Do not touch anything in this file. Just move along.
string.dic mostly customizes the right click menu for your ghost. This file has unique formatting compared to the others, so make sure you read my directions carefully. It is short though.
word.dic deals with setting up unique envelopes for your ghost to use. A short file that can be even shorter, depending on what ideas for envelopes you have or don't have. Very little coding or dialogue formatting at all! Mostly just putting words in envelopes. More on that in the file itself. Probably one of the easiest files to fill out.
So that's the basic overview of the files you'll be working with. You don't have to do them all at once, you can just chip away at them while you find the time or as your confidence grows. And as I said before, remember to SAVE AND CHECK YOUR GHOST OFTEN! Don't edit several files and then reload only to find something's broken, you'll be kicking yourself trying to find what you did wrong. Take it slow and be thorough.
Well, as you may recall from the first steps page, as you go through the .dic files, you'll be seeing a lot of text in this kind of format.
But maybe you want some concrete examples. If I tell you to replace dialogue in something like this...
EXAMPLEThen what you would be replacing would be \0\sWe can't connect to the account.\w8\1\sThe error returned is '%(reference)'. essentially, leaving the quotation marks and \e tag intact. You can see there's an envelope in this dialogue, as I've talked about above. You can use the envelope or not, it's up to you, but I'll always explain what value an envelope stores in something like this.
"\0\sWe can't connect to the account.\w8\1\sThe error returned is '%(reference)'.\e"
EXAMPLEIf I told you to replace this dialogue, you would replace \1\sThis dialogue displays when the user holds down the uninstall button. with whatever you want, presumably something about the uninstall button. You can write dialogue completely unconnected to what the function does, I can't stop you, but I would really recommend against it. It's helpful to your user and it's helpful to you to be clear.
"\1\sThis dialogue displays when the user holds down the uninstall button.\e"
EXAMPLEIf I told you to replace the snip of dialogue here, you would be replacing \0\sThe pronouns are now he him and his. with whatever dialogue you want. I hope you get what I mean.
presuffix = "masculine"
himher = "him"
heshe = "he"
hisher = "his"
"\0\sThe pronouns are now he him and his.\e"
Maybe you don't want any dialogue when your ghost overlaps the screen, or when your characters overlap each other, or when you update, or when your screensaver goes away. That's fine! All you'd need to do is delete everything between the quotation marks, leaving the marks behind "", or delete the entire line and just leave the space between the two brackets blank. In either case, your ghost will then not say anything when the function is called.
That basically covers most of SakuraScript and editing of the .dic files. There are a few other things though related to coding which I'll cover in the next section.