Giter VIP home page Giter VIP logo

cheapscript's Introduction

CheapScript

An easier method of writing scripts for the games Pokémon Black 2 and White 2.

Note:

This system is not perfect, nor is it complete. Hopefully, we can get to a point where I can say otherwise.

Setup

Requirements

  • devkitARM (from the devkitPro toolchain).
  • Python 3 (latest version).

Decompiling existing script containers:

In order to help people understand the format of Generation 5 scripts, I have written a disassembler to decompile scripts to the format expected by the compiler. This decompiler is far from perfect; it tends to generate files with sizes larger than that of the games, and not all of the commands are implemented/discovered as of now. However, this can be used to comprehend scripts at a basic level.

To invoke the decompiler and save to a file, simply find a script container from the game which you'd like to decompile, then invoke this command:

python DeCheapScript.py <script container name> > .s

If you just want to see the script printed to the console (not necessarily recommended...), omit the > operator:

python DeCheapScript.py <script container name>

Writing a custom script container:

If editing an existing container isn't your goal, or you just want to start anew, that is indeed possible.

  • Create a blank text file in something such as Notepad or Notepad++. Change the extension to .s.
  • Ensure the following lines are at the top:
.include "commands.s"
.include "movements.s"
  • Now, due to the way the DS generation scripts work, you now have to create the header section (which points to the starts of the scripts).

  • Make a label for each of the scripts you are writing (the first part which will be executed when the script is called) under the header:

ExampleScript:
  End
ExampleScript2:
  End
...
  • For each script (again, the part which is executed when you first call the script), you must add a corresponding entry in the header section. Before the declaration of any labels (i.e ExampleScript in my example), you must write these entries, and then end the header section with EndHeader. Like this:
...
Header:
  script ExampleScript
  script ExampleScript2
EndHeader

ExampleScript:
  End
ExampleScript2:
  End
...  
  • You should have something akin to this (but, with the commands you want to be executed):
.include "commands.s"
.include "movements.s"

Header:
  script ExampleScript
  script ExampleScript2
EndHeader

ExampleScript:
  End
ExampleScript2:
  End

Building

To compile a single script container, run the following command in a console:

python CheapScript.py <script container> <destination>

Commands

For a list of implemented commands, click the "Wiki" tab. Otherwise, see this reference for commands which may not be implemented as of yet.

Contributors

Want to contribute? That is completely fine by me. All you have to do is submit a pull request.

Credits:

Kaphotics and pichu2001 for documentation on scripting commands.

recordreader for being a beta tester.

cheapscript's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

getsnipedbo

cheapscript's Issues

Figure out a method of dealing with the relative pointers system.

As far as I know, the games have a relative pointers system, and not an absolute one.
This means the pointers designate how much data to skip over. So in order to remedy this, we need to use simple math.

Here is the math that needs to be replicated in Assembly for the commands, but written in C.

u32 distance = label_offset - invoke_offset

I will probably figure it out myself, but in case anyone has any ideas I am leaving this issue open.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.