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

If using Windows, you'll want to grab Notepad++ and the latest build of ONScripter-EN with SDL. It is best to set your locale to Japanese, and set a Japanese font in Notepad++'s Style Configurator, such as MS UI Gothic.

You shall need a fixed-width 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 or Sazanami Mincho is most recommendable, but you can experiment with anything you like. 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 engine sometimes can read text files with the wrong encoding, but it's not meant to. Notepad++ has a bug that does not always let it change file encodings, so you may have to prepare the file elsewhere.

You will most likely want to pack all your game assets in an arc.nsa (NScripter Archive) 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 game's root directory were the inside of the archive.

Scripting Foreknowledge

Make the SECOND 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. If you happen to be running 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.

NScript syntax is roughly similar to that of BASIC, and comments are done with ; rather than #. The % marks numeric variables while $ marks string variables, and the visual novel line breaks and page breaks are done with @ and \, respectively.

NScripts consist of a define block, which contains setting commands that affect the whole game, and a game block, which contains the game and all subroutines thereof. The barest essentials to make a game run are as follows:


;gameid [your game name]

*define

;;;the define block can be empty as long as it exists, but you'll want to make use of it

game
*start

`Now here in the game block, you give the game some text to display,@
`and a line/page break so that the engine won't close immediately.\

The engine will close without an error if it reaches the end of the file with no further instruction. As you can see, the barest basics of (O)NScripter development are as simple as can be, and in sections to come, you will learn how to display images, use effects, create branching choices, and script your very own graphical menu.

Frequently Questioned Problems

Wonky text - Most likely you've chosen a custom font that is variable-width rather than fixed-width. If that's not the problem, it could be an issue with SDL_ttf, which handles text rendering--the latest version has a regression which causes it not to work with ONScripter correctly. Using the version bundled with the ONScripter source code is the better option.
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.