10 posts
Posted 27 January 2015 - 11:07 PM
Hello,
This is my first post in this forum so right away if I do anything to offend anyone I apologize. I have read the two pinned must reads and I will try to abide by them as best I can for my low level question.
I am using the program made by someone much better at coding than I, who uploaded his program to this site. It is linked below. I like it a lot but I am limited in my ability to use it. The program needs a .schematic file in the directory belonging to the turtle, in order for the turtle to access it and use it. While this is no problem on my own personal servers, as I can just drop the file in from the server back-end, I cannot seem to find a way to do this on a much bigger multiplayer server without being reliant on the server host to drop the files into the turtles directory.
I have asked this question on this authors' thread, but to no avail. My question, is there any way that I could download a .schematic into the turtles folder via a command or a simple program. As the turtles come standard with the ability to "pastebin get [link] [name]" I would think they they certainly have the ability to fetch data from online hosts. I have scoured this forum trying to find such a program but the issue becomes that I hardly know what keywords to search for, and the few that I do are "download" or ".schematic" which often point me in the wrong direction.
I have very limited experience programming turtles or lua, but I feel like this has to have been done before. I don't know though like I said.
Thank you very much for your time and your assistance if you choose to give either. I hope I have not been too much of a bother.
http://www.computercraft.info/forums2/index.php?/topic/17784-schematic-builder/
8543 posts
Posted 27 January 2015 - 11:23 PM
Well, if you put the schematics on pastebin, you could simply use the pastebin fetching script. If you wanted to fetch from any arbitrary url, a quick program to do the dirty work might look something like:
--# grab arguments from the command the user ran
local args = {...}
--# make sure there are enough, otherwise print usage and exit
if #args ~= 2 then
print("Usage:")
print(shell.getRunningProgram().." <file> <url>")
return
end
--# fetch content from url
local data = http.get(args[2])
if not data then
error("Could not fetch data from URL!", 0)
end
--# open file and write data
local handle = io.open(args[1], "w")
if handle then
handle:write(data.readAll())
handle:close()
data.close()
else
data.close()
error("Could not write to file!", 0)
end
print("Success!")
Thank you for reading the sticky posts! You'd be surprised how many people don't.
10 posts
Posted 27 January 2015 - 11:35 PM
Hmm. Immediately I cannot figure out how to post .schematic files to pastebin as opening them with a text editor has gotten me nowhere lol but I will continue to attempt to learn how to do so as it seems the simplest way. Also that program is excellent, I almost feel guilty using it lol. Thank you so much. I try to minimize the amount of hand holding that I require when I'm a newb somewhere. So thank you for taking the bow and doing so anyways. It's awesome to come to a forum where people are so friendly!
355 posts
Location
Germany
Posted 28 January 2015 - 02:35 AM
I try to minimize the amount of hand holding that I require when I'm a newb somewhere.
So thank you for taking the bow and doing so anyways.
It's really nice to see people thanking for 'our' advice :)/>
Although, we are not the kind of community like stackexchange/overflow, where it's almost like impossible to describe somthing "correct",
so that some member will always edit your post like completely.
You don't need to apologize for not knowing something right away. If you can't figure something out by yourself(after some research) you can always ask here ;)/>
Forum guide: If you want to show true love, rather than thanks, you can click this little up-arrow at the bottom right of the post :D/>
7083 posts
Location
Tasmania (AU)
Posted 28 January 2015 - 03:13 AM
Schematic files aren't intended to be treated as text files, meaning that you probably won't have much luck transmitting them through Pastebin directly.
First, they need to be renamed to have a zip extension, and then the archive must be extracted.
The file inside the archive would then need to be translated to something like base64. This'd go into your paste, your script could retrieve the result, then translate it back into something the schematic builder script can use.
Y'know, I reckon I might scribble together some code to handle this later this afternoon. I've been thinking of doing it for a while, if only so I could sneak in some file compression along with the base64 conversion and see whether or not it makes MineCraft servers explode.
10 posts
Posted 28 January 2015 - 05:49 AM
Schematic files aren't intended to be treated as text files, meaning that you probably won't have much luck transmitting them through Pastebin directly.
First, they need to be renamed to have a zip extension, and then the archive must be extracted.
The file inside the archive would then need to be translated to something like base64. This'd go into your paste, your script could retrieve the result, then translate it back into something the schematic builder script can use.
Y'know, I reckon I might scribble together some code to handle this later this afternoon. I've been thinking of doing it for a while, if only so I could sneak in some file compression along with the base64 conversion and see whether or not it makes MineCraft servers explode.
I had seen many posts related to my question referencing base64. Is this a converter available somwhere?
Edit: I have found one online, but I have no idea how to un-encrypt the file once in my turtle.
Edited on 28 January 2015 - 04:51 AM
7083 posts
Location
Tasmania (AU)
Posted 28 January 2015 - 07:25 AM
Be patient, I'm writing one for the purpose. :P/>
7083 posts
Location
Tasmania (AU)
Posted 29 January 2015 - 06:38 AM
Alright, you should be able to use
this to transfer the files from a file system you control (eg, the drive of a computer you've got available in one of your single-player worlds), to a file system you don't (eg, the drive of a computer in an online MineCraft world).
Remember that you'll still need to manually extract the schematic data from their archives before uploading to pastebin (as explained in the schematic builder thread), and that the schematic builder itself is highly unlikely to work under anything past CC 1.58 (I've not personally tried it at all).
10 posts
Posted 31 January 2015 - 01:12 AM
Alright, you should be able to use
this to transfer the files from a file system you control (eg, the drive of a computer you've got available in one of your single-player worlds), to a file system you don't (eg, the drive of a computer in an online MineCraft world).
Remember that you'll still need to manually extract the schematic data from their archives before uploading to pastebin (as explained in the schematic builder thread), and that the schematic builder itself is highly unlikely to work under anything past CC 1.58 (I've not personally tried it at all).
This is very awesome. I am trying as we speak to get it mastered but I am very impressed. I am having an issue finding my pastes on the web in order to captcha and actually post them. The Id's do not seem to beshowing up. Im sure its a newb issue though. Thank you so much! This is so cool!
EDIT: I got it. By just appending the address with the correct ending one can find their post! I knew it was a newb problem. THANK YOU SO MUCH!
Edited on 31 January 2015 - 12:21 AM
7083 posts
Location
Tasmania (AU)
Posted 31 January 2015 - 01:21 AM
Say the script tells you it uploaded to paste ID k6t3fXmp; you'd go to
http://pastebin.com/k6t3fXmp. If it wants you to fill in a captcha, then it should ask at that point - otherwise, you'll probably just see the paste contents, in which case it should be ready to download elsewhere.