Jump to content

[WIP] Codex – Better Papyrus


DrMentats21

Recommended Posts

Codex
What is it?
Codex is a modern language that compiles to Papyrus.
It streamlines many of Papyrus' powerful features, making it easier to learn and less repetitive to write.
Inspirations include Python, Ruby and CoffeeScript.
Codex has significant indentation and modern control structures.
Features
(Codex on the left, generated Papyrus on the right.)

Clean and compact syntax.

http://i.imgur.com/Rw4OuH4.png

Limited type inference.

http://i.imgur.com/SmGEmsN.png

Automatic generation of for-loops.

http://i.imgur.com/f70ucHI.png

Attribute unification; default attributes.

http://i.imgur.com/olVst4K.png

 

 

Workflow
  • Launch Codex with the -yw flags, followed by every file you want to compile.
  • Save any of the input scripts to automatically generate the Papyrus equivalent in the same directory.
  • Compile the Papyrus output with the Creation Kit.

 

Where can I get it?
Codex is not quite ready yet. It will be officially released at the Nexus soon, probably in the following week. Schedule is a bit fuzzy right now, but I expect to upload a beta if no major problems come up. Documentation will also be expanded before and immediately after release. Meanwhile, if you really cannot wait, you can download the source code here and compile it with Racket (and even contribute changes and fixes, if you like).
How can I learn more about it?
Currently, your best bet are the example scripts provided in this thread and in Codex's wiki, which is incomplete.
Can I help with anything?
Now that you mention it...
  1. Examples and documentation.

    Examples include both scripts of your own creation and the ones from the Creation Kit's wiki. Please provide both handwritten Papyrus and handwritten Codex, as well as make sure that the Creation Kit actually compiles the output with no manual changes whatsoever to the source. Including comments in the code where appropriate is also good practice.

    Additionally, feel free to create and edit pages in Codex's wiki with documentation, examples or anything else you think might help a newcomer.
  2. Bug reports and feature requests.

    Particularly on the project's issue tracker. Using Codex for projects you wish to release on the Nexus is not only universally allowed, but also heavily encouraged. You are not required to release the source code for your scripts but, if you do, please also include the Codex files that generated them.
  3. Highlighting schemes.

    For syntax highlighting in Atom, I'm currently using a hacked subset of the language-papyrus package, which was released under a permissive MIT license. That being said, although I could theoretically release my modifications, I fear they are extremely primitive at the moment. The snippets are so ad hoc, in fact, that function signatures were lifted straight from the original package, and consequently still use the Papyrus convention for argument types.

    If you think you can make a package/grammar for any of the mainstream text editors, to be released either standalone or on Codex's official repository (as per your request), that would be very helpful to me. Just, please, if you are going to upload your work to an external website, don't ship Codex with it.

 

Haven't I seen this before?
There's only one similar project that I know of: PapyrusDotNet is a compiler from C#/VB.NET to Papyrus that was announced and released much earlier than Codex, but has significant differences:
  • PapyrusDotNet produces Papyrus Bytecode, not plain source files, meaning you cannot edit the code after it is generated (unless you decompile it), but also don't have to compile it manually.
  • Much of .NET's functionality is simply impossible to reproduce in Papyrus. Therefore, when using advanced features, the compiler will sometimes reject otherwise valid code. Codex is modeled after Papyrus, so all features have a more or less direct representation in it.
  • .NET has a type system, Codex doesn't. All type inference performed by Codex can be reproduced in C# with the `var` keyword, but Codex (at the time of writing) has no knowledge of function arguments and/or return types, so it sometimes requires *more* declarations than in PapyrusDotNet.
  • This is more a matter of opinion, but both C# (braces, semicolons) and VB.NET (keywords) have a lot of visual noise. One of Codex's main features is precisely the reduction of repetition and redundancy, allowing for a very light syntax.

(I have never used PapyrusDotNet myself, so feel free to correct me if I'm mistaken about any of these points.)

 

 

What is the future of Codex?
Check this page for a summary of features that may be coming to Codex.
Finally, I just hope you find Codex useful. It is a work of love, a thank-you for all the great things and countless hours of entertainment the community has given me free of charge, when I was still a programming noob playing with mods for TES: Oblivion and the like on my childhood home, and had no knowledge about the Creation Kit, nor account on the Nexus. I apologize that I cannot release it yet, but I was so excited about my progress that I had to share it with you!
Link to comment
Share on other sites

Please don't get me wrong, I understand the amount of work you're doing and I do get that you're a smart guy, but...

 

Let me put it that way. I've been scripting on Papyrus for 5 years now and could you simply explain to me why on Earth would I quit this language and move to the new one if I'm not into BDSM? Not saying for everybody, but from my point of view, modders (quest designers) who do stuff for Skyrim and Fallout got used to it. And what's for newbies – who cares about them? If they're to start scripting, they could at least look at the creation kit wiki or ask on the forums here.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...