local function loadImage(path)
image = { }
if fs.exists(path) then
local file = io.open(path, "r" )
local sLine = file:read()
local num = 1
while sLine do
table.insert(image, num, {})
for i=1,#sLine do
image[num][i] = tonumber(string.sub(sLine,i,i), 16)
end
num = num+1
sLine = file:read()
end
file:close()
end
return image
end
This will return a table, and any point in the table can be accessed with image[y][x]- this corresponds directly to X-Y coordinates your turtle can use.
Edit: It sounds like you're keen to give this a try Heracles, but would the introduction of a 3D Print function be valuable to NPaintPro?
nitrogenfingers, on 25 October 2012 - 11:27 PM, said:
This is the way I'm doing it:
Spoiler
local function loadImage(path)
image = { }
if fs.exists(path) then
local file = io.open(path, "r" )
local sLine = file:read()
local num = 1
while sLine do
table.insert(image, num, {})
for i=1,#sLine do
image[num][i] = tonumber(string.sub(sLine,i,i), 16)
end
num = num+1
sLine = file:read()
end
file:close()
end
return image
end
This will return a table, and any point in the table can be accessed with image[y][x]- this corresponds directly to X-Y coordinates your turtle can use.
Edit: It sounds like you're keen to give this a try Heracles, but would the introduction of a 3D Print function be valuable to NPaintPro?
We don't need 3D printing, I was planning to use multiple files for multiple levels of the building
nitrogenfingers, on 25 October 2012 - 11:27 PM, said:
This is the way I'm doing it:
Spoiler
local function loadImage(path)
image = { }
if fs.exists(path) then
local file = io.open(path, "r" )
local sLine = file:read()
local num = 1
while sLine do
table.insert(image, num, {})
for i=1,#sLine do
image[num][i] = tonumber(string.sub(sLine,i,i), 16)
end
num = num+1
sLine = file:read()
end
file:close()
end
return image
end
This will return a table, and any point in the table can be accessed with image[y][x]- this corresponds directly to X-Y coordinates your turtle can use.
Edit: It sounds like you're keen to give this a try Heracles, but would the introduction of a 3D Print function be valuable to NPaintPro?
We don't need 3D printing, I was planning to use multiple files for multiple levels of the building
3D Printing has been added to NPaintPro! Link to the turtle printing program on the main page
I have spent hours messing around with this, printing off random junk and though it has some severe limitations you can still do some pretty awesome stuff with it. Things to note:
- Turtles have no directionality when printing, so objects like stairs, redstone repeaters, gates and slabs cannot have a specified direction (making them a bit pointless)
- Wall-mounted things like ladders, torches and paintings can't be relied on either, as printing is done in sweeps so the wall you're mounting your ladder to may not exist when your turtle tries to place it.
- It's all buggy. Needs more testing.
I've also added one or two other little features to the program, like a new "layered" mode that displays all layers at once!
Don't use this mode.
I must admit I've had so much fun messing around with this printer that orientation support does feel like the next thing on the checklist. I'll probably have to modify the file format so optional orientation escape characters can be littered through the program, as well as a directional paint display mode. I use stairs a lot in my builds and that redstone door from the video took awhile to design without repeaters or wall-mounted torches!
Anyway thanks for responses so far- love to see your creations so post what you make!
Very welldone! In-fact this program is what i would be needing for my Angel-TV program for bigger than 2x4 screens....
Can you perhaps let me know if its possible to use this program in my own ?
When one closes(finish editing) a image how does the program save it? anything complicated or is it simple like the basic paint program? [read OP]
would the program be usable with mine if :
'shell.run("paint", "Frame" .. CFrame) --where CFrme is user or automaticaly defined frame number, [except after frame number a extra option would be to save as the npa. extention)
--so
CFrame = 1
--and run the shell command above would yield opening Frame 1 in paint
--once paint is closed with ctrl-enter + ctrl-right-enter (save and close file) it returns to my programs mainmenu automatically
ETHANATOR360, on 18 November 2012 - 01:46 PM, said:
sweet im gonna make an 8 bit mario
EDIT:made
the head not enough room for body
You can scroll the canvas with the arrow keys if you run out of space.
ArchAngel075, on 18 November 2012 - 03:44 PM, said:
Very welldone! In-fact this program is what i would be needing for my Angel-TV program for bigger than 2x4 screens....
Can you perhaps let me know if its possible to use this program in my own ?
When one closes(finish editing) a image how does the program save it? anything complicated or is it simple like the basic paint program? [read OP]
would the program be usable with mine if :
'shell.run("paint", "Frame" .. CFrame) --where CFrme is user or automaticaly defined frame number, [except after frame number a extra option would be to save as the npa. extention)
--so
CFrame = 1
--and run the shell command above would yield opening Frame 1 in paint
--once paint is closed with ctrl-enter + ctrl-right-enter (save and close file) it returns to my programs mainmenu automatically
would the above be possible if i used instead :
shell.run("NPaintPro" , "Frame" .. CFrame)
?
You're of course free to use NPaintPro however you like. If you make something cool, share the link, would love to see what you come up with!
I'm afraid there's no option for specifying the selected frame from the command line- you have to change frames from within the program (with the goto menu option or the <> keys)