Atom Setup

Revision as of 16:26, 19 June 2016 by imported>Gawdl3y (Added snippets info and separated usage into snippets and compilation)

Atom is a completely free, open-source, highly-extensible text editor based on Chromium and Node.js. It was created and is being actively developed by the GitHub team. It can be downloaded from the official Atom site. Atom's interface and functionality is very similar to Sublime Text, so it's a fairly painless transition if you have experience with it. Atom has an extremely flexible package system that allows customization of virtually everything about the editor.

Installation

Install Atom

  1. Go to the Atom website, download the setup file, and run it.

Install Packages

Syntax highlighting and snippets are provided by the language-papyrus package. Compilation is provided by the build and build-papyrus packages.

  1. In Atom, open the settings tab (File -> Settings, or Ctrl + Comma)
  2. Select the Install tab on the side
  3. Search for language-papyrus, then click install on the package when the results appear
  4. Repeat the previous step for build and build-papyrus
  5. To see compiler errors inline with your code, also install the linter package


If your Papyrus Compiler isn't in the default location (C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Papyrus Compiler\PapyrusCompiler.exe), then you must set it in the build-papyrus package settings:

  1. In Atom, open the settings tab (File -> Settings, or Ctrl + Comma)
  2. Select the Packages tab on the side
  3. Search for build-papyrus or find it in the list, and click on Settings
  4. Change the compiler path setting to your appropriate path

Usage

Snippets

The language-papyrus package includes hundreds of snippets you can use for vanilla Skyrim functions and events, as well as various library mods. To use a snippet, just begin typing a function/event name, and press Tab to autocomplete it. Suggestions will appear below the current line as you're typing.

Compilation

Place the below text in a file called .build-papyrus.yml (yes, with the leading dot!) in your Skyrim\Data\Scripts\Source directory. If you don't have the DLC, just remove them from the imports list.

game: skyrim
imports:
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dawnguard
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dragonborn
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Hearthfire
output: C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\
optimize: true

After placing the .build-papyrus.yml file there, any of the scripts you open in Atom will be able to be compiled simply by pressing Ctrl-Alt-B or F9.
If there are errors during compilation, clicking a filename in the build output window will take you directly to the spot in your code in which the error occurred. Ctrl-Alt-G will also jump between any errors.

Mod Organizer

One of the most common problem modders have with Mod Organizer is getting Papyrus compilation working correctly. Setting up Atom to work with Mod Organizer is simple. You do not need to launch Atom through Mod Organizer. Instead, just place the above .build-papyrus.yml file in the mod's scripts source directory that you're working on, e.g. Mod Organizer\mods\Ultra Cool Mod\Scripts\Source. Some tweaking to the file needs to be done, namely changing the imports and output settings. Using the prior mod example, your imports and output settings would look similar to this:

imports:
    - C:\Program Files (x86)\Mod Organizer\mods\Ultra Cool Mod\Scripts\Source
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dawnguard
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dragonborn
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Hearthfire
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source
output: C:\Program Files (x86)\Mod Organizer\mods\Ultra Cool Mod\Scripts

If your scripts depend on another mod, just add its script source directory to the imports list as well, after your mod's directory, but before the Skyrim and DLC directories. Example:

imports:
    - C:\Program Files (x86)\Mod Organizer\mods\Ultra Cool Mod\Scripts\Source
    - C:\Program Files (x86)\Mod Organizer\mods\Some Other Mod\Scripts\Source
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dawnguard
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Dragonborn
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source\Hearthfire
    - C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\Scripts\Source

Recommended packages

To further enhance your experience with Atom, there are thousands of packages for Atom available. You can browse them within the editor itself, or on the official packages site. Here are a few worth taking a look at:



Language: [[::Atom Setup|English]]