1. Welcome to Smogon Forums! Please take a minute to read the rules.
  2. Click here to ensure that you never miss a new SmogonU video upload!

How to Set Up Our PO Scripting Environment

Discussion in 'Pokemon Online' started by Desolate, Apr 21, 2012.

Thread Status:
Not open for further replies.
  1. Desolate


    Jan 6, 2009
    This guide is going to be split up into two parts. The first part will show you how to obtain a copy of Smogon University's scripts locally so you can edit them, and the second part will be an introduction on how to script in PO. This thread will be only the former.

    How to Set Up The Scripting Environment

    Our scripts are hosted on Sarenji's GitHub account under the repository name "poserver".

    Before you can pull the scripts onto your machine, you have to sign up for a GitHub account here. Once you've done that, you have to download, install, and configure Git. GitHub has a guide to do this on Windows here. If you're using Mac OS X, you will want to read this guide. If you are using a Linux distro, you should be able to know how to do this! But if you don't, I guess GitHub can help you out.

    Once you have configured Git, we can begin pulling in the latest scripts onto our machine! To do this, we are going to be doing a process called "forking", which simply means you're going to be contributing to someone's code; your version will be referred to as a fork of the original version.

    To begin, log in to your GitHub account, go to our repository here, and click the "Fork" button in the top right corner of the project page. Now that GitHub knows you are forking this project, you have to clone it onto your machine.

    Run the following code in Git Bash (make sure to replace username with your personal username):
    git clone git@github.com:[I]username[/I]/poserver.git
    Your fork is referred to as origin because it points to your GitHub repository; to keep track of the original repository from which it was forked, we are going to add another remote called upstream:

    cd poserver
    git remote add upstream git://github.com/sarenji/poserver.git
    git fetch upstream
    Congratulations! You now have a copy of Smogon University's PO server scripts on your machine!

    When you've made changes to the scripts, go into Git GUI once you've modified the original scripts.js file. The program will automatically see that changes have been made from the original you obtained and will display the changes. If these changes look correct, you have to stage your changes by clicking the "Stage Changed" button. Once you've done that, you're ready to commit your changes: enter a commit message in the text area and click "Commit". Finally, you are going to push these changes so they appear on your repository:

    git push origin master
    All done! Check your repository and you'll see that your changes have been made. However, you haven't changed the official PO script file; if you feel like you changes will help the server, send a pull request and a developer will review your changes and either choose to pull them or not.

    Please note that the set of scripts on your machine will not be automatically synchronized with the official ones, you have to do this manually:

    git fetch upstream
    git merge upstream/master
Thread Status:
Not open for further replies.

Users Viewing Thread (Users: 0, Guests: 0)