March 10th, 2024: The style guide has had an overhaul to make it easier to understand! Please check what's changed, and chime in with feedback so that our wiki can continue to improve.

X. Template

X. Template
Type Ghost
Developer(s) Zichqec
Origin Original Character
Language(s) English
Sakura X. Template
Release date October 21st, 2020

X. Template is a template ghost created by Zichqec, intended to serve as a personal template to make future ghosts with. It was eventually released to the public so that it would be eligible to use for ghost jams. It is very similar to the Girl and Triangle ghost template, but has been rewritten from the ground up with more streamlined code, extra features, and minimal comments. It is intended to be used by experienced ghost developers, and beginners are recommended to use the Girl and Triangle template instead.


  • Features a single character, with no other characters present unless the developer chooses to add them.
  • Includes extra debug features for developers.
  • Has very few tutorial comments. The only tutorial comments are for new features that have been added and are mostly unique to X. Template.
  • Consistent code formatting and whitespace.
  • Lots of small quality of life features for users.

The main menu setup is very similar to the Girl and Triangle ghost template, including some basic options, but mostly letting the developer fill in what they want for their particular ghost.

The default options are:

  • Repeat last dialogue - Repeats the last random dialogue. Only available if the ghost has said a dialogue this session.
  • Say something - Makes the ghost speak.
  • Talk to another ghost - The ghost will send a communication dialogue to another open ghost. If there is more than one other ghost, it will choose a ghost at random.
  • Functions - Opens the function menu (described below).
  • Config - Opens the config menu (described below).
  • Nevermind - Closes the menu.

If the user has debug functions enabled (this can be done by opening script input and entering %(debug = 1) ), they will additionally have these menu options available:

  • Test variable - A dummy function that can be filled with test code for easy access.
  • To-do list - A submenu containing a list of various things that need to be completed to have a basic ghost. These can be checked off by clicking individual items, and it will track the developer's progress and give them a percentage of how far through the list they are.
  • Check for template updates - Checks Zichqec's website to see if a newer version of X. Template exists. If there is a newer version, it will notify the developer and display the changelog for the latest version, as well as offering a link to where the new version can be downloaded.

At the bottom of the menu is a display of the current runtime, and the current version of the ghost (starts at 1.0.0 and can be customized by the developer).

Function menu

The function menu contains a list of tasks the ghost can do for the user. Multiple of these are also available through SSP's right click menu. Some of them rely on SAORI's that come bundled with the template.

  • Check Email - Check's for emails on all of the user's listed email accounts
  • Fix the Clock - Performs an SNTP check and will offer to fix the user's clock if their time is inaccurate
  • Open Calendar - Open's SSP's built-in calendar
  • Open SSP Preferences - Open's SSP's preferences menu
  • Empty Recycle Bin - Empties the user's recycle bin if there is anything in it. Makes use of the gomi.dll SAORI
  • Show System Information - Uses saori_cpuid.dll to gather the user's system information and display it. Anchors are used to highlight the information for easier reading
  • Report a bug - Tells the user where they can contact the developer in case of bugs
  • Check for updates - Attempts a network update

Config menu

The config menu contains options the user can use to tell the ghost about themself, as well as adjust settings about how the ghost behaves. Whether the ghost makes use of the user's details depends entirely on the ghost in question.

  • Your name - A name for the ghost to call the user by
  • Your pronouns - The user can choose between he/him, she/her, and they/them, and the developer can use %(heshe), %(himher), %(hisher), and %(hishers) to call the appropriate pronouns in dialogue
  • Your birthday - Allows the user to enter their birthday, for the purposes of birthday messages. The month can be entered by its proper name in english, or by a number. Days may be added with suffixes, such as 1st and 3rd
  • Your hemisphere - A toggle that allows the user to reverse which months are considered to be a part of which season
  • Talk rate - Allows the user to choose how often the ghost should talk. Possible options are 5 minutes (the default), 3 minutes, 1 minute, 30 seconds, and don't speak
  • Hour Notifications - A toggle that allows the user to choose if they want hour notifications. This also disables the new year's message
  • Auto update checks - A toggle that allows the user to choose if they want the ghost to check for updates automatically. Automatic update checks happen every time the ghost is booted, and every day at midnight after that
  • Enable uninstall? - A toggle that controls the uninstall option in the right click menu. This makes it harder to uninstall the ghost by mistake

