Skyrim
0 of 0

File information

Last updated

Original upload

Created by

Cipscis

Uploaded by

Cipscis

Virus scan

Safe to use

About this mod

This is a package for Sublime Text 2 that makes it easier to view Papyrus assembly files (file extension .pas).

Permissions and credits
Donations
Name:
Papyrus Assembly package for Sublime Text 2

By:
Cipscis (Mark Hanna)

Version:
1.5

Description:
This is a package for Sublime Text 2 that makes it easier to view Papyrus assembly files (file extension .pas). These files can be generated in 2 ways:

* Running the Papyrus compiler with either the -keepasm or -asmonly command line arguments. The former compiles the script but keeps the assembly file, whereas the latter does not compile the script and only generates the assembly file.

* Running the Papyrus assembler with the -D command line argument to disassemble a compiled script (file extension .pex).

Papyrus assembly can be converted into fully compiled Papyrus scripts by running it through the Papyrus assembler. A build system is included in the package to make this easy.

Installation:
Extract the "Papyrus Assembly" folder into the Packages directory for your Sublime Text 2 installation. This directory can be opened easily by selecting "Preferences > Browse Packages..." in Sublime Text 2.

That's it. Now you should be able to open files with the .pas extension in Sublime Text 2 and they'll automatically use the syntax highlighting I've defined.

A build system for disassembling compiled Papyrus files is also included in this package.

Update:
1.4 to >= 1.4
If you're updating to version 1.4 or higher from a version prior to 1.4, you should also delete the following file from your Packages/User directory:
Disassemble Papyrus.sublime-build
1.4 to 1.5
If you're updating from version 1.4 to version 1.5, you should also delete the "Compiled Papyrus" directory from your Packages directory.

Uninstallation:
Just delete the "Papyrus Assembly" folder from your Packages directory to uninstall this package.

If you've also installed the "Disassemble Papyrus" build system for decompiling scripts, then also delete the "Compiled Papyrus" folder from your Packages directory.

Use:
To assemble these files into fully compiled scripts, press your "build" keyboard shortcut (Ctrl+B or F7 both work by default) or select "Build" under Tools. For this to work, either "Papyrus Assembly" or "Automatic" need to be selected under Tools > Build System.

To use the "Disassemble Papyrus" build system to generate assembly files from compiled scripts, open up the compiled script in Sublime Text 2 (it should have a file extension of .pex), just run the build system either from "Build" under Tools or via the keyboard shortcut. Either "Disassemble Papyrus" or "Automatic" should be selected under Tools > Build System.

If either of the build packages doesn't work right away, you may need to alter them to match your Skyrim installation directory. Open up the relevant *.sublime-build file and edit the path to match your Skyrim installation directory.

Generating Assembly Files:
If you're a Sublime Text 2 user and a Papyrus scripter, you probably already have the Papyrus build system set up, thanks to the instructions on the Creation Kit Wiki. If not, I suggest you do that now - http://www.creationkit.com/Sublime_Text_Setup

In order to easily generate Papyrus assembly files, I recommend you manually edit your ScriptCompile.bat file (in the "Papyrus Compiler" folder in your Skyrim installation directory) to include the -keepasm command line argument.

Assembly files are generated in the same folder as the compiled script, not the source.

Here is the usage information for the Papyrus compiler as reported via its -? command line argument:

