Simple solution for single sourcing and backing up scripts



  • I'm just getting into Screeps and thought I'd post my setup to see A) if it helps anyone, 😎 if anyone has any suggestions for a better solution and C) future reference for myself, LOL.

    After getting to RCL 6, I thought it would be nice to have a test environment before I start trying to attack my neighbors (for the record, they started it). Also, now that I have a much better idea of what I'm doing, I'd like to start my test environment with the goal of full-automation from RCL 1 and up. I realized this meant that out of the box I'd have to copy and paste my scripts back and forth between environments. I'm also worried about my hard drive going out on me, and figured it wouldn't hurt if I had these scripts backed up locally (I know, the server versions of the scripts should be sufficient, but you never know...).

    So my solution was to create symbolic links from the default script locations of both environments pointing to the backed up and now single-sourced location. It's been working great so far. Here's the command I used in PowerShell (5.0?), but of course this would vary depending on your OS and shell of preference:

    new-item -type SymbolicLink -Path C:\Users\admin.home\AppData\Local\Screeps\scripts\screeps.com\default -Target \\server01\Vault\Documents\Screeps

    Before running that, you'd of course need to copy that "default" folder over to your SAN or whatever location you want to single source from. Then run this command for each environment you want to point to that source, replacing the "screeps.com" folder with whatever folder that environment uses.

    I hope that helps. Anyone know of any other ways to do this? Is there a way to point the scripts directory in Screeps to a custom path, for example?



  • @Khaztr that's awesome, but way too complicated for scrubs like me!!

    I'm just double clicking on a batch file before I settle in for any coding session. Dump this into a .bat file in your screeps default code directory and double-click away! (it's really just one xcopy command to a /bkup directory under the current location, the rest is just sloppy date/time filtering to make the filename make more sense.) The date/timestamps double as poor mans version control. 😄

    echo on
    set _my_datetime=%date%_%time%
    set _my_datetime=%_my_datetime::=%
    set _my_datetime=%_my_datetime: =%
    set _my_datetime=%_my_datetime:/=_%
    set _my_datetime=%_my_datetime:.=_%
    xcopy *.js bkup/%_my_datetime% /i /f
    pause
    

    As for another way to redirect...I suspect you can oneDrive autobackup either the actual, or your symbolic location without too much fuss! 🐸


  • Culture

    Pff, you guys make it too complex, just use GitHub and gulp-screeps, done 😄

    Changing servers is as easy as flipping config values.