## Welcome to chaoskaiser72's Perfect NScripting Class!

This page is a crash course on the basics of NScripts, and contains some more advanced information about ONScripter that would make the main page too wordy. To begin, I've prepared a template you can copy into a 0.txt file (please encode in Shift-JIS) to begin making a working novel. For Windows users, I highly recommend that you do your scripting in Notepad++, with a Japanese font if you'll be handling any premade scripts.
For starters, please make absolutely sure to set the name of your game in the ;gameid line. It is a feature added by Uncle Mion that tells recent versions of ONScripter-EN what folder to store save files in. Putting a text file named game.id containing the name of that game accomplishes the same effect. If you do not set a gameid, your save files will be stored in randomly generated folder names. The reason gameid is commented out in the script is so that older versions of (O)NScripter that don't support this feature won't get confused.

### To start

If you're using Windows, you'll want to grab Notepad++ and the latest build of ONScripter-EN with SDL. If you're going to be reading any Japanese scripts - which is nearly essential - you'll probably need to set your locale to Japanese, and set a Japanese font in Notepad++'s Style Configurator. I use MS UI Gothic.
You need a monospaced font for the game: proportional fonts are not supported, that was the point of PONScripter. It's best to get a free (as in freedom) font if you're going to distribute your game; Sazanami Gothic is most recommendable, but you can experiment with anything you want. Simply drop the font file into your game folder and rename it to default.ttf.
Make a text file named 0.txt, with Shift-JIS encoding. The encoding doesn't matter as much if your script doesn't include any Japanese, but it's better to be safe than sorry.
You will most likely want to pack all your game assets in an arc.nsa (NScripter Archive, not National Security Agency) but while you're still writing the game, you can keep all the asset folders in your project directory, and the engine will read them as if the directory is the inside of the archive.
Please make the first line in your 0.txt a ;gameid. This is absolutely essential, as later versions of ONScripter-EN keep save files in the C:\ProgramData directory (or ~/ on *nix) with each ONS game recieving its own named folder. If a gameid is not set, your save files will be stored in a folder with a randomly generated name, such as ONScripter-12324d. If you happen to be playing a game from before the ;gameid function was added, you can put a text file named game.id in its folder with the name you want.
Copy the contents of the below section into your script, or simply use it as a reference, and you'll have a running game that you can tweak until you've learned how things work.

;gameid [name of your game here]
*define   ;;denotes the start of the definition block, which gives the engine some starting instructions.

language english   ;;tells the engine to prefer english over japanese
mode_wave_demo   ;;tells the engine to still play wave files while using the skip to next choice option
nsa   ;;enables the engine to read game assets from an arc.nsa file.

versionstr "[game name and version designation]","by [author name]"   ;;please replace the text in quotes with your own
caption"[name of your game]"   ;;sets the window title. please replace the text in quotes with your own

transmode alpha   ;;use this if you plan to use alpha mask transparency
;;leftup is the default value, which uses the top-leftmost pixel as the transparent color

;;below here is where you would want to put any effect or stralias lines you'll be using

;;stralias defines nicknames for assets in your game, like so-
stralias image1,"path\to\your\file\image1.png"
stralias image2,"path\to\your\file\image2.png"
;;it can be tedious, but it saves a lot of typing in the long run

game   ;;the game is starting soon! this ends the definition block

*start   ;;starts the program block. doesn't actually do anything by itself

*justsomeblock   ;;this is the first block of your very own. you can put whatever you want here. let's make a very simple text menu

bg image1   ;;sets a nice background image, assuming we made a stralias for an image named image1.
locate 8,4   ;;this sets the location of a line of text, or in this case, our menu. first number is horizontal placement, second is vertical
select "Stage One",*block1,"Stage Two",*block2,"Stage Three",*block3"
;;the above line is our menu - this format is also used for any ingame choices.
;;note the use of commas, and note that each displayed text option has a  before it, so that it displays as english

*block1   ;;start of the another block - in this case, our first bit of gameplay

Hello world!@
Start each English line with a grave accent please.@
Use an at symbol in each line to set where the text advances.@ See?@
End the line and advance the page with backslash.\

If your locale is set to Japanese, the backslash will probably show as a yen sign.\

You are able to use semicolons in English lines; they won't be treated as comments.@
br
Use "br" to make a line break.@
br:br:br:br:br
You can also chain together commands with colons.\

!w400You can use !w commands to invoke a!w1000 pause, with values in milliseconds.@
Use !s commands to display text !s500slowly!sd, ending each slow section with !sd.@
!s0You can also use it to display text instantly.!sd\

Let's move on to the second stage to learn about sound and sprites.\

reset

*block2

To be continued later\

reset

`

### Frequently questioned problems

Wonky text - Most likely you've chosen a custom font that is proportional rather than monospaced. If that's not the problem, it could be an issue with SDL_ttf, which handles text rendering.
Sound effect lag - This is a problem with SDL, which is ONScripter's chief dependency. Most notably, when SDL was built into the Windows binaries instead of included separately, there was a problem with DirectSound's buffer sizes that causes sound effects to load slower. Simply use the binary that includes a separate SDL.dll on Windows; if it's happening on another platform you might be in for a bad time.
The main ONScripter branch supports English, why can't I use it? - Though it does, it breaks lines in the middle of words because it's not tuned to Western languages. It also requires Visual Studio for Windows 8 or above to build, and it doesn't have ONS-EN's nice enhancements like scaling.