Usage:
PapyrusCompiler <object or folder> [<arguments>]<br><br><span class="wbbtab"></span><span class="wbbtab"></span> object<span class="wbbtab"></span> Specifies the object to compile. (-all is not specified)<br><span class="wbbtab"></span><span class="wbbtab"></span> folder<span class="wbbtab"></span> Specifies the folder to compile. (-all is specified)<br><span class="wbbtab"></span><span class="wbbtab"></span> arguments One or more of the following:<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span>-debug|d<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span> Turns on compiler debugging, outputting dev information to the screen.<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span>-optimize|op<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span> Turns on optimization of scripts.<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span>-output|o=<string><br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span> Sets the compiler's output directory.<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span>-import|i=<string><br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span> Sets the compiler's import directories, separated by semicolons.<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span>-flags|f=<string><br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span> Sets the file to use for user-defined flags.<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span>-all|a<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span> Invokes the compiler against all psc files in the specified directory<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span> (interprets object as the folder).<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span>-quiet|q<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span> Does not report progress or success (only failures).<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span>-noasm<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span> Does not generate an assembly file and does not run the assembler.<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span>-keepasm<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span> Keeps the assembly file after running the assembler.<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span>-asmonly<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span> Generates an assembly file but does not run the assembler.<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span>-?<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span> Prints usage information.<br><br><span class="wbbtab"></span>Here is the usage information for the Papyrus assembler as reported via its -? command line argument:<br><br><span class="wbbtab"></span><span class="wbbtab"></span>Usage:<br><span class="wbbtab"></span><span class="wbbtab"></span>PapyrusAssembler object [-D] [-V] [-Q] [-A] [-S] [-?]<br><br><span class="wbbtab"></span><span class="wbbtab"></span> object Specifies the object to be assembled or disassembled. Assembly looks<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span> for a ".pas" extension. Disassembly looks for a ".pex" extension.<br><span class="wbbtab"></span><span class="wbbtab"></span> -D<span class="wbbtab"></span><span class="wbbtab"></span>Disassembles the object, instead of assembling it.<br><span class="wbbtab"></span><span class="wbbtab"></span> -V<span class="wbbtab"></span><span class="wbbtab"></span>Turns on verbose mode.<br><span class="wbbtab"></span><span class="wbbtab"></span> -Q<span class="wbbtab"></span><span class="wbbtab"></span>Turns on quiet mode. (No status messages, only errors)<br><span class="wbbtab"></span><span class="wbbtab"></span> -A<span class="wbbtab"></span><span class="wbbtab"></span>Do not assemble/disassemble the file, just load and analyze.<br><span class="wbbtab"></span><span class="wbbtab"></span> -S<span class="wbbtab"></span><span class="wbbtab"></span>Strips debugging info from a compiled file. Cannot be used with -A<br><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span><span class="wbbtab"></span> or -D<br><span class="wbbtab"></span><span class="wbbtab"></span> -?<span class="wbbtab"></span><span class="wbbtab"></span>Prints this usage information<br><br><span class="wbbtab"></span>Keep in mind that the compiler expects a file extension, whereas the assembler expects the file name *without* an extension.<br><br>Change Log:<br><span class="wbbtab"></span>1.0 - 12th September 2012<br><span class="wbbtab"></span><span class="wbbtab"></span>Initial Release<br><span class="wbbtab"></span>1.1 - 12th September 2012<br><span class="wbbtab"></span><span class="wbbtab"></span>Added syntax highlighting for semicolon line comments outside of code. These comments are generated in disassembled files generated by the assembler, not assembly files generated by the compiler<br><span class="wbbtab"></span><span class="wbbtab"></span>Fixed terminology for assembly files generated by the assembler - should read "disassembled", not "decompiled". Renamed "Decompile Papyrus" build system to "Disassemble Papyrus"<br><span class="wbbtab"></span>1.2 - 14th September 2012<br><span class="wbbtab"></span><span class="wbbtab"></span>Added ARRAYFINDELEMENT and ARRAYRFINDELEMENT array operators<br><span class="wbbtab"></span>1.3 - 25th September 2012<br><span class="wbbtab"></span><span class="wbbtab"></span>Added JUMPT (JUMP if True) instruction<br><span class="wbbtab"></span>1.3.1 - 25th September 2012<br><span class="wbbtab"></span><span class="wbbtab"></span>Made highlighting case-insensitive, so highlighting is also applied to disassembled files, for example<br><span class="wbbtab"></span>1.4 - 26th September 2012<br><span class="wbbtab"></span><span class="wbbtab"></span>Added blank syntax highlighting for compiled Papyrus and updated "Disassemble Papyrus" build sytem. This means *.pex files can be opened in Sublime Text 2 and the "Disassemble Papyrus" build system will automatically be used. This build file has been moved from the "User" directory into its own package.<br><span class="wbbtab"></span>1.5 - 2nd October 2012<br><span class="wbbtab"></span><span class="wbbtab"></span>Added highlighting for escaped characters in strings. In particular, this prevents strings containing a double quote (escaped as \") from causing issues with strings not closing correctly.<br><span class="wbbtab"></span><span class="wbbtab"></span>Combined both "Papyrus Assembly" and "Compiled Papyrus" into a single package, as there was no benefit to separating them.<br><span class="wbbtab"></span><span class="wbbtab"></span>Removed case sensitivity from non-code assembly markup.<br><span class="wbbtab"></span><span class="wbbtab"></span>Removed inappropriate entity labelling to fix symbol search.<br><span class="wbbtab"></span><span class="wbbtab"></span>Added highlighting for incomplete lines for when you're writing your own assembly code.<br><br>Permissions:<br><span class="wbbtab"></span>Feel free to edit and redistribute this file (in edited or unedited form) anywhere you like without contacting me. I ask only the following:<br><span class="wbbtab"></span><span class="wbbtab"></span>- Include adequate documentation, preferably this readme (potentially modified as appropriate)<br><span class="wbbtab"></span><span class="wbbtab"></span>- Please provide a link to the original download location on Skyrim Nexus<br><span class="wbbtab"></span><span class="wbbtab"></span>- If the package is unedited, please credit me as the author<br><span class="wbbtab"></span><span class="wbbtab"></span>- If the package is edited, please credit me as the author of the original package and include in your documentation the version number of the package that you used as a template for your modified package</string></string></string></arguments></object>