Mouse interactions

Besides opening the menu, X. Template comes with a few hotspots by default that can be interacted with.

  • Hovering the mouse back and forth over the top of the ghost's head will 'pet' them
    • Petting several times in a row, with the mouse never leaving the ghost's image or the petting hotspot, will start continuous petting mode. In continuous petting mode, the ghost will have a different set of comments, and will track the total number of pets in a row. It will also track arbitrary 'points', as well as a high score. The user will be informed if they've reached a new high score when they stop petting the ghost
  • Double clicking on the ghost's face will punch the ghost
    • If the user has never punched the ghost, it will pop up a balloon asking if they are sure before proceeding. This serves as a protection against accidental punches, and will always appear unless the user has previously chosen to go through with punching


X. Template comes with various hotkeys, some for users and some for debugging purposes. Some of these have the same functionality as the buttons in the main menu, and are here for convenience.

  • F1 will open the ghost's readme.txt
  • T will make the ghost speak
  • R will make the ghost repeat its last random dialogue
  • Y will make the ghost speak to another open ghost. If multiple are open, it will choose one at random

In debug mode, the following options will also be available:

  • F5 reloads the ghost
  • F6 reloads the SHIORI
  • F7 reloads the shell
  • F8 reloads the balloon
  • V runs the OnTestVariable function
  • C opens the 'Commu Ping Menu', where developers can send commu messages to specific ghosts, and even customize the messages

Other features

X. Template features a number of smaller quality of life features for users, as well as some miscelleneous functions that are not present in the menu.

  • When installing a new ghost, it will offer to call or switch to the new ghost immediately
  • Keeps track of the day it was opened last, and will comment if it has been 3 months or more
  • Comments on the new year when the year rolls over at midnight
  • Comments on the user's birthday if they open the ghost on their birthday
  • Will not allow the user to accidentally interrupt the first boot sequence by almost any means
  • Comments before being minimized, to reduce the chances of accidentally minimizing the ghost and not knowing how to get it back
  • Offers to display the changelog after a network update
  • Offers to read out the email headers after an email check, if there aren't too many of them
  • Settings options in the config menu will generally give you the option to close the window or go back to the config menu to change more settings

Features for developers

X. Template comes with several features and functions to aid in development. These will only ever be seen by developers working with the code, and are not directly visible to users.

  • Uses the all modifier for menus, making it possible to write menus as several strings, with nothing extra needed to connect them
  • Uses the nonoverlap_pool modifier for randomtalk, making the probablities of dialogues nested in if-checks much nicer
  • Code that is optimized for ghosts with multiple modes. All SakuraScript commands for things like opening the preferences window are sectioned off with -- so that they do not need to be written more than once
  • A basic emergency mode, where it will inform the user that they should check the error log for the details about what caused the ghost to fail to load
  • A much simpler formatting for adding websites to the right click menu
  • Functions for getting what day of the year it is, what week in the year it is, and if it is a leapyear
  • Functions for getting the name of the current month and day, with the option of specifying days in the past/future
  • A “Flag” system, where the developer can set different true/false flags without having to create a lot of global variables
  • An “Auto anchor” system, where the developer can easily create simple anchors and call them in dialogue using an @. For example, an anchor for the name Blue could be called with @Blue, and if written without the @ would be displayed as plain text
  • Functions for checking if a balloon is currently open, adding a linebreak only if the balloon the developer planned for is in use (to make formatting nicer), and for helping make text alignment easier
  • Uses the new definition for shell coding by default


X. Template comes with a custom balloon, called X. Template Balloon. This balloon is set up to be used as a template itself, with the files as simplified as possible.