Difference between revisions of "Pushing code to Screeps"
(Created page with "When it comes to pushing (uploading/updating/saving/committing) code to Screeps, there is three main ways to go about it. == Client & Browser == The 'default' way to push cod...")
|Line 24:||Line 24:|
=== ATOM ===
=== ATOM ===
The ATOM editor
The ATOM editor the [https://blog.screeps.com/2019/08/ide/ officially reccomended] IDE for screeps. It uses the webAPI to push code, which is set-up though a guided process when installing the [https://atom.io/packages/screeps-ide Screep's-ide package]. It will ask the user to sign-in and create a token for ATOM to use pushing code to the server.
=== VS Code ===
=== VS Code ===
Latest revision as of 23:32, 15 April 2021
When it comes to pushing (uploading/updating/saving/committing) code to Screeps, there is three main ways to go about it.
Client & Browser[edit | edit source]
The 'default' way to push code to Screeps is to use the provided Steam Client and/or Browser version. Using the provided window, a user can write and/or paste code into created modules or directly into main. At the top-left of the window there will be a green checkmark that when clicked will push the current version of the code to the server. It is important to note, that this must be done when the main window's focus is at room-level, attempting to upload code at map-level will result in it not saving, and quite possibly loss of progress as it may reset to the previously pushed version. Along with the checkmark you can also use the circular arrow (return arrow) next to it, to revert your changes to the last-pushed state the server had. Once clicked, there is no warning or pop-up asking are you sure, it is just reverted. Alternatively you can use
ALT + ENTER to do a push or 'save' the current code you are working on.
Another way of editing is though the local copy of your Scripts stored on your machine running the Screep's client. Stored under
C:\Users\UserNameHere\AppData\Local\Screeps\Scripts then in folders dependent on server (like screeps.com, or your local IP for a steam private server), all scripts created are contained within. As long as the client is running, it will auto-sync the relevant folder of scripts (note: will not do subfolders, everything must be in one folder!) So changes made to the Screep's version are synced to the local folder, and changes made to the local folder's scripts are synced to Screep's version. If the client was not running when changes were made to the Screep's version (by any means) Screeps will detect the discrepancy and ask you if you wish to replace your local folder's scripts with the Screep's server's version.
While easy to access and use, as noted it quite possible in a few ways to lose progress on your scripts this way either by not syncing properly, or saving at the wrong time.
GitHub Integration[edit | edit source]
It is possible to use Github to push code to Screeps by commits to the
master branch. First, a User needs to link their Screep's account to their Github account on the account page. Then, any new commits to the repository in the master branch will be uploaded to Screeps. It is important to note that this is one-way, changes on the Screep's server copy by other means do not update the github repository.
Some important things to note:
- Only files from the Directory indicated in the repository sync configuration will be copied.
- Does not copy subdirectories.
- Must be 'default' branch running in Screeps.
Web-API[edit | edit source]
Using Screep's Web API it is possible to push code to Screep's from a variety of applications. Please note: If done automatically there are rate limits in place, always follow the official doc's guidelines on usage and follow posted limits. Screep's official docs also detail how under the committing Scripts using external tools document.
Grunt[edit | edit source]
ATOM[edit | edit source]
The ATOM editor was to be the officially reccomended IDE for screeps, however beyond the first alpha announcement is still believed to be in development as of writing. It uses the webAPI to push code, which is set-up though a guided process when installing the Screep's-ide package. It will ask the user to sign-in and create a token for ATOM to use pushing code to the server.
VS Code[edit | edit source]
Rollup[edit | edit source]
for an example of using Rollup, take a look at the Screeps Typescript Starter
Private-Server Uploading[edit | edit source]
To upload code to a private-server using this method, you need to have the Screepsmod-auth installed and running.