ComputerCraft Forums

ComputerCraft => Ask a Pro => Topic started by: ItsRewindTIme on Apr 19, 2019, 03:34 PM

Title: Findings my Programs on my Actual Computer?
Post by: ItsRewindTIme on Apr 19, 2019, 03:34 PM
I haven't been able to find an appropriate answer since wanting to do this, so if it is buried somewhere in the forums then I am sorry for the repost.

I have been playing the RupticMC server through the Augmented Tried mod pack on the ATLauncher. I have written a very extensive program and saved it to a floppy disk, but I want to be able to debug it in creative mode offline without rewriting its entirety. Does anyone on this forum know where I could potentially find a saved cfg or dll or txt file on my hard drive to copy and paste the program to another file and use it offline? The program is roughly 180 lines so rewriting it will be a pain.

Any help would be appreciated!

Edit// I don't know why the images uploaded twice, but have 4 of them: On the House!
Title: Findings my Programs on my Actual Computer?
Post by: SquidDev on Apr 19, 2019, 03:38 PM
If you're playing on a server, this isn't really possible. The files are all stored on the server, rather than your local computer.

However, you can use the pastebin (http://www.computercraft.info/wiki/Pastebin_(program)) program to upload your code, download it elsewhere and then edit it. Just run pastebin put <your program name> on the server, then pastebin get <the pastebin id> on a local CC computer.

Once you've got it locally, the program should be in the computer folder of the world directory. You can either edit it in-game, or externally and then reupload it using pastebin again.
Title: Findings my Programs on my Actual Computer?
Post by: ItsRewindTIme on Apr 19, 2019, 07:02 PM
Quote from: SquidDev on Apr 19, 2019, 03:38 PMIf you're playing on a server, this isn't really possible. The files are all stored on the server, rather than your local computer.

However, you can use the pastebin (http://www.computercraft.info/wiki/Pastebin_(program)) program to upload your code, download it elsewhere and then edit it. Just run pastebin put <your program name> on the server, then pastebin get <the pastebin id> on a local CC computer.

Once you've got it locally, the program should be in the computer folder of the world directory. You can either edit it in-game, or externally and then reupload it using pastebin again.

Thank you so much! This helped tons. If you wouldn't mind, I have another question.

So now that I can access my program, I have an issue with one of its loops. After moving forward 100 blocks, the turtle proceeds to break the block below it, turn left, break the block in front of it, and then spin circles breaking each adjacent block. After spinning for a while, I get this error in the console "Works:43: attempt to perform arithmetic__add on nil and number". I'm not entirely sure why this happens, and my programs seems to almost skip the k loop I have written on lines 22 - 41.

Here is the link to my code: https://pastebin.com/FaS7Vgiz

Any help would be appreciated (again...)!
Title: Findings my Programs on my Actual Computer?
Post by: SquidDev on Apr 19, 2019, 07:11 PM
Just a couple of things about code style, etc...


Now, with regards to your actual issue - attempt to perform arithmetic _add on number and nil. That basically means yDif = y + 1 is failing, as y is nil - this means that gps.locate is failing.

It might be worth double checking you've got a wireless modem on the turtle, and sufficient gps servers running. Running the gps locate command in the shell should give you some more information.

I'm not quite sure what you mean about the k loop almost being skipped - I'd assume it spinning in cycles and breaking each adjacent block is it running that loop.
Title: Findings my Programs on my Actual Computer?
Post by: ItsRewindTIme on Apr 19, 2019, 07:18 PM
What is an effective way to increase the range of wireless modems on my GPS Server Computers?
Title: Findings my Programs on my Actual Computer?
Post by: SquidDev on Apr 19, 2019, 07:26 PM
Quote from: ItsRewindTIme on Apr 19, 2019, 07:18 PMWhat is an effective way to increase the range of wireless modems on my GPS Server Computers?
If you're on Minecraft 1.7.10, there isn't really any way (short of asking the server owner to change the config options) - you'll just have to build more computers, and make sure they're suitably spread out. Make sure they're at y=97 or above, as that gives you a substantial range boost.
Title: Findings my Programs on my Actual Computer?
Post by: ItsRewindTIme on Apr 19, 2019, 09:03 PM
One more question in reference to my code (sorry).

In reference to my rewritten code (https://pastebin.com/ptgtWngQ), I am using an if statement on lines 215 - 217 to attempt to close the while loop. If the conditions are met, then the turtle is in its original spot and the code should end. However, it just loops itself.

I'm assuming this is because the endLoop Boolean is outside of the while loop, so I can't alter it. I'm not too sure though. This should be my last debugging (I hope).
Title: Findings my Programs on my Actual Computer?
Post by: Luca_S on Apr 24, 2019, 05:55 PM
Quote from: ItsRewindTIme on Apr 19, 2019, 09:03 PMOne more question in reference to my code (sorry).

In reference to my rewritten code (https://pastebin.com/ptgtWngQ), I am using an if statement on lines 215 - 217 to attempt to close the while loop. If the conditions are met, then the turtle is in its original spot and the code should end. However, it just loops itself.

I'm assuming this is because the endLoop Boolean is outside of the while loop, so I can't alter it. I'm not too sure though. This should be my last debugging (I hope).

I only took a quick glance at your code and it looks like the code to exit the loop should work, I think the problem is with the exit condition:
local x5, z5, y5 = gps.locate()
if (x5 == -6) and (z5 == 2) and (y5 == 0) then
gps.locate (https://wiki.computercraft.cc/Gps.locate)() returns the position as x, y, z so your variable naming is a bit off there, so I assume you're thinking wrong about the position. I would suggest that you go ahead and place the turtle at the final destination and run "gps locate" in the shell which will give you the correct position and then use that in your if statement.