This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
The_Zenith_'s profile picture

SGControl: SGCraft Stargate Controller

Started by The_Zenith_, 07 February 2014 - 02:49 PM
The_Zenith_ #1
Posted 07 February 2014 - 03:49 PM
SGControl
By zenithselenium (@the_zenith_)

So, your server has a Stargate network. That's great! The problem is that it's hard to remember all those addresses. Maybe you've got an Ender Chest where you keep a written address book, but it's clunky because you have to open the book, then enter the address in the DHD, and, more than likely, get some of the symbols wrong in between.

Enter SGControl. SGControl uses a shared address database stored in the cloud (via kode) and automatically syncs that database between all the computers running SGControl on the server. Furthermore, viewers of direwolf20 will recognize the interface, since the UI is built off of his portal control program he uses on Forgecraft.

Features
  • Automated installation script
  • Configuration happens during installation - no need to edit program files
  • Automatic updates
  • Automatic address synchronization
  • Automated fuel delivery
Setup

NOTE: HTTP MUST be enabled for this to work

Supplies:
  • 1 Stargate (DHD optional)
  • 1 Chest (preferably an Ender Chest)
  • 1 wireless turtle (regular is fine. Advanced is optional)
  • 1 advanced computer
  • 1 wireless modem
  • 12 monitor
Dialer Setup

The dialer (turtle) must be adjacent to the Stargate Base block (the bottom center one), as well as the fuel chest. Additionally, both of those must either be either above, below, or in front of the turtle. (image)

Next, paste the following on the dialer's command line to download the lite installer:

pastebin get 1gAjPwYT sgcli

Then run this to start installation.

sgcli dialer

This will fetch the full installer from github and execute it. Sometimes git is finicky, so you may need to repeat this a few times until successful.

During the installation, you will be asked several questions about the configuration. First, you will be asked to enter in which direction the turtle is from the Stargate Base. Note: this is from the perspective of the Stargate Base and must either be up, down, east, west, north or south. (image)
Next, you will be asked to enter which side of the turtle the base is on. This must either be top, bottom, or front. (image)
Finally, you will be asked on which side of the turtle the fuel chest is on. Again, this must either be top, bottom, or front. (image)

You will be informed once the installation is complete what the id of the dialer is. Make note of this since you'll need it when setting up the controller. It is also recommended that you set the turtle's label so that in the event that something happens to the turtle, you won't lose the program and configuration.

Now, all you need to do is run SGDial and your dialer is ready for action!


Controller Setup

The monitor blocks need to be set up in a 4x3 pattern. The advanced computer must be adjacent to one of the monitor blocks and have a wireless modem attached to it. (image)

You will want to have the computer somewhere accessible since you'll need it when adding new addresses.

Run the same pastebin command as above. Both sides of this program use the same installer. However, instead of "sgcli dialer," you'll want to enter this:

sgcli controller

Again, you will be asked several configuration questions. First, you'll be asked to provide a username for the kode repository that will be used to store your shared addresses. Note: if you do want to have shared addresses across your entire stargate network, you'll want to use the same credentials during setup for every controller. You'll also be asked to enter and confirm the password you'll use for this repository. Since this will be the same for multiple machines, I didn't bother ***-ing out the password. Additionally, these credentials are stored in a file as plaintext on the machine, so security isn't really paramount here. (image)

Furthermore, please make sure you use your own kode account and password. Using the ones from that image won't really do you much good. =)

Next, you'll be asked which side the monitor is on. This can be any of the following values: top, bottom, right, left, front, back.
You'll then be asked for the side the modem is on, as well as the id of the dialer (the turtle) (image)

Brief aside: those kode error messages are there because I didn't enter the real password to that repository. =)

Once that's all done and ready to go, you can run SGControl to start it up.


Usage

Adding Your First Address

To add an address, simply click the "Add Address" button on the bottom of the screen. A helpful message will pop up informing you to enter the address in the terminal. (image)
You will be prompted for the location name (the text that will appear on the button), then the address itself.



Dialing and Fuel

Once you have a few addresses entered, your interface might look something like this: (image)

You can now right click on a location and the dialer should dial, right? Uh oh… (image)

OH RIGHT! We forgot to put fuel in the fuel chest. The turtle expects Naquadah to be in the first slot of the chest. Likely I'll update it in the future so that it scans the whole chest, but that's a task for another day. So, put some Naquadah in the first slot of the chest and the turtle will suck it up and keep the gate stocked with one piece at all times. You can now dial.

Note: Presently the program assumes that the first slot has naquadah in it. I'll update it at some point to make sure this is the case.


Synchronization

After any input (adding an address, refreshing, dialing), the controller automatically fetches the most recent version of the address list from the kode repository. (before, after)


Conclusion

As stated before, the dialer and controller will automatically fetch the latest code from github on startup. This is randomly spread out over 20 seconds so that the server's not sending tons of HTTP requests all at once. Furthermore, there's a 10 second delay to ensure that the peripherals are fully loaded (and wrappable) before the update process begins.

I hope you enjoy SGControl! If you have any questions, feel free to tweet them at me (@the_zenith_)
Into_TheCatalyst #2
Posted 07 July 2014 - 10:35 AM
hi, does this work with the 1.7.2 version of computercraft and gregs sgcraft?