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

Cookiebal's Programs (CookieSystem || Turtle advanced movement || Skynet networking || Project World Eater || And a lot more)

Started by Cookiebal, 28 January 2012 - 11:04 PM
Cookiebal #1
Posted 29 January 2012 - 12:04 AM
The first post will mostly contain my more or less finished projects.
The second post is for my filebrowser system (CookieSystem).
The third post is for project world eater and related things.

CookieCannon
SpoilerFour cannons controlled by a single computer and loaded with two chests. Each cannon also has a separate computer but those need no interaction and all got exactly the same program running. The main computer has a little UI showing each cannon's status (the amount of TNT in the cannon's chest, if there is a cannon in a deployer (D or .), if the booster charges are set (B or .), if the ammo is deployed (X or _), and how much ammo there is in the ammo deployer.

Commands are
select (cannon) – selects a cannon, all other commands affect the selected cannon
sendbooster (amount) – sends tnt to the booster chest
sendammo (amount) – sends tnt to the ammo deployer
deploy (1-7) – sends a tnt to one of the deployers
deploy ammo – activates the ammo deployer (the one at the end of each cannon)
deploy booster – activates all deployers

Chicken Factory
Spoiler(copy of youtube description)
My Chicken Farm/Factory. Made with Redpower 2, Computercraft and a tiny bit of IC2 (at the end). It got two computers as a lock for both doors, one master control terminal in the control room (used for misc. commands and needed to activate the others) and five computers that regulate the resources (counting + retrieving). The farm itself contain a regular chicken pen and a second one with an incinerator hooked to it, in case some chickens die and leave raw meat behind there is a cooker that automatically processes raw meat.

Some notes:
-The feather counter actually works, it looks a bit weird because it had 7 before I took out 4 and shows up with 6 after I check again. But when I open the chest later in the video you see it has 6 feathers.
-The incinerator not killing all chickens is a good thing, because having some chickens left behind is good for causing chicken decompression. Without it all the chickens will stay on one spot without moving until something bumps into it.

Here's the pastebin with the code of the self destruct countdown http://pastebin.com/hWcuT6wc

Here's the world save + configs + some instructions. You need to have some knowledge of installing mods to do this.
http://www.mediafire...7g3c9ko2ts9bq3e

E-mails (and virus)
SpoilerA bit outdated now we got rednet and stuff, but this is one of the first networking programs (at least that use bundled cables). It goes at a rate of 2000 chars/minute using five bundled cables (at half potential). It converted characters in numbers and then sends those trough the cables, the other side then converts them back. It's pretty stable, especially v3 , and only started to get scramble when sending very large files.

Send code V3
Spoiler
if redstone.getInput("back")
then
print("Line already in use, try later.")
else

string = ""

file = io.open("netpackage", "r")
strpart = {}
string = ""

strpart = {}
strpart[1] = ""

i=2
while true do
line = file:read()
if line == nil then break end
strpart[i] = line
i=i+1
end

file:close()

for i=1, #strpart do
string = (string..strpart[i].."nxt".."ln")
end

firstchar = {}
firstnum = {}
secondchar = {}
secondnum = {}
thirdchar = {}
thirdnum = {}
fourthchar = {}
fourthnum = {}
fifthchar = {}
fifthnum = {}
n=0
repeat
n=n+1
if (string.len(string) >= 5)
then
  firstchar[n] = string.sub(string,1,1)
  firstnumt = string.byte(firstchar[n])
  firstnum[n] = (firstnumt + 32768)
  secondchar[n] = string.sub(string,2,2)
  secondnum[n] = string.byte(secondchar[n])
  thirdchar[n] = string.sub(string,3,3)
  thirdnum[n] = string.byte(thirdchar[n])
  fourthchar[n] = string.sub(string,4,4)
  fourthnum[n] = string.byte(fourthchar[n])
  fifthchar[n] = string.sub(string,5,5)
  fifthnum[n] = string.byte(fifthchar[n])
  string = string.sub(string,6)
else
  firstchar[n] = string.sub(string,1,1)
  firstnumt = string.byte(firstchar[n])
  firstnum[n] = (firstnumt + 32768)
  string = string.sub(string,2)

  secondnum[n] = 0
  thirdnum[n] = 0
  fourthnum[n] = 0
  fifthnum[n] = 0
end
until string.len(string) == 0

redstone.setBundledOutput("back", 32768)
sleep(0.1)

m=0
repeat
m=m+1
redstone.setBundledOutput("back", firstnum[m])
redstone.setBundledOutput("top", secondnum[m])
redstone.setBundledOutput("bottom", thirdnum[m])
redstone.setBundledOutput("left", fourthnum[m])
redstone.setBundledOutput("right", fifthnum[m])
sleep(0.12)
until m == n

redstone.setBundledOutput("top", 0)
redstone.setBundledOutput("bottom", 0)
redstone.setBundledOutput("back", 0)
redstone.setBundledOutput("left", 0)
redstone.setBundledOutput("right", 0)
end


Receive code V3
Spoiler
string = ""
newchar = ""
finished = false
ended = false

while true do

event = os.pullEvent()
if event == "redstone" then
if redstone.getBundledInput("back") == 32768
then
sleep(0.15)
break
end
end
end


numone = {}
numtwo = {}
numthree = {}
numfour = {}
numfive = {}
n=0
repeat
n=n+1
numonet = redstone.getBundledInput("back")
numone[n] = (numonet - 32768)
numtwo[n] = redstone.getBundledInput("top")
numthree[n] = redstone.getBundledInput("bottom")
numfour[n] = redstone.getBundledInput("left")
numfive[n] = redstone.getBundledInput("right")
sleep(0.12)
until redstone.getBundledInput("back") < 32768


charone = {}
chartwo = {}
charthree = {}
charfour = {}
charfive = {}
m=0
repeat
m=m+1
charone[m] = string.char(numone[m])
chartwo[m] = string.char(numtwo[m])
charthree[m] = string.char(numthree[m])
charfour[m] = string.char(numfour[m])
charfive[m] = string.char(numfive[m])
string = (string..charone[m]..chartwo[m]..charthree[m]..charfour[m]..charfive[m])
until m == n  


string = string.gsub(string, ("nxt".."ln") , "n")
string = string.sub(string, 1, -6)

file = io.open("netpackage", "w")
file:write(string)
file:close()

To use this you need to connect your computers to a big cable (5 bundled ones) and have each bundle only connected to one side.
So one bundle is connected to all your computers' back sides, the second to all the tops, third to all the bottoms, fourth to all the lefts and fifth to all the rights. The front is unused.

setup:
Spoiler


Connect 4 (multiplayer)
SpoilerTwo computer multiplayer, using a disk in the middle. It automatically detects for four in a rows and all the other stuff you expect from a four in a row computer game.

code:
Spoiler

repeat


print("Which player are you? (1 or 2)")
compplayer = read()
compplayer = compplayer+1-1
if compplayer == 1 then otherplayer = 2 end
if compplayer == 2 then otherplayer = 1 end
until compplayer == 1 or compplayer == 2

player = 2
onarow = 1
fiar = false
nmds = 0
nmdg = 0
lmc = 0
lmr = 0
field = {}
for i=1,7 do
field[i] = {}
for j=1,6 do
  field[i][j] = 0
end
end

for s=1, 6 do
if s == 1 then sidecheck = fs.exists("disk/connectmp")
else sidecheck = fs.exists("disk"..s.."/connectmp")
end
if sidecheck == true
then
  if s == 1 then path = "disk/"
  else
   path = ("disk"..s.."/")
  end
end
end
file = fs.open(path.."moveplayerone", "w")
file:close()
file = fs.open(path.."moveplayertwo", "w")
file:close()


function printfield()
term.clear()
term.setCursorPos(1,1)
for i=1,6 do
  for j=1,7 do
   write(field[j][i].." ")
  end
print()
end
end

function hasemptyspot(column)
check = 1
for n=1, 6 do
  check = check * field[column][n]
end
if check == 0
then
  return true
end
end

function setpiece(column)
n = 6
column = column + 1 - 1
while true do
  if field[column][n] == 0 then break end
  n=n-1
end
field[column][n] = player
lmc = column
lmr = n
end

function changeplayer()
if player == 2
then player = 1
else
  if player == 1 then player = 2 end
end
end

function cfwhelp(n,i,j)
lmch = lmc + n*i
lmrh = lmr + n*j
if i ~= 0 or j ~= 0 then
if lmch >= 1 and lmch <= 7 and lmrh >= 1 and lmrh <= 6
then
  if  field[lmch][lmrh] == player
  then
   onarow = onarow + 1
   inrow = true
   if onarow >= 4 then fiar = true end
  end
end end
end


function checkforwin()
for i=-1, 1 do
for j=-1, 1 do
  onarow = 1
  for n=1, 3 do
   inrow = false
   cfwhelp(n,i,j)
   if inrow == false then break end
  end
  for n=-1, -3, -1 do
   inrow = false
   cfwhelp(n,i,j)
   if inrow == false then break end
  end
end
end
if fiar
then
return true
end
end


function sendmove(column)
if compplayer == 1
then
  file = io.open(path.."moveplayerone", "w")
  file:write(column)
  file:close()
end
if compplayer == 2
then
  file = io.open(path.."moveplayertwo", "w")
  file:write(column)
  file:close()
end
redstone.setOutput("back", true)
sleep(0.15)
redstone.setOutput("back", false)
end


function getmove()
print()
print()
print("Waiting for other player. Press Q to exit if he takes too long.")
while true do
event,argument = os.pullEvent()
if event == "char" and argument == "q" then os.reboot() end
if event == "redstone" and redstone.getInput("back")
then
if otherplayer == 1
then
  file = io.open(path.."moveplayerone", "r")
  column = file:read()
  file:close()
  break
end
if otherplayer == 2
then
  file = io.open(path.."moveplayertwo", "r")
  column = file:read()
  file:close()
  break
end
end
end
end


function doturn()
pieceset = false
repeat
print("Turn: "..turn..". Player "..player.."'s turn. Choose a column.")
column = read()
if column == "quit" then os.shutdown() end
if column ~= "1" and column ~= "2" and column ~= "3" and column ~= "4" and column ~= "5" and column ~= "6" and column ~= "7"
then
print("Invalid column.")
else
column = column + 1 - 1
if hasemptyspot(column)
then
  setpiece(column)
  pieceset = true
else
  print("Column is already full.")
end
end
until pieceset
end

turn = 0
printfield()
repeat
changeplayer()
if player == compplayer
then
  turn = turn+1
  doturn()
  sendmove(column)
  printfield()
  print("You've set a new piece in column "..lmc..".")
end
if player == otherplayer
then
  getmove()
  setpiece(column)
  printfield()
  print("Player "..player.." has set a new piece in column "..lmc..".")
end
until checkforwin()
print("Player "..player.." has a four in a row and wins!")


fs.delete( (path.."moveplayerone") )
fs.delete( (path.."moveplayertwo") )

Persistent Variables (api)
SpoilerA standalone api that saves your variables and allows you to change/read them later on. It is designed to work together with CookieSystem, which is why the default path is "/CookieSystem/CS System/pervar/", but that can be changed at the top of the program.

Currently there are four functions:

pervarcreate(variablename) – creates a new (empty) variable. but only if it doesn't exist already.
pervardelete(variablename) – deletes an existing variable.
pervarchange(variablename, newvalue) – changes the variable to newvalue
pervarread(variablename) – reads the variable


so pervarcreate("rawr") would create it.
Then you can use pervarchange("rawr", 30) to set it to 30.
print(pervarread("rawr")) will give 30.
pervardelete("rawr") will then delete the variable.


The code:
Spoiler
pervarpath = "/pervar/"
if fs.exists(pervarpath) == false
then fs.makeDir(pervarpath) end

function pervarcreate(pervarname)
pervarfile = io.open(pervarpath..pervarname..".txt", "r")
if pervarfile
then
  pervarfile:close()
  return "Variable already exists"  
else
  pervarfile = io.open(pervarpath..pervarname..".txt","w")
end
end

function pervardelete(pervarname)
pervarfile = io.open(pervarpath..pervarname..".txt", "r")
if pervarfile
then
  pervarfile:close()
  fs.delete(pervarpath..pervarname..".txt")
else
  return "Variable doesn't exist"  
end
end

function pervarchange(pervarname, newvalue)
pervarfile = io.open(pervarpath..pervarname..".txt", "r")
if pervarfile
then
  pervarfile:close()
  pervarfile = io.open(pervarpath..pervarname..".txt","w")
  pervarfile:write(newvalue)
  pervarfile:close()
else
  return "Variable doesn't exist"
end
end

function pervarread(pervarname)
pervarfile = io.open(pervarpath..pervarname..".txt", "r")
if pervarfile
then
  pervarcontent = pervarfile:read()
  pervarfile:close()
  return pervarcontent
else
  return "Variable doesn't exist"
end
end

To use it in your programs you can either paste this code on top of your program or put this code in a separate program and add the line "shell.run("path+name")" to the top of your code.


The Turtle Factory
Spoiler[media]http://www.youtube.com/watch?v=rqKBC-bNiVA[/media]

You throw the items in the bucket (or have a turtle do it!) and push the button at the end of the production line and get a ready to use pre-programmed turtle! It automatically sorts all materials you throw in it, with a build in incinerator to dispose of what you don't need, then it processes the raw materials until it eventually becomes a wireless mining turtle!

Some (slightly outdated) images to explain what each part does:
Spoiler


Pathfinding and Waypoints (using coordinates)
Spoileroutdated video: (it's easier to use now, but the core still works the same)
[media]http://www.youtube.com/watch?v=kF_EMyUAfJo&feature=player_embedded[/media]
A navigation program based on coordinates, using my persistent variables api I made it possible for the turtle to remember where he is, so you just give it his coords when you set him up and you're good to go. It automatically follows coords in a waypoints text file (using the format x,y,z so without any brackets). It also has some basic block avoidance (see video), though it will still get stuck sometimes, especially against larger or complex things, but it's designed for air travel where there aren't many obstacles usually.


Skynetapi
SpoilerAllows you to send long range messages via a network of special wireless repeaters. Note: You have to open the rednet ports separately
Functions are
skynetrepeater() – Use this to make a turtle/computer act as a repeater.
skynetsendmessage(message, targetid) – sends the string message to the computer with id targetid (it will only arrive if both computers are connected to the same network).
skynetreceivemessage() – Waits for a skynet message and returns it.
skyneteventmessage() – This one works more like an os.pullEvent() with an extra event named "skynet" (which has the first parameter as message), so that you can wait for a skynet message or a key press or anything else.
Spoiler
--Repeater

function messageisnew()
for ticn = 1, ticmemcounter do
  if timeandid == ticmem[ticn]
  then
   return false
  end
end
return true
end

function addtoticmem(newti)
ticmemcounter = ticmemcounter + 1
ticmem[ticmemcounter] = newti
end

function resetticmem()
ticmemcounter = 0
ticmem = {}
os.setAlarm(0)
end


function skynetrepeater()
resetticmem()
while true do
  event, id, message = os.pullEvent()
  if event == "rednet_message"
  then
   if string.sub(message,1,8) == "[skynet]"
   then
	timeandid = string.sub(message,9,21) -- [TTTTTTIIIII]
	if messageisnew()
	then
	 addtoticmem(timeandid)
	 rednet.broadcast(message)
	end
   end
  elseif event == "alarm"
  then
   resetticmem()
  end
end
end


--Sender

function getticode()
time = os.time()
for n=1, 6 do
  if string.len(time) < n
  then time = time.."0"
  end
end

id = os.getComputerID()
for n=1, 5 do
  if string.len(id) < n
  then id = "0"..id
  end
end
timeandidcode = ("["..time..id.."]")
return timeandidcode
end

function gettargetid(targetidf)
targetidf = tostring(targetidf)
for tidlenc=1, 4 do
  if string.len(targetidf) == tidlenc
  then
   targetidf = ("0"..targetidf)
  end
end
targetidf = "["..targetidf.."]"
return targetidf
end

function skynetsendmessage(message, targetid)
if message and targetid then
  rednet.broadcast("[skynet]"..getticode()..gettargetid(targetid)..message) --[skynet][TTTTTTIIIII][IIIII]
end
end


--Receiver

function istargetid()
targetid = tonumber(string.sub(skynettags,23,27))
if targetid == os.getComputerID()
then
  return true
else
  return false
end
end

function skynetreceivemessage()
while true do
  event, id, message = os.pullEvent()
  if event == "rednet_message"
  then
   skynettags = string.sub(message,1,28)
   if string.sub(skynettags,1,8) == "[skynet]" then
	if istargetid() then
	 message = string.sub(message,29)
	 return message
	end
   end
  end
end
end

function skyneteventmessage()
while true do
  event, id, message = os.pullEvent()
  if event == "rednet_message"
  then
   skynettags = string.sub(message,1,28)
   if string.sub(skynettags,1,8) == "[skynet]" then
	if istargetid() then
	 message = string.sub(message,29)
	 return "skynet", message
	end
   end
  else
   return event, id, message
  end
end
end

If you don't understand something you can take a look at the IRC program.

IRC
SpoilerA basic chat program that uses the skynetapi. First make sure you're connected to a skynet, then make sure there is a computer running the IRCserver program and get its ID. Then you have to open the IRCclient program on your own computer and configure the rednet modem side and server id at the top.
commands are
/quit – be sure to use this when you stop. It causes you to logout so the server won't send messages to your computer anymore.
/name – Name yourself.
If you don't type a "/" at the start it will send the message to the IRC server and broadcast it to all connected people.

IRCserver
Spoiler

rednet.open("top")	 -- Be sure to adjust this if necessary!!
shell.run("skynetapi")

function broadcastmessage()
for bcmc = 1, #idlist do
  targetid = idlist[bcmc]
  skynetsendmessage("[IRC]"..message, targetid)
end
end

function addidtolist()
newid = tonumber(string.sub(message,1,5))
idlist[#idlist+1] = newid
end

function removeidfromlist()
removeid = tonumber(string.sub(message,1,5))
for rifln=1, #idlist do
  if removeid == tonumber(idlist[rifln])
  then
   for rifln2 = rifln, #idlist-1 do
	idlist[rifln2] = idlist[rifln2+1]
   end
   idlist[#idlist] = nil
   break
  end
end
end

idlist = {}
while true do
newmessage = skynetreceivemessage()
type = string.sub(newmessage,1,5)
message = string.sub(newmessage,6)
if type == "[NID]" then addidtolist()
elseif type == "[MSG]" then broadcastmessage()
elseif type == "[RID]" then removeidfromlist()
end
print(#idlist)
end

IRCclient
Spoiler

rednet.open("top")  --Be sure to adjust this if necessary!!
IRCserverid = 51	 --Be sure to adjust this if necessary!!
shell.run("skynetapi")

function formatnumbertostring(fnumber, flength)
fnumber = tostring(fnumber)
if string.len(tostring(fnumber)) > flength then return false end
if string.len(tostring(fnumber)) == flength then return tostring(fnumber) end
if string.sub(fnumber,1,1) == "-"
then
  fnumber = string.sub(fnumber,2)
  for formatnumbern=1, (flength-2) do
   if string.len(fnumber) == formatnumbern
   then fnumber = ("0"..fnumber)
   end
  end
  fnumber = ("-"..fnumber)
else
  for formatnumbern=1, flength-1 do
   if string.len(fnumber) == formatnumbern
   then fnumber = ("0"..fnumber)
   end
  end
end
return fnumber
end

function login()
message = "[NID]"..formatnumbertostring(os.getComputerID(), 5)

skynetsendmessage(message, IRCserverid)


end

function logout()
message = "[RID]"..formatnumbertostring(os.getComputerID(), 5)
skynetsendmessage(message, IRCserverid)


end


function sendmessage()
userid = os.getComputerID()
if username then userid = username end
message = ("[MSG]"..userid..": "..typeline)
skynetsendmessage(message, IRCserverid)
end

function printnewline()
message = string.sub(par1,6)
print(message)
end

function executeline()
if string.sub(typeline,1,1) == "/"
then
  if string.sub(typeline,2,5) == "quit" then logout() os.shutdown()
  elseif string.sub(typeline,2,5) == "name" then username = string.sub(typeline,7)
  end
else
  sendmessage()
end
typeline = ""
end

function updatetop()
previousx, previousy = term.getCursorPos()
term.setCursorPos(1,1)
term.clearLine()
print(">"..typeline)
print("--------------------")
term.setCursorPos(previousx, previousy)
end

function ircclient()
maxx, maxy = term.getSize()
while true do
  event, par1 = skyneteventmessage()
  if event == "skynet" and string.sub(par1,1,5) == "[IRC]" then printnewline() sleep(0.1)
  elseif event == "key" and par1 == 14 and string.len(typeline) > 0 then typeline = string.sub(typeline,1, string.len(typeline)-1) updatetop()
  elseif event == "key" and par1 == 28 and string.len(typeline) > 0 then executeline() updatetop()
  end

  if event == "char" and string.len(typeline) < maxx
  then
   typeline = (typeline..par1)
   updatetop()
  end
end
end


term.clear()
term.setCursorPos(1,3)
typeline = ""
login()
updatetop()
ircclient()


CookieTV
Spoiler[media]http://www.youtube.com/watch?v=aQvWje4npHU&feature=plcp&context=C47c2e9bVDvjVQa1PpcFMLuMMbyF2FHkrqbZ34N3R4vZuxlLrx454%3D[/media]
A television in Minecraft, using Redpower 2, Computercraft and of course the Laser mod. It has 15*10 7 colour pixels, controlled by 6 computers. Another main computer is needed to send the image codes via rednet. That computer also has an image creation program, allowing images to easily be made with arrow and number keys in a special UI, unfortunately it can't load images yet. The images are saved as 450 byte binary files, each segment of 75 0/1's has another 5 segments with a length of 15 (one per row), which got the RGB on/off states for each pixel.

The smily image is this:

111001110110111111110001111111111110110111111111111111111111111111111111111
111111111111111111111111111111111110110111111111110001111111111110110110111
111110110110111111110001110111111111110111111111111111111111111111111111111
111111111111111111111111111111111111110111111111110110110111111110110110111
111110110001111111111001110111111111110110111111111111111111111111111111111
111111111111111111111111111111111111110110111111111001110111111110110110111
A big chunk of 1's means a white area, since white is 111 (red on, green on and blue on).


The Code:

Pixelcontroler: Each one gets an unique ID from 1-6. The bottom ones get an uneven number and the top ones an even one. From right to left it goes 1/2 - 3/4 - 5/6.
Spoiler
TVCID = 1
rednet.open("front")
side = {"top", "right", "back", "left", "bottom"}

function receivecode()
while true do
  event, id, message = os.pullEvent()
  if event == "rednet_message" then
   if string.sub(message,1,4) == "[TV]"
   then
	message = string.sub(message,5)
	break
   end
  end
end
end

function filtercode()
filteredcode = string.sub(message, 1+(TVCID-1)*75, TVCID*75)
rowsegment = {}
for n=1, 5 do
  rowsegment[n] = string.sub(filteredcode,1,15)
  filteredcode = string.sub(filteredcode,16)
end
end

function filtersegment(rowsegment)
pixelsegment = {}
for n=1,5 do
  pixelsegment[n] = string.sub(rowsegment,1,3)
  rowsegment = string.sub(rowsegment,4)
end
end

function readrow(row)
filtersegment(row)

red = {}
green = {}
blue = {}
for n=1, 5 do
  red[n] = tonumber(string.sub(pixelsegment[n],1,1))
  green[n] = tonumber(string.sub(pixelsegment[n],2,2))
  blue[n] = tonumber(string.sub(pixelsegment[n],3,3))
end

outputnumber = 0
for n=1, 5 do
  outputnumber = outputnumber + red[n]*2^(3*(n-1)) + green[n]*2^(3*(n-1)+1) + blue[n]*2^(3*(n-1)+2)
end
end

function readcode()
for rownumber=1, 5 do
  readrow(rowsegment[rownumber])
  rs.setBundledOutput(side[rownumber], outputnumber)
end
end




while true do
receivecode()
filtercode()
readcode()
end

showimage:
Used by typing "showimage " like "image smily".
Spoiler

rednet.open("back")

tArgs = {...}
imagename = tArgs[1]

function getimagecode()
file = io.open(imagename, "r")
if file then
  imagecode = file:read()
  file:close()
else print("Select a valid image") end
end

function sendimagecode()
rednet.broadcast("[TV]"..imagecode)
end


getimagecode()
sendimagecode()

Createimage
To use you have to run it and first type an image name, it will be saved as this. Use the arrow keys to move the selected pixel (shown by the *'s on the borders of the image 'preview') and a number between 0-6 to change the colour. Press S and type yes to save, and Q to quit.
Spoiler
function ini()
term.clear()
term.setCursorPos(1,1)
print("imagename:")
imagename = read()

curselpxlX = 1
curselpxlY = 1
end

function convbintonum(bin)
if bin == "111" then num = 0
elseif bin == "100" then num = 1
elseif bin == "010" then num = 2
elseif bin == "001" then num = 3
elseif bin == "110" then num = 4
elseif bin == "011" then num = 5
elseif bin == "101" then num = 6
end
return num
end

function loadimage()
file = io.open(imagename, "r")
imagecodestring = file:read()
file:close()


end

function convnumtobinstring(num)
if num == 0 then bin = "111"
elseif num == 1 then bin = "100"
elseif num == 2 then bin = "010"
elseif num == 3 then bin = "001"
elseif num == 4 then bin = "110"
elseif num == 5 then bin = "011"
elseif num == 6 then bin = "101"
end
return bin
end

function getimagecode()
imagecodestring = ""
for n=1, 6 do
  if n == 1 or n == 2 then startx = 3 elseif n == 3 or n == 4 then startx = 2 else startx = 1 end
  if n == 1 or n == 3 or n == 5 then starty = 6 else starty = 1 end

  for p=0, 4 do
   for q=0, 4 do
	imagecodestring = imagecodestring..convnumtobinstring(image[startx+3*q][starty+p])
   end
  end
end
return imagecodestring
end

function printfield()
term.setCursorPos(1,1)
term.clearLine()
print(imagename)
term.clearLine()
write("+")
write(string.rep("-", 15))
print("+")
for i=1, 10 do
  term.clearLine()
  write("|")
  for j=1, 15 do
   write(image[j][i])
  end
  write("|")
  print()
end
term.clearLine()
write("+")
write(string.rep("-", 15))
print("+")
print("Move around with the arrow keys, change colour by pressing 0-6.")
print("0: white 1: red 2: green 3: blue 4: yellow 5: cyan 6: purple")
end

function newimage()
image = {}
for j=1, 15 do
  image[j] = {}
  for i=1, 10 do
   image[j][i] = 0
  end
end
end

function showselectedpixel()
term.setCursorPos(curselpxlX+1, 2)
write("*")
term.setCursorPos(curselpxlX+1, 13)
write("*")
term.setCursorPos(1, curselpxlY+2)
write("*")
term.setCursorPos(17, curselpxlY+2)
write("*")
end

function move()
if key == 200 then
  if curselpxlY > 1 then curselpxlY = curselpxlY - 1 end
elseif key == 208 then
  if curselpxlY < 10 then curselpxlY = curselpxlY + 1 end
elseif key == 203 then
  if curselpxlX > 1 then curselpxlX = curselpxlX - 1 end
elseif key == 205 then
  if curselpxlX < 15 then curselpxlX = curselpxlX + 1 end
end
end

function quit()
term.setCursorPos(1,13)
term.clearLine()
term.setCursorPos(1,15)
term.clearLine()
term.setCursorPos(1,16)
term.clearLine()
term.setCursorPos(1,17)
term.clearLine()
term.setCursorPos(1,14)
term.clearLine()
print("Do you want to quit?")
answer = read()
if answer == "yes" then
  print("Ending...")
  sleep(1)
  term.clear()
  term.setCursorPos(1,1)
end
end

function save()
term.setCursorPos(1,13)
term.clearLine()
term.setCursorPos(1,15)
term.clearLine()
term.setCursorPos(1,16)
term.clearLine()
term.setCursorPos(1,17)
term.clearLine()
term.setCursorPos(1,14)
term.clearLine()
print("Do you want to save?")
answer = read()
if answer == "yes" then
  file = io.open(imagename, "w")
  file:write(getimagecode())
  file:close()
end
end

function moveandedit()
while true do
  event, arg = os.pullEvent()
  if event == "key"
  then
   key = arg
   if key == 200 or key == 203 or key == 205 or key == 208 then
	move()
   end
  elseif event == "char"
  then
   char = arg
   if char == "0" or char == "1" or char == "2" or char == "3" or char == "4" or char == "5" or char == "6" then
	char = tonumber(char)
	image[curselpxlX][curselpxlY] = char
   elseif char == "q" then quit() if answer == "yes" then break end
   elseif char == "s" then save()
   end
  end
  printfield()
  showselectedpixel()
end
end




ini()
newimage()
printfield()
showselectedpixel()
moveandedit()



It's impossible to make the emptyimage file while it is very handy for shutting down the TV. It's a simple file though, just 450 zeros. Like this
Spoiler
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000


Frame Engine Factory
SpoilerThis Turtle makes an entire compact 6 directional frame engine all by itself (after you build the construction area and run the program). The video is on 4x speed for the most part, the turtle takes about 10-15 minutes building the whole thing. It's based on the frame engine I made that can be seen in my nuke missile and engine tutorial video, with some minor changes. Power input and controls are supposed to be external.

[media]http://www.youtube.com/watch?v=4yROBWMLDW8[/media]


Code:
Spoiler
function dropslotxto16(minslot)
for currentdropslot = minslot, 16 do
  turtle.select(currentdropslot)
  turtle.dropDown()
end
turtle.select(1)
end

function getamountfrominventory(amountneeded)
turtle.suckDown()
repeat
  amountinturtle = turtle.getItemCount(1)
  if amountinturtle < amountneeded then
   turtle.suckDown()
   dropslotxto16(2)
  end
until
  amountinturtle >= amountneeded
if amountinturtle > amountneeded then
  turtle.dropDown(amountinturtle-amountneeded)
end
end

function getframes(amountneeded)
turtle.up()
turtle.back()
turtle.back()
getamountfrominventory(amountneeded)
turtle.forward()
turtle.forward()
turtle.down()
end

function getpanels(amountneeded)
turtle.up()
turtle.back()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
getamountfrominventory(amountneeded)
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.down()
end

function getnotgates(amountneeded)
turtle.up()
turtle.back()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
turtle.back()
getamountfrominventory(amountneeded)
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.down()
end

function getmotors(amountneeded)
turtle.up()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
getamountfrominventory(amountneeded)
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.down()
end

function getbatterybox(amountneeded)
turtle.up()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
turtle.back()
turtle.back()
getamountfrominventory(amountneeded)
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.down()
end

function getbattery()
turtle.up()
turtle.back()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
turtle.back()
turtle.back()
turtle.back()
turtle.suckDown()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.down()
end

function getscrewdriver()
turtle.up()
for n=1, 4 do turtle.back() end
turtle.suckDown()
for n=1, 4 do turtle.forward() end
turtle.down()
end

function dropoffscrewdriver()
turtle.up()
for n=1, 4 do turtle.back() end
turtle.dropDown()
for n=1, 4 do turtle.forward() end
turtle.down()
end

function getredwire(amountneeded)
turtle.up()
turtle.back()
turtle.back()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
getamountfrominventory(amountneeded)
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.down()
end

function getbluewire(amountneeded)
turtle.up()
turtle.back()
turtle.back()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
turtle.back()
turtle.back()
getamountfrominventory(amountneeded)
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.down()
end

function makebaseframefloor()
turtle.up()
turtle.forward()
for m=1, 3 do
  for n=1, 6 do
   turtle.placeDown()
   turtle.forward()
  end
  turtle.turnRight()
  turtle.forward()
  turtle.turnRight()
  turtle.forward()
  for n=1, 6 do
   turtle.placeDown()
   turtle.forward()
  end
  turtle.turnLeft()
  turtle.forward()
  turtle.turnLeft()
  turtle.forward()
end
  turtle.up()
  turtle.forward()
  turtle.turnLeft()
  turtle.forward()
  turtle.forward()
  turtle.placeDown()
  turtle.forward()
  turtle.forward()
  turtle.placeDown()
  turtle.forward()
  turtle.placeDown()
  turtle.turnRight()
  turtle.forward()
  turtle.turnRight()
  turtle.forward()
  turtle.placeDown()
  turtle.forward()
  turtle.placeDown()
  turtle.forward()
  turtle.placeDown()
  turtle.turnLeft()
  turtle.forward()
  turtle.turnLeft()
  turtle.forward()
  turtle.placeDown()
  turtle.forward()
  turtle.placeDown()
  turtle.forward()
  turtle.placeDown()
  turtle.turnRight()
  turtle.forward()
  turtle.turnRight()
  turtle.placeDown()
  turtle.forward()
  turtle.forward()
  turtle.placeDown()
  turtle.forward()
  turtle.placeDown()
  for n=1, 4 do turtle.back() end
  turtle.turnLeft()
  for n=1, 5 do turtle.back() end
  turtle.down()
  turtle.down()
end

function placepanels()
turtle.up()
turtle.forward()
for n=1, 4 do
  turtle.forward()
  turtle.forward()
  turtle.turnRight()
  turtle.forward()
  turtle.place()
  turtle.back()
  turtle.turnLeft()
  for m=1, 3 do turtle.forward() end
  turtle.turnRight()
end
turtle.back()
turtle.down()
end

function placenotgates()
turtle.up()
turtle.forward()
for n=1, 4 do
  turtle.forward()
  turtle.forward()
  turtle.turnRight()
  turtle.digDown()
  turtle.down()
  turtle.dig()
  turtle.up()
  turtle.place()
  turtle.down()
  turtle.select(2)
  turtle.place()
  turtle.up()
  turtle.placeDown()
  turtle.select(1)
  turtle.turnLeft()
  for m=1, 3 do turtle.forward() end
  turtle.turnRight()
end
turtle.back()
turtle.down()
end

function placemotorsinside()
for m=1, 2 do turtle.up() end
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
for n=1, 4 do
  turtle.forward()
  turtle.turnLeft()
  turtle.place()
  turtle.turnRight()
  turtle.forward()
  turtle.forward()
  turtle.turnLeft()
end
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
for m=1, 2 do turtle.down() end
end

function placemotorsoutside()
turtle.up()
turtle.forward()
turtle.turnRight()
for n=1, 4 do
  turtle.forward()
  turtle.forward()
  turtle.turnLeft()
  turtle.dig()
  turtle.forward()
  turtle.turnLeft()
  turtle.turnLeft()
  turtle.placeUp()
  turtle.turnLeft()
  turtle.turnLeft()
  turtle.back()
  turtle.select(2)
  turtle.place()
  turtle.select(1)
  turtle.turnRight()
  turtle.forward()
  turtle.forward()
  turtle.forward()
  turtle.turnLeft()
end
turtle.turnLeft()
turtle.back()
turtle.down()
turtle.down()
end

function adjustmotors()
for m=1, 3 do turtle.up() end
for m=1, 2 do turtle.forward() end
turtle.turnRight()
for m=1, 2 do turtle.forward() end
for m=1, 3 do turtle.placeDown() end
for m=1, 2 do turtle.forward() end
for n=1, 2 do
  turtle.turnLeft()
  turtle.forward()
  for m=1, 3 do turtle.placeDown() end
  for m=1, 2 do turtle.forward() end
end
turtle.turnLeft()
turtle.forward()
for m=1, 3 do turtle.placeDown() end
turtle.turnLeft()
turtle.forward()
for n=1, 4 do
  turtle.placeDown()
  turtle.forward()
  turtle.turnRight()
end
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
turtle.back()
turtle.back()
for m=1, 4 do turtle.down() end
end

function placebatteryboxes()
for m=1, 3 do turtle.up() end
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
for n=1, 4 do
  turtle.forward()
  turtle.turnLeft()
  turtle.place()
  turtle.turnRight()
  turtle.forward()
  turtle.forward()
  turtle.turnLeft()
end
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
for m=1, 3 do turtle.down() end
end

function placesecondframeset()
for m=1, 4 do turtle.up() end
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
for n=1, 4 do
  turtle.down()
  turtle.placeDown()
  turtle.up()
  turtle.placeDown()
  for m=1, 2 do turtle.forward() end
  turtle.placeDown()
  turtle.forward()
  turtle.turnLeft()
end
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
for m=1, 4 do turtle.down() end
end

function placeupmotors()
for m=1, 4 do turtle.up() end
for m=1, 3 do turtle.forward() end
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.turnLeft()
turtle.place()
turtle.digDown()
turtle.down()
turtle.turnRight()
turtle.turnRight()
turtle.placeUp()
turtle.forward()
turtle.turnRight()
turtle.turnRight()
turtle.select(2)
turtle.place()
turtle.select(1)
turtle.back()
turtle.turnRight()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
for m=1, 3 do turtle.down() end
end

function adjustupmotors()
for m=1, 5 do turtle.up() end
for m=1, 3 do turtle.forward() end
turtle.turnRight()
for m=1, 2 do turtle.forward() end
for m=1, 2 do turtle.placeDown() end
turtle.turnLeft()
turtle.forward()
for m=1, 2 do turtle.placeDown() end
turtle.back()
turtle.turnRight()
for m=1, 2 do turtle.back() end
turtle.turnLeft()
for m=1, 3 do turtle.back() end
for m=1, 5 do turtle.down() end
end

function placefifthbatbox()
for m=1, 5 do turtle.up() end
for m=1, 3 do turtle.forward() end
turtle.turnRight()
for m=1, 3 do turtle.forward() end
turtle.placeDown()
for m=1, 3 do turtle.back() end
turtle.turnLeft()
for m=1, 3 do turtle.back() end
for m=1, 5 do turtle.down() end
end

function placedownmotors()
for m=1, 5 do turtle.up() end
for m=1, 5 do turtle.forward() end
turtle.turnRight()
for m=1, 3 do turtle.forward() end
turtle.turnRight()
turtle.forward()
turtle.place()
turtle.back()
turtle.place()
turtle.turnLeft()
for m=1, 3 do turtle.back() end
turtle.turnLeft()
for m=1, 5 do turtle.back() end
for m=1, 5 do turtle.down() end
end

function placesomeframes()
for m=1, 5 do turtle.up() end
for m=1, 2 do turtle.forward() end
turtle.turnRight()
for n=1, 2 do
  turtle.forward()
  turtle.placeDown()
end
for n=1, 2 do
  for m=1, 2 do turtle.forward() end
  turtle.turnLeft()
  turtle.placeDown()
  turtle.forward()
  turtle.placeDown()
end
for n=1, 2 do
  turtle.forward()
  turtle.placeDown()
end
turtle.turnLeft()
turtle.forward()
turtle.placeDown()
for m=1, 2 do turtle.forward() end
turtle.turnLeft()
turtle.back()
turtle.turnLeft()
for m=1, 2 do turtle.back() end
for m=1, 5 do turtle.down() end
end

function placesecondpanels()
for m=1, 4 do turtle.up() end
for m=1, 3 do turtle.forward() end
turtle.turnRight()
turtle.forward()
turtle.placeDown()
for m=1, 2 do turtle.up() end
for m=1, 3 do turtle.forward() end
turtle.down()
turtle.placeDown()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
turtle.down()
turtle.placeDown()
for m=1, 2 do turtle.up() end
for m=1, 3 do turtle.forward() end
turtle.down()
turtle.placeDown()
turtle.forward()
turtle.turnRight()
for m=1, 4 do turtle.back() end
for m=1, 5 do turtle.down() end
end

function placesecondnotgates()
for m=1, 6 do turtle.up() end
for m=1, 4 do turtle.forward() end
turtle.turnRight()
turtle.forward()
turtle.placeDown()
for m=1, 3 do turtle.forward() end
turtle.down()
turtle.turnRight()
turtle.turnRight()
turtle.placeDown()
turtle.up()
for m=1, 4 do turtle.forward() end
turtle.turnRight()
for m=1, 4 do turtle.back() end
for m=1, 6 do turtle.down() end
end

function placemoreframes()
for m=1, 2 do turtle.up() end
turtle.forward()
for n=1, 4 do
  for m=1, 3 do turtle.forward() end
  turtle.placeDown()
  for m=1, 2 do turtle.forward() end
  turtle.turnRight()
end
turtle.up()
turtle.forward()
turtle.place()
turtle.back()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.place()
turtle.up()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.place()
turtle.back()
turtle.back()
turtle.turnRight()
for m=1, 5 do turtle.back() end
turtle.turnLeft()
for m=1, 4 do turtle.down() end
end

function placemorepanels()
for m=1, 2 do turtle.up() end
turtle.forward()
for n=1, 4 do
  for m=1, 3 do turtle.forward() end
  turtle.placeDown()
  for m=1, 2 do turtle.forward() end
  turtle.turnRight()
end
for m=1, 2 do turtle.up() end
for m=1, 2 do turtle.forward() end
turtle.placeDown()
for m=1, 2 do turtle.back() end
turtle.turnRight()
for m=1, 3 do turtle.forward() end
turtle.placeDown()
turtle.turnLeft()
turtle.forward()
turtle.placeDown()
turtle.turnRight()
turtle.up()
for m=1, 2 do turtle.forward() end
turtle.turnLeft()
turtle.forward()
turtle.placeDown()
for m=1, 3 do turtle.back() end
turtle.turnRight()
for m=1, 5 do turtle.back() end
turtle.turnLeft()
for m=1, 5 do turtle.down() end
end

function placeredwire()
turtle.up()
turtle.up()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
for n=1, 4 do
  for m=1, 4 do turtle.forward() end
  turtle.turnRight()
  turtle.place()
  turtle.turnLeft()
  for m=1, 3 do turtle.forward() end
  turtle.turnRight()
end
for m=1, 3 do turtle.up() end
for m=1, 3 do turtle.forward() end
turtle.turnRight()
for n=1, 2 do
  turtle.forward()
  turtle.placeDown()
end
turtle.up()
for m=1, 2 do turtle.forward() end
for n=1, 2 do
  turtle.forward()
  turtle.placeDown()
end
for m=1, 5 do turtle.back() end
turtle.turnLeft()
for m=1, 3 do turtle.back() end
for m=1, 6 do turtle.down() end
end

function placebluewire()
for m=1, 5 do turtle.up() end
turtle.forward()
turtle.turnRight()
for m=1, 3 do turtle.forward() end
turtle.placeDown()
turtle.turnLeft()
turtle.forward()
turtle.placeDown()
turtle.back()
turtle.back()
turtle.turnRight()
for m=1, 3 do turtle.back() end
turtle.turnLeft()
for m=1, 5 do turtle.down() end
end

function placeright()
turtle.turnRight()
turtle.place()
turtle.turnLeft()
end

function placeleft()
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end

function placeshellpartone()
turtle.up()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
for i=1, 4 do
  for n=1, 4 do
   for m=1, 6 do
	turtle.forward()
	placeright()
   end
   turtle.forward()
   turtle.turnRight()
  end
turtle.up()
end
for m=1, 5 do turtle.down() end
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end

function placeshellparttwo()
for m=1, 4 do turtle.up() end
turtle.turnRight()
for m=1, 4 do turtle.forward() placeleft() end
turtle.forward()
turtle.forward()
turtle.up()
turtle.turnLeft()
for n=1, 4 do
  for m=1, 6 do
   turtle.forward()
   placeleft()
  end
  turtle.forward()
  turtle.turnLeft()
end
turtle.up()
turtle.up()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
for n=1, 3 do
  for m=1, 6 do
   turtle.placeDown()
   turtle.forward()
  end
  turtle.turnLeft()
  turtle.forward()
  turtle.turnLeft()
  turtle.forward()
  for m=1, 6 do
   turtle.placeDown()
   turtle.forward()
  end
  turtle.turnRight()
  turtle.forward()
  turtle.turnRight()
  turtle.forward()
end
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.digDown()
turtle.down()
turtle.placeDown()
turtle.up()
turtle.placeDown()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
turtle.back()
for m=1, 7 do turtle.down() end
end

function givepower()
for m=1, 5 do turtle.up() end
for m=1, 6 do turtle.back() end
turtle.turnRight()
turtle.forward()
turtle.forward()
for n=1, 3 do
  redstone.setOutput("bottom", true)
  sleep(0.5)
  redstone.setOutput("bottom", false)
  sleep(0.5)
end
sleep(30)
turtle.forward()
turtle.forward()
turtle.forward()
for n=1, 3 do
  redstone.setOutput("bottom", true)
  sleep(0.5)
  redstone.setOutput("bottom", false)
  sleep(0.5)
end
for m=1, 5 do turtle.back() end
turtle.turnLeft()
for m=1, 6 do turtle.forward() end
for m=1, 5 do turtle.down() end
end

function moveengineup()
for m=1, 4 do turtle.up() end
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
for m=1, 3 do turtle.forward() end
turtle.turnRight()
redstone.setOutput("front", true)
sleep(0.5)
redstone.setOutput("front", false)
turtle.turnLeft()
for m=1, 3 do turtle.back() end
turtle.turnLeft()
turtle.back()
turtle.turnRight()
for m=1, 4 do turtle.down() end
end



getframes(48)
makebaseframefloor()
getpanels(4)
placepanels()
getnotgates(4)
placenotgates()
getmotors(8)
placemotorsinside()
placemotorsoutside()
getscrewdriver()
adjustmotors()
dropoffscrewdriver()
getbatterybox(4)
placebatteryboxes()
getframes(12)
placesecondframeset()
getmotors(2)
placeupmotors()
getscrewdriver()
adjustupmotors()
dropoffscrewdriver()
getbatterybox(1)
placefifthbatbox()
getmotors(2)
placedownmotors()
getframes(9)
placesomeframes()
getpanels(4)
placesecondpanels()
getnotgates(2)
placesecondnotgates()
getframes(7)
placemoreframes()
getpanels(8)
placemorepanels()
getredwire(8)
placeredwire()
getbluewire(2)
placebluewire()
getframes(64)
placeshellpartone()
getframes(59)
placeshellparttwo()
givepower()
moveengineup()

Cookiebal #2
Posted 29 January 2012 - 12:05 AM
CookieSystem

Latest version installer: V1.1
Pastebin: http://pastebin.com/J9DAzTKf
Mediafire: http://www.mediafire...vl7r3byy8va2x03


V1:
SpoilerThe CookieSystem adds a file browsing system and account system with access levels (you don't have to worry about those if you are the only one using the computer). The new file system allows you to browse trough things quicker and easier than the default CC. Instead of having to type ls and cd you can now just use the arrows, enter and backspace keys. :P/>/>



All you need to install it is this installer file:
http://www.mediafire...mz5fw3dxoem167q
or http://pastebin.com/Mq7Z6iAS

To install it just put that file on a computer and run it, answer yes when asked for confirmation.
After installing reboot it and it will start in CookieSystem. Log in with the admin account (name: admin, pass: admin) (pass can be changed later).








You will see the following:
1: Username + access level.
2: version + time (Minecraft, not RL)
3: Programs and folders (and text files too) can easily be separated with =folder= =progrm= and ==text==
4: The first 16 characters of a program/text/folder name.
5: The selected item is marked by *s as border
6: The ">" shows if you are in navigation (not present) or commandline (present) mode.
7: The commandline. Use it to type various commands. (more info below)
8: The infoline. Sometimes when a command failed it gives a message why it failed.
9: The current path of the folder you're in.
10: The full name of the selected item.


Note: for ingame help, go into the CookieSystem folder and look for CS-help and execute it.

Press tab to switch between modes
Navigation Mode
Use the arrow keys to move trough the tiles.
If there are more than 20 items in a folder, there will be multiple pages. Use page up and pagedown to scroll trough them.
Pressing enter will either execute a program, read (edit) a text file or open a folder.
Pressing backspace will move up one folder. So if you were in /rom/programs/ you will go to /rom/
pressing delete will delete the selected item, but you need to a high enough level to edit it.
pressing home will bring you to the main screen (path "/")


Commandline Mode
-edit: edits the selected program/.txt .
-delete: deletes the selected item (You need to have a level high enough to edit it).
-shutdown: Shuts the computer down
-copy: Copies the selected item.
-paste: Pastes the copied item in the current folder.
-maintenance: (admin only) use this command and ctrl+t to go in the normal mode of Computercraft.
-help … : Same as the regular help command.
-new program/folder name : Makes a new program or folder of the specified name, to make a text file make a program with a name ending in .txt.
-rename newname : Renames the selected item to newname.
-setlevel use/edit 1/2/3 : Sets either the use level or edit level of the selected item to 1, 2 or 3. You need to be able to edit the corresponding file in "/CookieSystem/DB/DBlevels/uselevel/" or "/editlevel/" to be able to use this command.

Difference between text and program files
If you select a program and press enter you will execute it, but a file full of text can't be executed of course. That's why programs ending on .txt (text files) are opened in edit mode instead of executed. So that you don't have to use the edit command just to read a text file.

Levels
First of all, if you only use the admin account levels aren't necessary. Since the admin counts as level 4 and can open and use everything.
But if you got multiple users and don't want some of them to be able to accidentally execute that self destruct program, you will want to use levels.
All new accounts are level 1. This can be changed with the setlvl program (in /CookieSystem/) (note: the default level to use that program is 3). With that a user can set another account's level to any level lower than his own (example: a level 3 can set a level 1 to 2 and a level 2 to 1, but not a 3 to 2 or 1 to 3).
All programs are a default level of 4. So if you want a program to be useable at all you will need to add it to one of the use-lists. You can do this via two ways, Both require you to be able to edit the level files. The first one is to go to the level files themselves and edit them to add the path and name of programs. The second is to select the file and use the setlevel use/edit 1/2/3 command. So if you want to make a program useable by level 2's and editable by level 3's, you can either go to /CookieSystem/DB/DBlevels/uselevel/ and edit the file named "2", scroll down and add the path + name of what you want to add (there should be some examples in there already, if this is confusing). That's one part done, now you can go search the file, select it and type "setlevel edit 3" in the commandline.

Be careful with edit rights though. If you give level 1's edit and use rights of the same program they can change it completely into a virus and execute it to crash the computer or something worse.



If you got any questions or suggestions don't hesitate to ask :P/>/>

Also, a (slightly outdated) video of the CookieSystem in action:

V1.1

SpoilerCookieSystem v1.1 update

Pastebin: http://pastebin.com/J9DAzTKf
mediafire: http://www.mediafire...vl7r3byy8va2x03

changes:
-Automatically adjusts to terminal size, or in other words, custom width and height support.
-Added the commandtab in navigation mode which has all the commands that don't need additional parameters. (currently has use, edit, copy and paste)
-Added uninstall file which automatically removes the installed stuff. You can find it in /CookieSystem/CS folder/

To use the commandtab you press the 1,2,3 or 4 on your keyboard (not numpad, but the ones (usually) below your f1-f4 keys). When you press the enter key it will look what the currently active item on the commandtab is (shown by the *s) and do that. The previous use of the enter key is now "1.use".

recommended screen sizes are multiplications of 10 for the width and multiplications of 3 for the heigth. Others work too but have some empty space either to the right or just above the lowest line.
The below screensize is what I currently use: (80,24)



planned for 1.2 if it ever comes:
-CSInstaller moves to /Cookiesystem/CS after it's finished
-When a program ended it will only continue after a key has been pressed, and it will clear the screen before the program starts.
-Show file levels on the file tiles.
Cookiebal #3
Posted 29 January 2012 - 12:07 AM
Advanced coordinate based movement system with basic block avoidance and waypoints

SpoilerMovement system released!
You will need three files for this. The pervarapi, the movementapi, the pathfinding program and the waypoint program! You'll also need to configure the starting coords and orientation.

First, the edited pervarapi. (path is a bit different)

Spoiler
pervarpath = "/pervar/"
if fs.exists(pervarpath) == false
then fs.makeDir(pervarpath) end

function pervarcreate(pervarname)
pervarfile = io.open(pervarpath..pervarname..".txt", "r")
if pervarfile
then
  pervarfile:close()
  return "Variable already exists"  
else
  pervarfile = io.open(pervarpath..pervarname..".txt","w")
end
end

function pervardelete(pervarname)
pervarfile = io.open(pervarpath..pervarname..".txt", "r")
if pervarfile
then
  pervarfile:close()
  fs.delete(pervarpath..pervarname..".txt")
else
  return "Variable doesn't exist"  
end
end

function pervarchange(pervarname, newvalue)
pervarfile = io.open(pervarpath..pervarname..".txt", "r")
if pervarfile
then
  pervarfile:close()
  pervarfile = io.open(pervarpath..pervarname..".txt","w")
  pervarfile:write(newvalue)
  pervarfile:close()
else
  return "Variable doesn't exist"
end
end

function pervarread(pervarname)
pervarfile = io.open(pervarpath..pervarname..".txt", "r")
if pervarfile
then
  pervarcontent = pervarfile:read()
  pervarfile:close()
  return pervarcontent
else
  return "Variable doesn't exist"
end
end


Next, the movementapi, which you should name "movecoordapi" (either that or change the shell.run stuff in the other programs)

Spoiler


shell.run("pervarapi")

function facenorth()
local currentface = tonumber(pervarread("currentface"))
if currentface == 0 then turtle.turnRight() turtle.turnRight() end
if currentface == 1 then turtle.turnRight() end
if currentface == 3 then turtle.turnLeft() end
pervarchange("currentface", 2)
end

function faceeast()
local currentface = tonumber(pervarread("currentface"))
if currentface == 1 then turtle.turnRight() turtle.turnRight() end
if currentface == 2 then turtle.turnRight() end
if currentface == 0 then turtle.turnLeft() end
pervarchange("currentface", 3)
end

function facesouth()
local currentface = tonumber(pervarread("currentface"))
if currentface == 2 then turtle.turnRight() turtle.turnRight() end
if currentface == 3 then turtle.turnRight() end
if currentface == 1 then turtle.turnLeft() end
pervarchange("currentface", 0)
end

function facewest()
local currentface = tonumber(pervarread("currentface"))
if currentface == 3 then turtle.turnRight() turtle.turnRight() end
if currentface == 0 then turtle.turnRight() end
if currentface == 2 then turtle.turnLeft() end
pervarchange("currentface", 1)
end


function movenorth()
facenorth()
didmove = turtle.forward()
  if didmove then
  local newzcoord = pervarread("coordz") - 1
  pervarchange("coordz", newzcoord)
else
  return "blocked"
end
end


function movesouth()
facesouth()
didmove = turtle.forward()
  if didmove then
  local newzcoord = pervarread("coordz") + 1
  pervarchange("coordz", newzcoord)
else
  return "blocked"
end
end

function movewest()
facewest()
didmove = turtle.forward()
  if didmove then
  local newxcoord = pervarread("coordx") - 1
  pervarchange("coordx", newxcoord)
else
  return "blocked"
end
end

function moveeast()
faceeast()
didmove = turtle.forward()
  if didmove then
  local newxcoord = pervarread("coordx") + 1
  pervarchange("coordx", newxcoord)
else
  return "blocked"
end
end

function moveup()
didmove = turtle.up()
  if didmove then
  local newxcoord = pervarread("coordy") + 1
  pervarchange("coordy", newxcoord)
else
  return "blocked"
end
end

function movedown()
didmove = turtle.down()
  if didmove then
  local newxcoord = pervarread("coordy") - 1
  pervarchange("coordy", newxcoord)
else
  return "blocked"
end
end

The pathfinding program!

Spoiler
tArgs = {...}
ngtx = tArgs[1]
ngty = tArgs[2]
ngtz = tArgs[3]

shell.run("pervarapi")
shell.run("movecoordapi")
facenumbertostring = {"south","west","north","east"}

function createvars()
pervarcreate("coordx") -- +:east -: west
pervarcreate("coordy") -- +:up -: down
pervarcreate("coordz") -- +:south -:north
pervarcreate("currentface")
pervarcreate("gotox")
pervarcreate("gotoy")
pervarcreate("gotoz")

pervarchange("coordx", 0)
pervarchange("coordy", 0)
pervarchange("coordz", 0)
pervarchange("currentface", 0) -- 0=south,1=west,2=north,3=east
end

function showcoords()
print("The current coordinates are: ("..pervarread("coordx")..","..pervarread("coordy")..","..pervarread("coordz")..") and it faces to the "..facenumbertostring[pervarread("currentface")+1]..".")
end



function avoidsmallobstaclehorizontal()
stntbl = ("print("rawr")")
movedirnum = tonumber(pervarread("currentface"))
c = moveup()
if c == "blocked"
then
  c = movedown()
  if c == "blocked"
  then
   if movedirnum == 3 then c = movesouth()
   elseif movedirnum == 2 then c = moveeast()
   elseif movedirnum == 1 then c = movenorth()
   elseif movedirnum == 0 then c = movewest()
   end
   if c == "blocked"
   then
	if movedirnum == 0 then c = moveeast()
	elseif movedirnum == 1 then c = movesouth()
	elseif movedirnum == 2 then c = movewest()
	elseif movedirnum == 3 then c = movenorth()
	end
   end
  end
end
end

function avoidsmallobstacleup()
passedobstacle = false
c = movenorth()
if c ~= "blocked"
then
  d = moveup()
  if d ~= "blocked"
  then
   passedobstacle = true
  else
   movesouth()
  end
end

if passedobstacle ~= true
then
  c = movesouth()
  if c ~= "blocked"
  then
   d = moveup()
   if d ~= "blocked"
   then
	passedobstacle = true
   else
	movenorth()
   end
  end
end

if passedobstacle ~= true
then
  c = moveeast()
  if c ~= "blocked"
  then
   d = moveup()
   if d ~= "blocked"
   then
	passedobstacle = true
   else
	movewest()
   end
  end
end

if passedobstacle ~= true
then
  c = movewest()
  if c ~= "blocked"
  then
   d = moveup()
   if d ~= "blocked"
   then
	passedobstacle = true
   else
	moveeast()
   end
  end
end
end

function avoidsmallobstacledown()
passedobstacle = false

c = movenorth()
if c ~= "blocked"
then
  d = movedown()
  if d ~= "blocked"
  then
   passedobstacle = true
  else
   movesouth()
  end
end

if passedobstacle ~= true
then
  c = moveeast()
  if c ~= "blocked"
  then
   d = movedown()
   if d ~= "blocked"
   then
	passedobstacle = true
   else
	movewest()
   end
  end
end

if passedobstacle ~= true
then
  c = movewest()
  if c ~= "blocked"
  then
   d = movedown()
   if d ~= "blocked"
   then
	passedobstacle = true
   else
	moveeast()
   end
  end
end

if passedobstacle ~= true
then
  c = movesouth()
  if c ~= "blocked"
  then
   d = movedown()
   if d ~= "blocked"
   then
	passedobstacle = true
   else
	movenorth()
   end
  end
end

end

function settargetcoords(gtx,gty,gtz)
pervarchange("gotox", gtx)
pervarchange("gotoy", gty)
pervarchange("gotoz", gtz)
end

function moveclosertotargetx()
currentx = tonumber(pervarread("coordx"))
targetx = tonumber(pervarread("gotox"))
if currentx == targetx
then
  return "reached x"
elseif currentx > targetx
then
  b = movewest()
elseif currentx < targetx
then
  b = moveeast()
end
end


function moveclosertotargetz()
currentz = tonumber(pervarread("coordz"))
targetz = tonumber(pervarread("gotoz"))
if currentz == targetz
then
  return "reached z"
elseif currentz > targetz
then
  b = movenorth()
elseif currentz < targetz
then
  b = movesouth()
end
end


function moveclosertotargety()
currenty = tonumber(pervarread("coordy"))
targety = tonumber(pervarread("gotoy"))
if currenty == targety
then
  return "reached y"
elseif currenty > targety
then
  b = movedown()
  if b ~= nil then b = (b.."down") end
elseif currenty < targety
then
  b = moveup()
  if b ~= nil then b = (b.."up") end
end
end


function movetotarget()
repeat
repeat
  a = moveclosertotargetx()
  if b == "blocked" then avoidsmallobstaclehorizontal() end
until a == "reached x"
repeat
  a = moveclosertotargetz()
  if b == "blocked" then avoidsmallobstaclehorizontal() end
until a == "reached z"
repeat
  a = moveclosertotargety()
  if b == "blockedup" then avoidsmallobstacleup() end
  if b == "blockeddown" then avoidsmallobstacledown() end
until a == "reached y"
until pervarread("coordx") == pervarread("gotox") and pervarread("coordz") == pervarread("gotoz") and pervarread("coordy") == pervarread("gotoy")
end

settargetcoords(ngtx,ngty,ngtz)
movetotarget()


And the followwaypoints program

Spoiler
function readwaypointlist()
waypointlist = {}
file = io.open("waypoints.txt", "r")
n = 0
while true do
  n = n + 1
  nextwaypointline = file:read()
  if nextwaypointline == nil then break end
  waypointlist[n] = nextwaypointline
end
end

function formatwaypoint(waypointstring)
wpsx = nil
wpsy = nil
wpsz = nil
wpsh2 = waypointstring
for i=1, 3 do
  wpsh = wpsh2
  n = 0
  while true do
   n = n + 1
   fwpsc = string.sub(wpsh,1,1)
   wpsh = string.sub(wpsh,2)
   if fwpsc == "" then break end
   if fwpsc == "," then break end
  end
  if i == 1 then wpsx = tonumber(string.sub(wpsh2,1,n-1)) wpsh2 = string.sub(wpsh2,n+1)
  elseif i == 2 then wpsy = tonumber(string.sub(wpsh2,1,n-1)) wpsh2 = string.sub(wpsh2,n+1)
  elseif i == 3 then wpsz = tonumber(string.sub(wpsh2,1,n-1))
  end
end
return wpsx, wpsy, wpsz
end

function formatwaypointlist()
waypointx = {}
waypointy = {}
waypointz = {}
for j=1, #waypointlist do
  waypointx[j], waypointy[j], waypointz[j] = formatwaypoint(waypointlist[j])
end
end

function followwaypointlist()
for n=1, #waypointlist do
--  print(waypointx[n].." "..waypointy[n].." "..waypointz[n])
  shell.run("pathfinding", waypointx[n], waypointy[n], waypointz[n])
end
end

readwaypointlist()
formatwaypointlist()
followwaypointlist()


If you don't want to edit anything in the programs, name them "pervarapi", "movecoordapi", "pathfinding" and "followwaypoints".


Now you'll need to make the tiny files and a folder.

First create a folder named pervar and go in there.
In that folder you'll need to make 7 files.
"coordx.txt" put the turtle's x coordinate (f3) in there.
"coordy.txt" put the turtle's y coordinate (f3) in there.
"coordz.txt" put the turtle's z coordinate (f3) in there.
"currentface.txt" put the orientation in there, look in the same direction as the turtle and check F3, under the coords it says "f: " and a number. You need to put that number in there (should be either 0,1,2 or 3). It's south, west, north or east, but in number form.
"gotox.txt" just leave it empty.
"gotoy.txt" just leave it empty.
"gotoz.txt" just leave it empty.

Now, outside the pervar folder, in the root (where you placed all the other stuff) you make one last file called "waypoints.txt".
That is the one you'll need to edit to put in the coords where the turtle goes to when you run followwaypoints. To use it you must enter each waypoint coordinate on a different line with this format: x,y,z no brackets or anything.
Like this:
-194,105,-24
-210,100,-43
If that is in the waypoints.txt then when you run followwaypoints it will first go to x:-194, y:105, z:-24 and then x:-210, y:100, z:-43. This is so you can easily use sky travel (tell the turtles to go via a high Y to avoid terrain obstacles which the turtles can get stuck in.


In your turtle folder it should look something like this:

Movement System (update)
SpoilerI added an ui thingy to the movement system that makes it easier to use manually. It will first ask if you want to use the currently saved coordinates, enter them manually or use GPS locating to get them (of course the turtle needs to have a modem and access to some gps hosts). After that you enter the waypoints/destination and type done to send it on its way.

I put all the necessary code in an installer program and uploaded it to pastebin: http://pastebin.com/1vyVpVKq
The main file ("movesys", in the root folder) is what you need to run after installing.
You don't have to worry about anything in the "movementsystem" folder.

I also made some changes to the persistent variables api and movecoord api (different named functions) and put them in the main file.

Guide to an automatic turtle activator and installer
(useful for factories that produce turtles)
SpoilerGuide to automatic turtle activator and installer:
(the last step of the turtle factory)

First, build a setup like this:
The redpower wire and logic stuff is only necessary if you want to automate it. Else you can just make a simple button system. Most important is that you get the deployer, computer and disk drive right.
Spoiler
The computer should have a file named "startup" (this is so that the computer will automatically work, even after you restarted the game) which contains this:
while true do
event, par1 = os.pullEvent()
if event == "peripheral" and par1 == "back"
then
  peripheral.call("back", "turnOn")
end
end

Note that you may have to change "back" in line 2 and 5 if your computer's orientation is different than mine.

Second you need a floppy in the disk drive which contains a "startup" file.
The contents of the startup depends on what you do with, for the Turtle Factory I made an installer that gives all the movement and automine files, the starting coordinates (the spot above the deployer) and some other important stuff.
At the end of the file you will probably want to put some code that makes it move away, so that it won't block the next turtle's creation.

To make a simple installer you can use things like
file = io.open("program you want to install name here", "w")
file:write([[

]])
file:close()

If you need folders you just put the mkdir function (fs.makeDir(path)) somewhere in there.
FuzzyPurp #4
Posted 03 February 2012 - 07:32 PM
Lol - CookieMonsta :(/>/>
Cookiebal #5
Posted 10 February 2012 - 08:34 PM
Been a bit inactive, but now I got something useful for factories and other things which need to remember stuff for a long time (like a counting machine that needs to keep track of something even if you quit or the server dies),

Persistent Variables!
A standalone api that saves your variables and allows you to change/read them later on. It is designed to work together with CookieSystem, which is why the default path is "/CookieSystem/CS System/pervar/", but that can be changed at the top of the program.

Currently there are four functions:

pervarcreate(variablename) – creates a new (empty) variable. but only if it doesn't exist already.
pervardelete(variablename) – deletes an existing variable.
pervarchange(variablename, newvalue) – changes the variable to newvalue
pervarread(variablename) – reads the variable


so pervarcreate("rawr") would create it.
Then you can use pervarchange("rawr", 30) to set it to 30.
print(pervarread("rawr")) will give 30.
pervardelete("rawr") will then delete the variable.


The code:
Spoiler
pervarpath = "/CookieSystem/CS System/pervar/"
if fs.exists(pervarpath) == false
then fs.makeDir(pervarpath) end

function pervarcreate(pervarname)
 pervarfile = io.open(pervarpath..pervarname..".txt", "r")
 if pervarfile
 then
  pervarfile:close()
  return "Variable already exists"  
 else
  pervarfile = io.open(pervarpath..pervarname..".txt","w")
 end
end

function pervardelete(pervarname)
 pervarfile = io.open(pervarpath..pervarname..".txt", "r")
 if pervarfile
 then
  pervarfile:close()
  fs.delete(pervarpath..pervarname..".txt")
 else
  return "Variable doesn't exist"  
 end
end

function pervarchange(pervarname, newvalue)
 pervarfile = io.open(pervarpath..pervarname..".txt", "r")
 if pervarfile
 then
  pervarfile:close()
  pervarfile = io.open(pervarpath..pervarname..".txt","w")
  pervarfile:write(newvalue)
  pervarfile:close()
 else
  return "Variable doesn't exist"
 end
end

function pervarread(pervarname)
 pervarfile = io.open(pervarpath..pervarname..".txt", "r")
 if pervarfile
 then
  pervarcontent = pervarfile:read()
  pervarfile:close()
  return pervarcontent
 else
  return "Variable doesn't exist"
 end
end

To use it in your programs you can either paste this code on top of your program or put this code in a separate program and add the line "shell.run("path+name")" to the top of your code.
arongy #6
Posted 10 February 2012 - 09:32 PM
I like your Persistent Variables! :D/>/>
Cookiebal #7
Posted 23 February 2012 - 03:29 PM
The Turtle Factory
[media]http://www.youtube.com/watch?v=rqKBC-bNiVA[/media]

You throw the items in the bucket (or have a turtle do it!) and push the button at the end of the production line and get a ready to use pre-programmed turtle! It automatically sorts all materials you throw in it, with a build in incinerator to dispose of what you don't need, then it processes the raw materials until it eventually becomes a wireless mining turtle!

Some (slightly outdated) images to explain what each part does:
Spoiler


Pathfinding and Waypoints (using coordinates)
outdated video: (it's easier to use now, but the core still works the same)
[media]http://www.youtube.com/watch?v=kF_EMyUAfJo&feature=player_embedded[/media]
A navigation program based on coordinates, using my persistent variables api I made it possible for the turtle to remember where he is, so you just give it his coords when you set him up and you're good to go. It automatically follows coords in a waypoints text file (using the format x,y,z so without any brackets). It also has some basic block avoidance (see video), though it will still get stuck sometimes, especially against larger or complex things, but it's designed for air travel where there aren't many obstacles usually.
Espen #8
Posted 23 February 2012 - 03:49 PM
Nice, I like your turtle factory.
Fully automatic minion creation and deployment… ready for battle. ^_^/>/>
Cookiebal #9
Posted 23 February 2012 - 06:21 PM
Just finished this http://www.youtube.com/watch?v=6ZLNhkUG9dw
DarkNinja2462 #10
Posted 23 February 2012 - 10:36 PM
Can you give us the waypoint/pathfinding program?
Cookiebal #11
Posted 24 February 2012 - 12:57 AM
Can you give us the waypoint/pathfinding program?

I'll make it public tomorrow. Not enough time now. Already 2 am for me and I first need to upload this video about project world eater!
Cookiebal #12
Posted 24 February 2012 - 01:56 AM
http://www.youtube.com/watch?v=ZAwttgCLUuI
Espen #13
Posted 24 February 2012 - 02:27 AM
Seeing them devouring the earth somehow reminds me of the Langoliers.^^
Cruor #14
Posted 24 February 2012 - 01:58 PM
what do i need and how do i use your pathfinding? i was planning to make it myself, but acces to realworld coords is going to be helpful :huh:/>/>
Cookiebal #15
Posted 24 February 2012 - 03:18 PM
Movement system released!
You will need three files for this. The pervarapi, the movementapi, the pathfinding program and the waypoint program! You'll also need to configure the starting coords and orientation.

First, the edited pervarapi. (path is a bit different)

Spoiler
pervarpath = "/pervar/"
if fs.exists(pervarpath) == false
then fs.makeDir(pervarpath) end

function pervarcreate(pervarname)
 pervarfile = io.open(pervarpath..pervarname..".txt", "r")
 if pervarfile
 then
  pervarfile:close()
  return "Variable already exists"  
 else
  pervarfile = io.open(pervarpath..pervarname..".txt","w")
 end
end

function pervardelete(pervarname)
 pervarfile = io.open(pervarpath..pervarname..".txt", "r")
 if pervarfile
 then
  pervarfile:close()
  fs.delete(pervarpath..pervarname..".txt")
 else
  return "Variable doesn't exist"  
 end
end

function pervarchange(pervarname, newvalue)
 pervarfile = io.open(pervarpath..pervarname..".txt", "r")
 if pervarfile
 then
  pervarfile:close()
  pervarfile = io.open(pervarpath..pervarname..".txt","w")
  pervarfile:write(newvalue)
  pervarfile:close()
 else
  return "Variable doesn't exist"
 end
end

function pervarread(pervarname)
 pervarfile = io.open(pervarpath..pervarname..".txt", "r")
 if pervarfile
 then
  pervarcontent = pervarfile:read()
  pervarfile:close()
  return pervarcontent
 else
  return "Variable doesn't exist"
 end
end


Next, the movementapi, which you should name "movecoordapi" (either that or change the shell.run stuff in the other programs)

Spoiler


shell.run("pervarapi")

function facenorth()
 local currentface = tonumber(pervarread("currentface"))
 if currentface == 0 then turtle.turnRight() turtle.turnRight() end
 if currentface == 1 then turtle.turnRight() end
 if currentface == 3 then turtle.turnLeft() end
 pervarchange("currentface", 2)
end

function faceeast()
 local currentface = tonumber(pervarread("currentface"))
 if currentface == 1 then turtle.turnRight() turtle.turnRight() end
 if currentface == 2 then turtle.turnRight() end
 if currentface == 0 then turtle.turnLeft() end
 pervarchange("currentface", 3)
end

function facesouth()
 local currentface = tonumber(pervarread("currentface"))
 if currentface == 2 then turtle.turnRight() turtle.turnRight() end
 if currentface == 3 then turtle.turnRight() end
 if currentface == 1 then turtle.turnLeft() end
 pervarchange("currentface", 0)
end

function facewest()
 local currentface = tonumber(pervarread("currentface"))
 if currentface == 3 then turtle.turnRight() turtle.turnRight() end
 if currentface == 0 then turtle.turnRight() end
 if currentface == 2 then turtle.turnLeft() end
 pervarchange("currentface", 1)
end


function movenorth()
 facenorth()
 didmove = turtle.forward()
  if didmove then
  local newzcoord = pervarread("coordz") - 1
  pervarchange("coordz", newzcoord)
 else
  return "blocked"
 end
end


function movesouth()
 facesouth()
 didmove = turtle.forward()
  if didmove then
  local newzcoord = pervarread("coordz") + 1
  pervarchange("coordz", newzcoord)
 else
  return "blocked"
 end
end

function movewest()
 facewest()
 didmove = turtle.forward()
  if didmove then
  local newxcoord = pervarread("coordx") - 1
  pervarchange("coordx", newxcoord)
 else
  return "blocked"
 end
end

function moveeast()
 faceeast()
 didmove = turtle.forward()
  if didmove then
  local newxcoord = pervarread("coordx") + 1
  pervarchange("coordx", newxcoord)
 else
  return "blocked"
 end
end

function moveup()
 didmove = turtle.up()
  if didmove then
  local newxcoord = pervarread("coordy") + 1
  pervarchange("coordy", newxcoord)
 else
  return "blocked"
 end
end

function movedown()
 didmove = turtle.down()
  if didmove then
  local newxcoord = pervarread("coordy") - 1
  pervarchange("coordy", newxcoord)
 else
  return "blocked"
 end
end

The pathfinding program!

Spoiler
tArgs = {...}
ngtx = tArgs[1]
ngty = tArgs[2]
ngtz = tArgs[3]

shell.run("pervarapi")
shell.run("movecoordapi")
facenumbertostring = {"south","west","north","east"}

function createvars()
pervarcreate("coordx") -- +:east -: west
pervarcreate("coordy") -- +:up -: down
pervarcreate("coordz") -- +:south -:north
pervarcreate("currentface")
pervarcreate("gotox")
pervarcreate("gotoy")
pervarcreate("gotoz")

pervarchange("coordx", 0)
pervarchange("coordy", 0)
pervarchange("coordz", 0)
pervarchange("currentface", 0) -- 0=south,1=west,2=north,3=east
end

function showcoords()
 print("The current coordinates are: ("..pervarread("coordx")..","..pervarread("coordy")..","..pervarread("coordz")..") and it faces to the "..facenumbertostring[pervarread("currentface")+1]..".")
end



function avoidsmallobstaclehorizontal()
stntbl = ("print("rawr")")
 movedirnum = tonumber(pervarread("currentface"))
 c = moveup()
 if c == "blocked"
 then
  c = movedown()
  if c == "blocked"
  then
   if movedirnum == 3 then c = movesouth()
   elseif movedirnum == 2 then c = moveeast()
   elseif movedirnum == 1 then c = movenorth()
   elseif movedirnum == 0 then c = movewest()
   end
   if c == "blocked"
   then
    if movedirnum == 0 then c = moveeast()
    elseif movedirnum == 1 then c = movesouth()
    elseif movedirnum == 2 then c = movewest()
    elseif movedirnum == 3 then c = movenorth()
    end
   end
  end
 end
end

function avoidsmallobstacleup()
 passedobstacle = false
 c = movenorth()
 if c ~= "blocked"
 then
  d = moveup()
  if d ~= "blocked"
  then
   passedobstacle = true
  else
   movesouth()
  end
 end

 if passedobstacle ~= true
 then
  c = movesouth()
  if c ~= "blocked"
  then
   d = moveup()
   if d ~= "blocked"
   then
    passedobstacle = true
   else
    movenorth()
   end
  end
 end

 if passedobstacle ~= true
 then
  c = moveeast()
  if c ~= "blocked"
  then
   d = moveup()
   if d ~= "blocked"
   then
    passedobstacle = true
   else
    movewest()
   end
  end
 end

 if passedobstacle ~= true
 then
  c = movewest()
  if c ~= "blocked"
  then
   d = moveup()
   if d ~= "blocked"
   then
    passedobstacle = true
   else
    moveeast()
   end
  end
 end
end

function avoidsmallobstacledown()
 passedobstacle = false

 c = movenorth()
 if c ~= "blocked"
 then
  d = movedown()
  if d ~= "blocked"
  then
   passedobstacle = true
  else
   movesouth()
  end
 end

 if passedobstacle ~= true
 then
  c = moveeast()
  if c ~= "blocked"
  then
   d = movedown()
   if d ~= "blocked"
   then
    passedobstacle = true
   else
    movewest()
   end
  end
 end

 if passedobstacle ~= true
 then
  c = movewest()
  if c ~= "blocked"
  then
   d = movedown()
   if d ~= "blocked"
   then
    passedobstacle = true
   else
    moveeast()
   end
  end
 end

 if passedobstacle ~= true
 then
  c = movesouth()
  if c ~= "blocked"
  then
   d = movedown()
   if d ~= "blocked"
   then
    passedobstacle = true
   else
    movenorth()
   end
  end
 end

end

function settargetcoords(gtx,gty,gtz)
 pervarchange("gotox", gtx)
 pervarchange("gotoy", gty)
 pervarchange("gotoz", gtz)
end

function moveclosertotargetx()
 currentx = tonumber(pervarread("coordx"))
 targetx = tonumber(pervarread("gotox"))
 if currentx == targetx
 then
  return "reached x"
 elseif currentx > targetx
 then
  b = movewest()
 elseif currentx < targetx
 then
  b = moveeast()
 end
end


function moveclosertotargetz()
 currentz = tonumber(pervarread("coordz"))
 targetz = tonumber(pervarread("gotoz"))
 if currentz == targetz
 then
  return "reached z"
 elseif currentz > targetz
 then
  b = movenorth()
 elseif currentz < targetz
 then
  b = movesouth()
 end
end


function moveclosertotargety()
 currenty = tonumber(pervarread("coordy"))
 targety = tonumber(pervarread("gotoy"))
 if currenty == targety
 then
  return "reached y"
 elseif currenty > targety
 then
  b = movedown()
  if b ~= nil then b = (b.."down") end
 elseif currenty < targety
 then
  b = moveup()
  if b ~= nil then b = (b.."up") end
 end
end


function movetotarget()
repeat
 repeat
  a = moveclosertotargetx()
  if b == "blocked" then avoidsmallobstaclehorizontal() end
 until a == "reached x"
 repeat
  a = moveclosertotargetz()
  if b == "blocked" then avoidsmallobstaclehorizontal() end
 until a == "reached z"
 repeat
  a = moveclosertotargety()
  if b == "blockedup" then avoidsmallobstacleup() end
  if b == "blockeddown" then avoidsmallobstacledown() end
 until a == "reached y"
until pervarread("coordx") == pervarread("gotox") and pervarread("coordz") == pervarread("gotoz") and pervarread("coordy") == pervarread("gotoy")
end

settargetcoords(ngtx,ngty,ngtz)
movetotarget()


And the followwaypoints program

Spoiler
function readwaypointlist()
 waypointlist = {}
 file = io.open("waypoints.txt", "r")
 n = 0
 while true do
  n = n + 1
  nextwaypointline = file:read()
  if nextwaypointline == nil then break end
  waypointlist[n] = nextwaypointline
 end
end

function formatwaypoint(waypointstring)
 wpsx = nil
 wpsy = nil
 wpsz = nil
 wpsh2 = waypointstring
 for i=1, 3 do
  wpsh = wpsh2
  n = 0
  while true do
   n = n + 1
   fwpsc = string.sub(wpsh,1,1)
   wpsh = string.sub(wpsh,2)
   if fwpsc == "" then break end
   if fwpsc == "," then break end
  end
  if i == 1 then wpsx = tonumber(string.sub(wpsh2,1,n-1)) wpsh2 = string.sub(wpsh2,n+1)
  elseif i == 2 then wpsy = tonumber(string.sub(wpsh2,1,n-1)) wpsh2 = string.sub(wpsh2,n+1)
  elseif i == 3 then wpsz = tonumber(string.sub(wpsh2,1,n-1))
  end
 end
 return wpsx, wpsy, wpsz
end

function formatwaypointlist()
 waypointx = {}
 waypointy = {}
 waypointz = {}
 for j=1, #waypointlist do
  waypointx[j], waypointy[j], waypointz[j] = formatwaypoint(waypointlist[j])
 end
end

function followwaypointlist()
 for n=1, #waypointlist do
--  print(waypointx[n].." "..waypointy[n].." "..waypointz[n])
  shell.run("pathfinding", waypointx[n], waypointy[n], waypointz[n])
 end
end

readwaypointlist()
formatwaypointlist()
followwaypointlist()


If you don't want to edit anything in the programs, name them "pervarapi", "movecoordapi", "pathfinding" and "followwaypoints".


Now you'll need to make the tiny files and a folder.

First create a folder named pervar and go in there.
In that folder you'll need to make 7 files.
"coordx.txt" put the turtle's x coordinate (f3) in there.
"coordy.txt" put the turtle's y coordinate (f3) in there.
"coordz.txt" put the turtle's z coordinate (f3) in there.
"currentface.txt" put the orientation in there, look in the same direction as the turtle and check F3, under the coords it says "f: " and a number. You need to put that number in there (should be either 0,1,2 or 3). It's south, west, north or east, but in number form.
"gotox.txt" just leave it empty.
"gotoy.txt" just leave it empty.
"gotoz.txt" just leave it empty.

Now, outside the pervar folder, in the root (where you placed all the other stuff) you make one last file called "waypoints.txt".
That is the one you'll need to edit to put in the coords where the turtle goes to when you run followwaypoints. To use it you must enter each waypoint coordinate on a different line with this format: x,y,z no brackets or anything.
Like this:
-194,105,-24
-210,100,-43
If that is in the waypoints.txt then when you run followwaypoints it will first go to x:-194, y:105, z:-24 and then x:-210, y:100, z:-43. This is so you can easily use sky travel (tell the turtles to go via a high Y to avoid terrain obstacles which the turtles can get stuck in.


In your turtle folder it should look something like this:
coolblockj #16
Posted 24 February 2012 - 05:36 PM
The error i keep getting with this cookiebai is:
pathfinding:117: attempt to call nil
Cookiebal #17
Posted 24 February 2012 - 07:01 PM
Strange, especially since line 117 is a function where it doesn't even call anything.

I just follow all the instructions on a new turtle, and it worked.
Try installing again and make sure you copypaste everything properly and the file extensions are correct.
cybervico #18
Posted 25 February 2012 - 10:48 AM
I have an error too when I try to run your followwaypoints program. This is the error : "followwaypoints:7: attempt to index ? (a nil value)"
Please if you could help me.
Cookiebal #19
Posted 25 February 2012 - 11:14 AM
Make sure that your waypoints.txt file is called waypoints.txt and that there is a coordinate in it.
cybervico #20
Posted 25 February 2012 - 11:44 AM
I join all the prints screens
I have coordinates in the waypoints.txt

The coordinates:
-209,73,190
-209,75,207


I have the coordinates in coord files:
-coordx : -207
-coordy : 75
-coordz : 205
-currentface : 2

[attachment=40:turtle.png]

[attachment=39:pervar.png]

[attachment=41:waypoints.png]

[attachment=38:coordx.png]
Cookiebal #21
Posted 25 February 2012 - 12:46 PM
Ah, I see. You put it in the rom folder. That won't work, it's all turtle specific either way (since turtles can't share coordinates).

Put it in saves/<worldname>/computer/<ID of the turtle>/

Then everything should work fine :(/>/>
Cookiebal #22
Posted 25 February 2012 - 01:05 PM
Guide to automatic turtle activator and installer:
(the last step of the turtle factory)

First, build a setup like this:
The redpower wire and logic stuff is only necessary if you want to automate it. Else you can just make a simple button system. Most important is that you get the deployer, computer and disk drive right.
Spoiler
The computer should have a file named "startup" (this is so that the computer will automatically work, even after you restarted the game) which contains this:
while true do
event, par1 = os.pullEvent()
if event == "peripheral" and par1 == "back"
then
  peripheral.call("back", "turnOn")
end
end

Note that you may have to change "back" in line 2 and 5 if your computer's orientation is different than mine.

Second you need a floppy in the disk drive which contains a "startup" file.
The contents of the startup depends on what you do with, for the Turtle Factory I made an installer that gives all the movement and automine files, the starting coordinates (the spot above the deployer) and some other important stuff.
At the end of the file you will probably want to put some code that makes it move away, so that it won't block the next turtle's creation.

To make a simple installer you can use things like
file = io.open("program you want to install name here", "w")
file:write([[
<Code here>
]])
file:close()

If you need folders you just put the mkdir function (fs.makeDir(path)) somewhere in there.
cybervico #23
Posted 25 February 2012 - 03:07 PM
It work in saves/<worldname>/computer/<ID of the turtle>/ thank you
Liraal #24
Posted 25 February 2012 - 03:46 PM
Nice thing, but i beat you to the Auto-building API :(/>/>
Cookiebal #25
Posted 25 February 2012 - 06:33 PM
Nice thing, but i beat you to the Auto-building API :(/>/>

Beat me to making it public, I had it ready a few days ago. I had the beta advantage though :)/>/>
toniko #26
Posted 27 February 2012 - 05:44 PM
I need a help!
if I need to use a function after using and then use the followwaypoints followwaypoints to return, as I could?
For example, I use the APi to send an item in a certain place, after using the DropAll (), use the API to return to the place of origin.


sorry for my bad english
Cookiebal #27
Posted 27 February 2012 - 07:29 PM
You could make a file and put something like this in it


file = io.open("waypoints.txt", "w")
file:write(first set of coords)
file:close()
shell.run("followwaypoints")

shell.run("dropall")

file = io.open("waypoints.txt", "w")
file:write(second set of coords)
file:close()
shell.run("followwaypoints")
toniko #28
Posted 28 February 2012 - 02:56 PM
You could make a file and put something like this in it


file = io.open("waypoints.txt", "w")
file:write(first set of coords)
file:close()
shell.run("followwaypoints")

shell.run("dropall")

file = io.open("waypoints.txt", "w")
file:write(second set of coords)
file:close()
shell.run("followwaypoints")

thanks, works perfectly :D/>/> , I made a function like this:


function go_waypoints(txt,coord)
file = io.open(txt, "w")
file:write(coord)
file:close()
shell.run("followwaypoints")
Cookiebal #29
Posted 28 February 2012 - 03:31 PM
If you only use a single coordinate, you could try to just do shell.run("pathfinding", xcoord, ycoord, zcoord). However I always set waypoints so that the turtle first goes to the air and then towards the destination, this way the turtle won't get stuck somewhere.
modernzink #30
Posted 28 February 2012 - 04:41 PM
i try to make it like your video project world eater, but i fail ;)/>/> ( just training :D/>/> )
so i think for diging i could use the default programm excavate with a 1x1 field
but i fail at the point, that the turtle go to the "chest" , drop all , fly back but this time 1 block forward.
I tried to make it with while
All in all, i must learn much to get better, so maybe someone could help me with this :)/>/>
Cookiebal #31
Posted 28 February 2012 - 05:10 PM
I programmed in the coordinates of the bucket and the starting coords for the first mineshaft, I also made it count the amount of shafts it dug already.

So when it is done with mining it will move to the bucketcoords and run the drop program.
To make it go to the new mineshaft coordinates I make it add the counter to the x or z coord. So if it started mining at -30,90,75 and has already mined 3 shafts the next coord it will go to is -30,90,78.
modernzink #32
Posted 28 February 2012 - 05:33 PM
I copied your code, but when i start followwaypoints and there is a block ( in cause i want to go down) , its stuck there.
run pathfinding gives me this error : pathfinding:191: attempt to compare __lt on nil and number

so i didn't see anything like turtle.dig()
By me it doen`t mine anything, so maybe i missunderstood you.
Think you mean another program that isn't published now ^^
Cookiebal #33
Posted 28 February 2012 - 06:03 PM
The waypoints and pathfinding stuff doesn't do any blockbreaking, I have a separate function in the automine program which does that part of the job.
modernzink #34
Posted 28 February 2012 - 06:38 PM
But this automine program isn't released yet, thats was i actually wanted to say ;)/>/>
so i tried to make this by my own, but im to bad to make it :D/>/> ( all beginning is difficult )
Liraal #35
Posted 28 February 2012 - 06:40 PM
ad removed
Cookiebal #36
Posted 28 February 2012 - 07:14 PM
Here's the current automine program.

You'll need to take a look trough it and get all the correct variables as pervar .txt files though. The ones on top of my head are bucketcoord, startminingcoordx, startminingcoordz and maxoffset. The first three are obvious, the fourth one is the amount of shafts it digs before ending.

Spoiler
shell.run("movecoordapi")
shell.run("pervarapi")

bucketcoords = pervarread("bucketcoord")
startminingcoordx = pervarread("startminingcoordx")
startminingcoordy = "100"
startminingcoordz = pervarread("startminingcoordz")
startminingoffset = 0
maxminingoffset = tonumber(pervarread("maxoffset"))

function getskycoords()
skyx = pervarread("coordx")
skyy = "105"
skyz = pervarread("Coordz")
skycoords = (skyx..","..skyy..","..skyz)
end

function traveltobucket()
getskycoords()
file = io.open("waypoints.txt", "w")
file:write(skycoords.."n")
file:write(bucketcoords)
file:close()
shell.run("followwaypoints")
end

function getnewminingcoords()
newminingcoordz = tostring(startminingcoordz - startminingoffset)
newminingcoords = (startminingcoordx..","..startminingcoordy..","..newminingcoordz)
startminingoffset = startminingoffset + 2
end

function traveltonewshaft()
getnewminingcoords()
getskycoords()
file = io.open("waypoints.txt", "w")
file:write(skycoords.."n")
file:write(newminingcoords)
file:close()
shell.run("followwaypoints")
end


function dropoff()
shell.run("dropall")
end

function mineshaft()
meterstomovedown = startminingcoordy-7
metersmoveddown = 0
metersmovedup = 0

repeat
  isblocked = movedown()
  if isblocked == "blocked"
  then
   turtle.digDown()
  else metersmoveddown = metersmoveddown + 1
  end
until metersmoveddown == meterstomovedown

while true do
  isblocked = movenorth()
  if isblocked == "blocked"
  then
   turtle.dig()
  else break
  end
end

repeat
  isblocked = moveup()
  if isblocked == "blocked"
  then
   turtle.digUp()
  else metersmovedup = metersmovedup + 1
  end
until metersmovedup == meterstomovedown
end

function checkforsignal()
os.startTimer(0.6)
event, par1, par2 = os.pullEvent()
if event == "rednet_message"
then
  if par2 == "recall"
  then
   shell.run("gotosleep")
   print("errortostopprogram"..nil)
  end
end
end

while true do
traveltobucket()
dropoff()
traveltonewshaft()
mineshaft()
checkforsignal()
if startminingoffset >= maxminingoffset then break end
end
traveltobucket()
dropoff()
Liraal #37
Posted 28 February 2012 - 07:18 PM
okay, BTW, your stuff's more advanced :D/>/>

But i'll keep trying to keep up ;)/>/>
Cookiebal #38
Posted 28 February 2012 - 07:25 PM
But i'll keep trying to keep up ;)/>/>

You're doing a good job at that :D/>/>

Also sorry if my comment was a bit snappy, tired + French homework I don't understand a single thing about = annoyed Cookiebal
Liraal #39
Posted 28 February 2012 - 07:28 PM
sorry for posting that too, but it gets annoying when ppl all round the forum are asking for things that are already done (however in slightly less efficient fashion :D/>/> )

However, now i think im entering a totally different path of development. No moar conficts ;)/>/>
Cookiebal #40
Posted 28 February 2012 - 07:32 PM
I'm currently doing a basic long range network and will work on something specifically for project world eater afterwards (to automate sending sleeping turtles to quarries). :D/>/>
LIMachi #41
Posted 28 February 2012 - 11:05 PM
To make a simple installer you can use things like
file = io.open("program you want to install name here", "w")
file:write([[
>
]])
file:close()
i'm not sure where i ave to put this code, and if i ave to change the ">".
Cookiebal #42
Posted 28 February 2012 - 11:16 PM
Put the code in place of the >

for example


file = io.open("program you want to install name here", "w")
file:write([[
while true do
event, par1 = os.pullEvent()
if event == "peripheral" and par1 == "back"
then
  peripheral.call("back", "turnOn")
end
end
]])
file:close()
LIMachi #43
Posted 28 February 2012 - 11:20 PM
yes but… i've no understand. ave i to spécifiate an id for the turtle?
can you give me an example, a part of your code? i'm better with examples…
LIMachi #44
Posted 28 February 2012 - 11:22 PM
if i ave understand, that function copy

while true do
event, par1 = os.pullEvent()
if event == "peripheral" and par1 == "back"
then
peripheral.call("back", "turnOn")
end
end
in the specified program
Cookiebal #45
Posted 29 February 2012 - 12:34 PM
Indeed. :o/>/>

So you just have to make one of those blocks for each program you want to install.

It can then be used immediately with the standard shell.run function too.
Cookiebal #46
Posted 29 February 2012 - 04:06 PM
[media]http://www.youtube.com/watch?v=tVf3hn7yxXo&;[/media]

Internet in Minecraft, getting close.

Copy paste of the description:
The base for an internet! It doesn't have real websites and browsers yet though, but this can be used to make them. Any computer/turtle in range of this and with the api can receive/send to any other computer connected to the network. The rednet messages are automatically repeated, but only once, so you won't get the same message spammed all the time (which would happen with simple repeaters).

The reason it's named skynet is because the network is supposed to be a network of turtles that run the repeater program somewhere at the max map height. So that you don't need to make towers or anything else. And it would allow you to easily set up a repeater turtle somewhere near your base to connect the rest of your computers to the big network.
Espen #47
Posted 29 February 2012 - 04:16 PM
Bravo, nice to see such an idea actually implemented.
I'm looking forward to see how you handle routing. I assume at the moment you're using static routing?
Cookiebal #48
Posted 29 February 2012 - 04:24 PM
If static routing means that every computer on the network knows the 'path' to the other computers, then not.

I could make a computer, put it down somewhere in range of the network, install the api and send messages to any other computer connected to the net immediately.
Espen #49
Posted 29 February 2012 - 04:35 PM
If static routing means that every computer on the network knows the 'path' to the other computers, then not. I could make a computer, put it down somewhere in range of the network, install the api and send messages to any other computer connected to the net immediately.
Do you mean that every turtle in the network keeps a list of all turtles in the network and/or a list with the route to every computer?
Liraal #50
Posted 29 February 2012 - 04:36 PM
He probably means that every turtle can access another using its ID by the use of API and network.
Espen #51
Posted 29 February 2012 - 04:40 PM
He probably means that every turtle can access another using its ID by the use of API and network.
That's not what I mean though.
If any turtle in the network receives a message that is meant for a specific computer, then the turtle has to know which turtle is the next in the route to that specific computer.
And I was curious what method he used to determine the path.
Cookiebal #52
Posted 29 February 2012 - 04:42 PM
He probably means that every turtle can access another using its ID by the use of API and network.

This.

If I use skynetsendmessage("rawr", 5) it will send a message around the network and the computer with id 5 will receive it. If there is no computer with id 5 connected then of course nothing will receive it, but the message will get send across the network.

There is no path, everyone will receive everything and check some tags added at the start of the message.
Espen #53
Posted 29 February 2012 - 04:47 PM
Oh, so you're essentially broadcasting messages then.
Sorry I misunderstood it to be sending messages to specific computers.

Last question then: Do the turtles make use of the rednet.broadcast function or the rednet.send function to send the message to all the other turtles around it?
Edited on 29 February 2012 - 03:47 PM
Cookiebal #54
Posted 29 February 2012 - 04:52 PM
Yep, it's a giant broadcast basically.

Everything uses broadcast.
Espen #55
Posted 29 February 2012 - 04:53 PM
Hmm, ok that means any computer or turtle that connects to this network without using your protocol can read all messages.
Kind of like sniffing with the network adapter in promiscuous mode.^^
Ah well, I was just asking these routing questions because I'm a bit of a security nut, I hope you don't mind. :unsure:/>/>/>
Cookiebal #56
Posted 29 February 2012 - 04:58 PM
Yeah, security obviously wasn't really my priority :unsure:/>/>/>. But there are many encoders around the forum, so fun for them I guess!
BouncyWolf102 #57
Posted 04 March 2012 - 11:19 AM
im getting an error pathfinding:191: attempt to compare __lt on nill and number please help btw i love this project!!! ty for putting out your hard work for the public to use XD
Xtansia #58
Posted 04 March 2012 - 11:39 AM
Yeah, security obviously wasn't really my priority :unsure:/>/>. But there are many encoders around the forum, so fun for them I guess!

I think all of them are mine? XD
Cookiebal #59
Posted 04 March 2012 - 11:45 AM
im getting an error pathfinding:191: attempt to compare __lt on nill and number please help btw i love this project!!! ty for putting out your hard work for the public to use XD

Check your perver/coordx and pervar/gotox txt files. One of them is probably empty.

Yeah, security obviously wasn't really my priority :unsure:/>/>. But there are many encoders around the forum, so fun for them I guess!

I think all of them are mine? XD

I had yours in mind when making that post yeah B)/>/>
BouncyWolf102 #60
Posted 05 March 2012 - 08:16 AM
my files are all right and followed instructions but its still got the error
Cookiebal #61
Posted 05 March 2012 - 03:13 PM
What's in your waypoints.txt?
Leo Verto #62
Posted 06 March 2012 - 12:14 PM
I would like to learn more about your Skynet networking! How about hiding the computers for the network somewhere, so it looks more natural and having passwords for them, so no one could just hack into the network?
Espen #63
Posted 06 March 2012 - 12:40 PM
I would like to learn more about your Skynet networking! How about hiding the computers for the network somewhere, so it looks more natural and having passwords for them, so no one could just hack into the network?
Well you could put them below the the ground, but then it wouldn't be a 'Skynet' anymore, more like a 'Groundnet'? Soilnet?^^
Or you put some blocks around them in the sky, so that it looks like ballons, planes, etc. :unsure:/>/>
Leo Verto #64
Posted 06 March 2012 - 01:37 PM
Well you could put them below the the ground, but then it wouldn't be a 'Skynet' anymore, more like a 'Groundnet'? Soilnet?^^
Or you put some blocks around them in the sky, so that it looks like ballons, planes, etc. :unsure:/>/>
Yeah that's true, It's not really nice to have floating turtles everywhere, but since 1.2 they can be hidden very high.

Balloons and planes *dreams of it* the turtles could even build their own ones. B)/>/>
Espen #65
Posted 06 March 2012 - 02:14 PM
Well you could put them below the the ground, but then it wouldn't be a 'Skynet' anymore, more like a 'Groundnet'? Soilnet?^^ Or you put some blocks around them in the sky, so that it looks like ballons, planes, etc. B)/>/>
Yeah that's true, It's not really nice to have floating turtles everywhere, but since 1.2 they can be hidden very high. Ballonos and planes *dreams of it* the turtles could even build their own one. B)/>/>
Yes, this! Nice idea. I can imagine a turtle launching into the air, building part of a plane, then sinking down into the 'cockpit' and placing the last block, completely disguising itself. Turtles are just the best addition (yet). :unsure:/>/>
Leo Verto #66
Posted 06 March 2012 - 02:21 PM
Project World Eater could become project Turtle Empire with turtles mining, building (also building more turtle factories).
Now we just need an AI to code new turtle programs and plan new buildings. :unsure:/>/>
Cookiebal #67
Posted 06 March 2012 - 09:28 PM
Releasing the Skynet api now, and an IRC thing as an example. I actually wanted an email system but it's about time I release the skynet api but I don't got enough time to make a proper email server, so that will come later.

Skynetapi
Allows you to send long range messages via a network of special wireless repeaters. Note: You have to open the rednet ports separately
Functions are
skynetrepeater() – Use this to make a turtle/computer act as a repeater.
skynetsendmessage(message, targetid) – sends the string message to the computer with id targetid (it will only arrive if both computers are connected to the same network).
skynetreceivemessage() – Waits for a skynet message and returns it.
skyneteventmessage() – This one works more like an os.pullEvent() with an extra event named "skynet" (which has the first parameter as message), so that you can wait for a skynet message or a key press or anything else.
Spoiler
--Repeater

function messageisnew()
 for ticn = 1, ticmemcounter do
  if timeandid == ticmem[ticn]
  then
   return false
  end
 end
 return true
end

function addtoticmem(newti)
 ticmemcounter = ticmemcounter + 1
 ticmem[ticmemcounter] = newti
end

function resetticmem()
 ticmemcounter = 0
 ticmem = {}
 os.setAlarm(0)
end


function skynetrepeater()
 resetticmem()
 while true do
  event, id, message = os.pullEvent()
  if event == "rednet_message"
  then
   if string.sub(message,1,8) == "[skynet]"
   then
    timeandid = string.sub(message,9,21) -- [TTTTTTIIIII]
    if messageisnew()
    then
	 addtoticmem(timeandid)
	 rednet.broadcast(message)
    end
   end
  elseif event == "alarm"
  then
   resetticmem()
  end
 end
end


--Sender

function getticode()
 time = os.time()
 for n=1, 6 do
  if string.len(time) < n
  then time = time.."0"
  end
 end

 id = os.getComputerID()
 for n=1, 5 do
  if string.len(id) < n
  then id = "0"..id
  end
 end
 timeandidcode = ("["..time..id.."]")
 return timeandidcode
end

function gettargetid(targetidf)
 targetidf = tostring(targetidf)
 for tidlenc=1, 4 do
  if string.len(targetidf) == tidlenc
  then
   targetidf = ("0"..targetidf)
  end
 end
 targetidf = "["..targetidf.."]"
 return targetidf
end

function skynetsendmessage(message, targetid)
 if message and targetid then
  rednet.broadcast("[skynet]"..getticode()..gettargetid(targetid)..message) --[skynet][TTTTTTIIIII][IIIII]
 end
end


--Receiver

function istargetid()
 targetid = tonumber(string.sub(skynettags,23,27))
 if targetid == os.getComputerID()
 then
  return true
 else
  return false
 end
end

function skynetreceivemessage()
 while true do
  event, id, message = os.pullEvent()
  if event == "rednet_message"
  then
   skynettags = string.sub(message,1,28)
   if string.sub(skynettags,1,8) == "[skynet]" then
    if istargetid() then
	 message = string.sub(message,29)
	 return message
    end
   end
  end
 end
end

function skyneteventmessage()
 while true do
  event, id, message = os.pullEvent()
  if event == "rednet_message"
  then
   skynettags = string.sub(message,1,28)
   if string.sub(skynettags,1,8) == "[skynet]" then
    if istargetid() then
	 message = string.sub(message,29)
	 return "skynet", message
    end
   end
  else
   return event, id, message
  end
 end
end

If you don't understand something you can take a look at the IRC program.

IRC
A basic chat program that uses the skynetapi. First make sure you're connected to a skynet, then make sure there is a computer running the IRCserver program and get its ID. Then you have to open the IRCclient program on your own computer and configure the rednet modem side and server id at the top.
commands are
/quit – be sure to use this when you stop. It causes you to logout so the server won't send messages to your computer anymore.
/name <name> – Name yourself.
If you don't type a "/" at the start it will send the message to the IRC server and broadcast it to all connected people.

IRCserver
Spoiler

rednet.open("top")     -- Be sure to adjust this if necessary!!
shell.run("skynetapi")

function broadcastmessage()
 for bcmc = 1, #idlist do
  targetid = idlist[bcmc]
  skynetsendmessage("[IRC]"..message, targetid)
 end
end

function addidtolist()
 newid = tonumber(string.sub(message,1,5))
 idlist[#idlist+1] = newid
end

function removeidfromlist()
 removeid = tonumber(string.sub(message,1,5))
 for rifln=1, #idlist do
  if removeid == tonumber(idlist[rifln])
  then
   for rifln2 = rifln, #idlist-1 do
    idlist[rifln2] = idlist[rifln2+1]
   end
   idlist[#idlist] = nil
   break
  end
 end
end

idlist = {}
while true do
 newmessage = skynetreceivemessage()
 type = string.sub(newmessage,1,5)
 message = string.sub(newmessage,6)
 if type == "[NID]" then addidtolist()
 elseif type == "[MSG]" then broadcastmessage()
 elseif type == "[RID]" then removeidfromlist()
 end
 print(#idlist)
end

IRCclient
Spoiler

rednet.open("top")  --Be sure to adjust this if necessary!!
IRCserverid = 51	 --Be sure to adjust this if necessary!!
shell.run("skynetapi")

function formatnumbertostring(fnumber, flength)
 fnumber = tostring(fnumber)
 if string.len(tostring(fnumber)) > flength then return false end
 if string.len(tostring(fnumber)) == flength then return tostring(fnumber) end
 if string.sub(fnumber,1,1) == "-"
 then
  fnumber = string.sub(fnumber,2)
  for formatnumbern=1, (flength-2) do
   if string.len(fnumber) == formatnumbern
   then fnumber = ("0"..fnumber)
   end
  end
  fnumber = ("-"..fnumber)
 else
  for formatnumbern=1, flength-1 do
   if string.len(fnumber) == formatnumbern
   then fnumber = ("0"..fnumber)
   end
  end
 end
 return fnumber
end

function login()
 message = "[NID]"..formatnumbertostring(os.getComputerID(), 5)

 skynetsendmessage(message, IRCserverid)


end

function logout()
 message = "[RID]"..formatnumbertostring(os.getComputerID(), 5)
 skynetsendmessage(message, IRCserverid)


end


function sendmessage()
 userid = os.getComputerID()
 if username then userid = username end
 message = ("[MSG]"..userid..": "..typeline)
 skynetsendmessage(message, IRCserverid)
end

function printnewline()
 message = string.sub(par1,6)
 print(message)
end

function executeline()
 if string.sub(typeline,1,1) == "/"
 then
  if string.sub(typeline,2,5) == "quit" then logout() os.shutdown()
  elseif string.sub(typeline,2,5) == "name" then username = string.sub(typeline,7)
  end
 else
  sendmessage()
 end
 typeline = ""
end

function updatetop()
 previousx, previousy = term.getCursorPos()
 term.setCursorPos(1,1)
 term.clearLine()
 print(">"..typeline)
 print("--------------------")
 term.setCursorPos(previousx, previousy)
end

function ircclient()
 maxx, maxy = term.getSize()
 while true do
  event, par1 = skyneteventmessage()
  if event == "skynet" and string.sub(par1,1,5) == "[IRC]" then printnewline() sleep(0.1)
  elseif event == "key" and par1 == 14 and string.len(typeline) > 0 then typeline = string.sub(typeline,1, string.len(typeline)-1) updatetop()
  elseif event == "key" and par1 == 28 and string.len(typeline) > 0 then executeline() updatetop()
  end

  if event == "char" and string.len(typeline) < maxx
  then
   typeline = (typeline..par1)
   updatetop()
  end
 end
end


term.clear()
term.setCursorPos(1,3)
typeline = ""
login()
updatetop()
ircclient()

wolfnether #68
Posted 06 March 2012 - 10:20 PM
you use broacast for send data is not safety !
Ceredorac #69
Posted 07 March 2012 - 10:12 AM
with the turtle factory, how did you get the buildcraft auto-crafting tables to be able to use pickaxes in their recipes?
Cookiebal #70
Posted 07 March 2012 - 11:31 AM
with the turtle factory, how did you get the buildcraft auto-crafting tables to be able to use pickaxes in their recipes?

Build a chest with the pickaxes in it next to the autocrafting table.

you use broacast for send data is not safety !

It indeed isn't very secure, but it is convenient. A repeater placed anywhere will work without needing to reconfigure the old ones. I just build my computer close enough to the network (or get an additional repeater between me and the network) and I'm good to go.
Gurax #71
Posted 10 March 2012 - 12:25 PM
how can i instal the skynet?
Cookiebal #72
Posted 10 March 2012 - 12:36 PM
You make a file on your computer and call it skynetapi and then put the skynet stuff in it. Do this on each computer/turtle that is going to use skynet.

To make a repeater you just have to place the computer/turtle where you want and give it a startup program like this:

shell.run("skynetapi")
rednet.open("side the modem is on")
skynetrepeater()

To send a message over the skynet you could use a program like this

shell.run("skynetapi")
rednet.open("side with the modem")
print("What do you want to send")
message = read()
print("Who do you want to send it to")
targetid = read()
skynetsendmessage(message, targetid)

An example program to receive and print messages:
shell.run("skynetapi")
rednet.open("side with the modem")
receivedmessage = skynetreceivemessage()
print(receivedmessage)
petrus4 #73
Posted 10 March 2012 - 02:50 PM
Out of curiousity, what do you do for wood, Cookie? I'm in the process of writing up some horrifically primitive turtle scripts for lumberjacking; although they're workable, provided I carry the turtles around and place them manually before I do each row. :mellow:/>/> I probably should just bite the bullet and install Forestry, but it seems far too big for my needs.
Cookiebal #74
Posted 10 March 2012 - 03:57 PM
Out of curiousity, what do you do for wood, Cookie? I'm in the process of writing up some horrifically primitive turtle scripts for lumberjacking; although they're workable, provided I carry the turtles around and place them manually before I do each row. :mellow:/>/> I probably should just bite the bullet and install Forestry, but it seems far too big for my needs.

With the Turtle Factory? Well, I just hope that at some point the turtle swarm will hit a forest. One proper forest will probably support the factory for quite a while. But other than that I got no special stuff for getting wood.
Monochrome #75
Posted 12 March 2012 - 01:23 PM
Hi, I'd like to try and build something like your turtle factory, but I'm running in a bit of a problem. What mods are you using, buildcraft + redpower + computercraft? How did you resolve the blockID incompatibility between redpower and buildcraft? Should I really start modifying block ids by hand?
Cookiebal #76
Posted 12 March 2012 - 03:12 PM
I did it manually, because I failed at opening RP2s config file D: . But you can just ctrl+f auto assign or auto-assign (not sure which one) in the RP2 config and change the bit behind it. That way it resolves the ids automatically.
petrus4 #77
Posted 14 March 2012 - 12:13 PM
[media]http://www.youtube.com/watch?v=pdPy4crWuCA[/media]

:mellow:/>/>

You will probably also very much like this, Cookie:-
Skynet Tactics

That whole site (http://www.goingfaster.com/term2029/) but particularly the above page, has been an influence on the shell scripting I've done. Christopher Shields is an amazing writer.
Pigbear #78
Posted 18 March 2012 - 03:26 PM
I must get the turtle factory!!!!!!!!!! Also the new accelerators will be good for swift making of the turtles.
BigSHinyToys #79
Posted 21 March 2012 - 07:48 PM
is there any plans for skynet to have security features. right now i could see all traffic by just ruining a print in a loop with a os.pull above it.
Cookiebal #80
Posted 21 March 2012 - 08:32 PM
is there any plans for skynet to have security features. right now i could see all traffic by just ruining a print in a loop with a os.pull above it.

Maybe in the future some time, but for now users can use this kind of programs to at least have the message itself encrypted http://www.computercraft.info/forums2/index.php?/topic/8-tomass1996s-encodingdecoding-programs-rot47-base64/page__hl__encoder__fromsearch__1
Cookiebal #81
Posted 24 March 2012 - 01:33 PM
Been busy with school related stuff (and Mass Effect 3), I'm going to make a turtle factory tutorial and update my world eater project once MC stops updating every week (I downloaded around 34 things for 1.2.3 a day before 1.2.4 released …).

However, I did make a television (96 pixels with 7 colours) that uses Redpower 2, the lasermod, and of course CC.



Unfortunately it lagged so badly it started bugging while only a third of the pixels active, the two blue ones on the left shouldn't even be lit. Maybe I shouldn't have done one computer per pixel after all. :(/>/>
Dreamlash #82
Posted 24 March 2012 - 11:32 PM
Noob question: all those logic functions can be "emulated" inside a computer? saving tons of lag?

I really will like a complete video for a Pale rust factory (aka World eater project), is theorically can be building from one turtle with the basic machines or just the code and 1 turtle (ton of coding and that will need to much time for store the basic materials for make replications from zero)
Cookiebal #83
Posted 25 March 2012 - 12:13 AM
Noob question: all those logic functions can be "emulated" inside a computer? saving tons of lag?

Now that you mention that, I derped there. I recently was watching one of Direwolf20's videos and saw that setup and thought it would be awesome to make a tv. But a single computer instead of 7*3 logic blocks controlled by a computer would work too. It would also make it a lot easier to have more pixels per computer, further reducing lag.

Oh well, at least a huge thing looks more impressive :(/>/> and I learned how to use MCedit.

I really will like a complete video for a Pale rust factory (aka World eater project), is theorically can be building from one turtle with the basic machines or just the code and 1 turtle (ton of coding and that will need to much time for store the basic materials for make replications from zero)

I think the turtle's block placing isn't advanced enough to make factories. At least it wouldn't be easy. Not sure how project tables would be handled. Except maybe if someone made a peripheral that allows a computer to craft without any direct player interference.
Dreamlash #84
Posted 25 March 2012 - 04:13 AM
The huge machine is still good for a electronic engineer (irl) as practice, but just in a flat world. Less lag help you make more pixels in your screen maybe. (time someone make a video clip ? )

The crafting table can be do for anyone, here in CC are plenty of skilled coders, the hard part is make it user friendly, so not just a coder will enjoy the software.

I still failing trying to make a rednet/skynet, that will remove the need of use wireless redstone (appears like nothings happening, nil ?, so that means the mess I been doing >.<

Oh also you can add a Soprano Noteblock (Supernoteblock) as a speaker for custom Disk music 8bits, oh I remember those 8bit voice samplings.

You have a lot of work for make the first complete TV.

I monitoring this thread for PWE and for Skynet advances.
Cookiebal #85
Posted 25 March 2012 - 12:26 PM
I still failing trying to make a rednet/skynet, that will remove the need of use wireless redstone (appears like nothings happening, nil ?, so that means the mess I been doing >.<

What does your program look like?
Cookiebal #86
Posted 25 March 2012 - 04:25 PM
Upgraded the TV so that it is 15*10 (150 pixels) controlled by 6 computers.

Now it's time to make a controller computer that allows images to be shown by sending messages to the pixel computers.


Cookiebal #87
Posted 26 March 2012 - 04:42 PM
CookieTV
[media]http://www.youtube.com/watch?v=aQvWje4npHU&feature=plcp&context=C47c2e9bVDvjVQa1PpcFMLuMMbyF2FHkrqbZ34N3R4vZuxlLrx454%3D[/media]
A television in Minecraft, using Redpower 2, Computercraft and of course the Laser mod. It has 15*10 7 colour pixels, controlled by 6 computers. Another main computer is needed to send the image codes via rednet. That computer also has an image creation program, allowing images to easily be made with arrow and number keys in a special UI, unfortunately it can't load images yet. The images are saved as 450 byte binary files, each segment of 75 0/1's has another 5 segments with a length of 15 (one per row), which got the RGB on/off states for each pixel.

The smily image is this:

111001110110111111110001111111111110110111111111111111111111111111111111111
111111111111111111111111111111111110110111111111110001111111111110110110111
111110110110111111110001110111111111110111111111111111111111111111111111111
111111111111111111111111111111111111110111111111110110110111111110110110111
111110110001111111111001110111111111110110111111111111111111111111111111111
111111111111111111111111111111111111110110111111111001110111111110110110111
A big chunk of 1's means a white area, since white is 111 (red on, green on and blue on).


The Code:

Pixelcontroler: Each one gets an unique ID from 1-6. The bottom ones get an uneven number and the top ones an even one. From right to left it goes 1/2 - 3/4 - 5/6.
Spoiler
TVCID = 1
rednet.open("front")
side = {"top", "right", "back", "left", "bottom"}

function receivecode()
 while true do
  event, id, message = os.pullEvent()
  if event == "rednet_message" then
   if string.sub(message,1,4) == "[TV]"
   then
    message = string.sub(message,5)
    break
   end
  end
 end
end

function filtercode()
 filteredcode = string.sub(message, 1+(TVCID-1)*75, TVCID*75)
 rowsegment = {}
 for n=1, 5 do
  rowsegment[n] = string.sub(filteredcode,1,15)
  filteredcode = string.sub(filteredcode,16)
 end
end

function filtersegment(rowsegment)
 pixelsegment = {}
 for n=1,5 do
  pixelsegment[n] = string.sub(rowsegment,1,3)
  rowsegment = string.sub(rowsegment,4)
 end
end

function readrow(row)
 filtersegment(row)

 red = {}
 green = {}
 blue = {}
 for n=1, 5 do
  red[n] = tonumber(string.sub(pixelsegment[n],1,1))
  green[n] = tonumber(string.sub(pixelsegment[n],2,2))
  blue[n] = tonumber(string.sub(pixelsegment[n],3,3))
 end

 outputnumber = 0
 for n=1, 5 do
  outputnumber = outputnumber + red[n]*2^(3*(n-1)) + green[n]*2^(3*(n-1)+1) + blue[n]*2^(3*(n-1)+2)
 end
end

function readcode()
 for rownumber=1, 5 do
  readrow(rowsegment[rownumber])
  rs.setBundledOutput(side[rownumber], outputnumber)
 end
end




while true do
 receivecode()
 filtercode()
 readcode()
end

showimage:
Used by typing "showimage <imagename>" like "image smily".
Spoiler

rednet.open("back")

tArgs = {...}
imagename = tArgs[1]

function getimagecode()
 file = io.open(imagename, "r")
 if file then
  imagecode = file:read()
  file:close()
 else print("Select a valid image") end
end

function sendimagecode()
 rednet.broadcast("[TV]"..imagecode)
end


getimagecode()
sendimagecode()

Createimage
To use you have to run it and first type an image name, it will be saved as this. Use the arrow keys to move the selected pixel (shown by the *'s on the borders of the image 'preview') and a number between 0-6 to change the colour. Press S and type yes to save, and Q to quit.
Spoiler
function ini()
 term.clear()
 term.setCursorPos(1,1)
 print("imagename:")
 imagename = read()

 curselpxlX = 1
 curselpxlY = 1
end

function convbintonum(bin)
 if bin == "111" then num = 0
 elseif bin == "100" then num = 1
 elseif bin == "010" then num = 2
 elseif bin == "001" then num = 3
 elseif bin == "110" then num = 4
 elseif bin == "011" then num = 5
 elseif bin == "101" then num = 6
 end
 return num
end

function loadimage()
 file = io.open(imagename, "r")
 imagecodestring = file:read()
 file:close()

 
end

function convnumtobinstring(num)
 if num == 0 then bin = "111"
 elseif num == 1 then bin = "100"
 elseif num == 2 then bin = "010"
 elseif num == 3 then bin = "001"
 elseif num == 4 then bin = "110"
 elseif num == 5 then bin = "011"
 elseif num == 6 then bin = "101"
 end
 return bin
end

function getimagecode()
 imagecodestring = ""
 for n=1, 6 do
  if n == 1 or n == 2 then startx = 3 elseif n == 3 or n == 4 then startx = 2 else startx = 1 end
  if n == 1 or n == 3 or n == 5 then starty = 6 else starty = 1 end
 
  for p=0, 4 do
   for q=0, 4 do
    imagecodestring = imagecodestring..convnumtobinstring(image[startx+3*q][starty+p])
   end
  end
 end
 return imagecodestring
end

function printfield()
 term.setCursorPos(1,1)
 term.clearLine()
 print(imagename)
 term.clearLine()
 write("+")
 write(string.rep("-", 15))
 print("+")
 for i=1, 10 do
  term.clearLine()
  write("|")
  for j=1, 15 do
   write(image[j][i])
  end
  write("|")
  print()
 end
 term.clearLine()
 write("+")
 write(string.rep("-", 15))
 print("+")
 print("Move around with the arrow keys, change colour by pressing 0-6.")
 print("0: white 1: red 2: green 3: blue 4: yellow 5: cyan 6: purple")
end

function newimage()
 image = {}
 for j=1, 15 do
  image[j] = {}
  for i=1, 10 do
   image[j][i] = 0
  end
 end
end

function showselectedpixel()
 term.setCursorPos(curselpxlX+1, 2)
 write("*")
 term.setCursorPos(curselpxlX+1, 13)
 write("*")
 term.setCursorPos(1, curselpxlY+2)
 write("*")
 term.setCursorPos(17, curselpxlY+2)
 write("*")
end

function move()
 if key == 200 then
  if curselpxlY > 1 then curselpxlY = curselpxlY - 1 end
 elseif key == 208 then
  if curselpxlY < 10 then curselpxlY = curselpxlY + 1 end
 elseif key == 203 then
  if curselpxlX > 1 then curselpxlX = curselpxlX - 1 end
 elseif key == 205 then
  if curselpxlX < 15 then curselpxlX = curselpxlX + 1 end
 end
end

function quit()
 term.setCursorPos(1,13)
 term.clearLine()
 term.setCursorPos(1,15)
 term.clearLine()
 term.setCursorPos(1,16)
 term.clearLine()
 term.setCursorPos(1,17)
 term.clearLine()
 term.setCursorPos(1,14)
 term.clearLine()
 print("Do you want to quit?")
 answer = read()
 if answer == "yes" then
  print("Ending...")
  sleep(1)
  term.clear()
  term.setCursorPos(1,1)
 end
end

function save()
 term.setCursorPos(1,13)
 term.clearLine()
 term.setCursorPos(1,15)
 term.clearLine()
 term.setCursorPos(1,16)
 term.clearLine()
 term.setCursorPos(1,17)
 term.clearLine()
 term.setCursorPos(1,14)
 term.clearLine()
 print("Do you want to save?")
 answer = read()
 if answer == "yes" then
  file = io.open(imagename, "w")
  file:write(getimagecode())
  file:close()
 end
end

function moveandedit()
 while true do
  event, arg = os.pullEvent()
  if event == "key"
  then
   key = arg
   if key == 200 or key == 203 or key == 205 or key == 208 then
    move()
   end
  elseif event == "char"
  then
   char = arg
   if char == "0" or char == "1" or char == "2" or char == "3" or char == "4" or char == "5" or char == "6" then
    char = tonumber(char)
    image[curselpxlX][curselpxlY] = char
   elseif char == "q" then quit() if answer == "yes" then break end
   elseif char == "s" then save()
   end
  end
  printfield()
  showselectedpixel()
 end
end




ini()
newimage()
printfield()
showselectedpixel()
moveandedit()



It's impossible to make the emptyimage file while it is very handy for shutting down the TV. It's a simple file though, just 450 zeros. Like this
Spoiler
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Espen #88
Posted 26 March 2012 - 05:08 PM
@Cookiebal:
Kudos man, great work. :o/>/>

About the buggy laser behaviour:
Do you think this might be caused because all lasers are fired at the same time?
Maybe firing them one after the other with a small delay before the next one might solve this problem?
Kind of like on a real cathode TV. :o/>/>

I have absolutely no idea how the lasermod works though, so it might be a crappy idea, idk.
just a thought.
Cookiebal #89
Posted 26 March 2012 - 05:33 PM
Thanks!

I have absolutely no idea how the lasermod works though, so it might be a crappy idea, idk.
just a thought.

Same for me :o/>/> this is the first time I use it in a creation. One thing I noticed is that it's usually the same pattern that is made, which is kinda strange.
Nailcannon #90
Posted 29 March 2012 - 12:55 AM
i have a question with the waypoint movement. does it go based off where you placed it or does the api allow the turtle to sense where it is in the world . like if i placed the turtle 100 plocks from the waypoint in a non preset location would it be able to go to the waypoint? sorry if this is a noob question.
Turtlemoviesco #91
Posted 29 March 2012 - 02:35 AM
What does the installer for the cookie system do? Does it just put the code files in the computer folder or does it install some mods too?
Cookiebal #92
Posted 29 March 2012 - 03:13 PM
What does the installer for the cookie system do? Does it just put the code files in the computer folder or does it install some mods too?

All files that are needed/important for the CookieSystem will be generated by the install program. It works by creating some folders and programs (with the regular io.open file:write functions). The only programs it installs are the account management programs (create, delete, …), the interface program, an uninstall program and a startup to run it.
You could copy the stuff, put it on pastebin and then use the pastebin programs from v1.31 to get the installer and thus CookieSystem easy, as long as you got the HTTP api enabled in the CC config.

i have a question with the waypoint movement. does it go based off where you placed it or does the api allow the turtle to sense where it is in the world . like if i placed the turtle 100 plocks from the waypoint in a non preset location would it be able to go to the waypoint? sorry if this is a noob question.

You have to manually put in the starting coords and which direction it faces (with f3), Every time it moves or turns using the waypoints it will keep track of it.
strideynet #93
Posted 29 March 2012 - 04:07 PM
Hey there i love rednet!
i think we should get a group of networking experts And build a internet working like this
1 You ping web server id with your id
2 the server replies with webpage!
would be great to get emails running maybe with a database so when you type lets say Cookiebal it thinks id 99!
i would love to get a fully functionel web going maybe on a white listed server completely flat and creative!
i would volunteer mine but its not 24/7 and its laggy!
maybe a team of 5 or so could help out so we'd need 3 more !maybe that encryption guy to make a ssl!
we could get this working with a edited rednet maybe so we could do DNS :
1 you ping DNS server with www.cookiebals.Rednet
2 it sends you Id of web server
This would mean each computer only needs to know one rnp(Red.Net.Protocol) (a twist on I.P(internet protocol))
or id!!!!
we just need a volunteered server!!Preferably running tekkti as that has a load of mods including cc Redpower IC BC
strideynet #94
Posted 29 March 2012 - 04:11 PM
Im not a lua expert but do understand the nitty gritty of the real internet and could give us explanations on how it works!!
and im learning lua!!
strideynet #95
Posted 29 March 2012 - 04:15 PM
excuse my mistakes i said rednet instead of skynet! !Real stupid mistake!!
Cookiebal #96
Posted 29 March 2012 - 05:06 PM
After my chemistry test tomorrow two weeks of vacation start, and I've been planning some of the stuff you mentioned for some time now, even got some basic stuff ready already for an email server, but I couldn't continue back then because I had lots of other stuff to do, but that's mostly done now. :o/>/>
strideynet #97
Posted 29 March 2012 - 06:10 PM
Would it be worth getting a team of 5 together to design this tuff together.
5 heads are quicker then 1!!!
And im pretty good at lua now !!
Our ultimate goal would to create a network to possibly withstand 1000's of computers with infinate capabilities .
And my final idea is to connect Worlds together somehow!!!!!1
meaning we could create The minecraft internet!!
aka we would set up a irc on the real intenet where Computer Craft netorks could send data to a main Computer craft network!!!
Meaning a technically world wide computer craft network !!
and world dominatation!mauahhahahahahahhahahahahhahahah
strideynet #98
Posted 29 March 2012 - 06:14 PM
a extra cool thing to do is program a AI using muiltiple computers to work together!
It would be cool working with you!
:)/>/> :)/>/> :o/>/> :)/>/> :o/>/> :)/>/> :)/>/>
:)/>/> :)/>/> :)/>/> :)/>/> :)/>/> :)/>/> :)/>/>
:)/>/> :)/>/> :)/>/> :)/>/> :)/>/> :D/>/> :)/>/>
:)/>/> :)/>/> :D/>/> :D/>/> :D/>/> :)/>/> :)/>/>
look hard real hard!!
tommyroyall #99
Posted 30 March 2012 - 03:57 PM
Man, nice work. I love the TV Idea. I can't wait to mix this with the GPS mesh networking idea, and then have multiple TV channels :3.
strideynet #100
Posted 31 March 2012 - 06:54 AM
Finally Easter holiday!i hope chemistry want too bad or hard!
Was it gcse? If it was I hope it got you a*.
Are you English or American ? Tis is out of interest into time zones as im English!
Leo Verto #101
Posted 31 March 2012 - 10:46 AM
@strideynet
I really like your idea, especially the world domination part :o/>/>
I'm gonna learn more about rednet now, maybe work on an encryption system with keys, so there are different access levels.
Cookiebal #102
Posted 31 March 2012 - 11:51 AM
Finally Easter holiday!i hope chemistry want too bad or hard!
Was it gcse? If it was I hope it got you a*.
Are you English or American ? Tis is out of interest into time zones as im English!

It was a regular revision test. And it got delayed till after the holidays, but the stuff we need to learn now became trice as much. I'm Dutch but live in Belgium/Flanders, GMT+1 timezone.
strideynet #103
Posted 31 March 2012 - 04:06 PM
cool!!
my server could now run anyways for our test!
becuase of holidays itll run about 11 am gmt to 6 pm gmt!!
it runs TEKKIT
look it up!!!
tekkit is a modpack That is parented by Technic
tekkit includes
  • Buildcraft
  • Computercraft
  • Industrial craft
Like the sound of it cookiebal?
Cookiebal #104
Posted 31 March 2012 - 06:11 PM
I rarely play SMP, my internet doesn't like it, so until that's fixed I am unable to join any servers at all.
Leo Verto #105
Posted 31 March 2012 - 07:14 PM
Cool, I'm GMT +1, too and I have my own tekkit server, if you want you can use it to test communication over different servers.
strideynet #106
Posted 02 April 2012 - 07:34 AM
Leo welcome to the project!
Project Internet !
Does you server have other players?
Is it 24/7
Because we'd neeed to find a private corner to not get griefed.
We could use your server as main one but could you post details soon.
Basically please reply asap.

Freaky
I posted this an 1 hour after you

Nope wromg
Leo Verto #107
Posted 02 April 2012 - 05:19 PM
Leo welcome to the project!
Project Internet !
Does you server have other players?
Is it 24/7
Because we'd neeed to find a private corner to not get griefed.
We could use your server as main one but could you post details soon.
Basically please reply asap.
Thanks for inviting me!
My server is hamachi but not 24/7 but you can tell me on steam when to start it.
I have a few other players I trust, nearly everyone has his own area.
We planned working on an encryption system but I thought about trying to hack rednet communications and other computers and developing security programs.
By the way, this is going off thread, you should make a new thread for this
Nailcannon #108
Posted 03 April 2012 - 12:59 AM
about the turtle mining. it seems they automatically know where to go(where no other turtles have mined before) instead of going through the entire block area each time like they do with the excavate command. how do you get them to do this?some sort of pseudo-code would be much help please.
strideynet #109
Posted 03 April 2012 - 07:06 AM
Well Leo the thing is I'm looking for a team of people to do a group of things
Internet
O.S
And much more
The hacking idea is great
I'm gonna make a thread or something like project net block
It's about networks and blocks.
It would become more of clan then a team!
We could play on survival too!
We wouldn't need creative.
strideynet #110
Posted 03 April 2012 - 07:21 AM
It's called project netblock
Cookiebal #111
Posted 03 April 2012 - 11:31 AM
about the turtle mining. it seems they automatically know where to go(where no other turtles have mined before) instead of going through the entire block area each time like they do with the excavate command. how do you get them to do this?some sort of pseudo-code would be much help please.

In the video the turtle factory floppy disk tells them where to mine.

It goes a bit like this
-I give it the starting coords of where the first turtle will start mining.
-A turtle is made, which causes the floppy disk programs to run
-The floppy installs all the programs on the turtle and then gives the turtle some persistent variables, one of them being his mining spot.
-Then the installation program changes a file on the floppy itself where the new mining coords are stored, so that the next turtle that is created will get another spot as this one.
-Then the automine program is activated and the turtle moves away.
ArcaneShade #112
Posted 13 April 2012 - 12:18 PM
cant you put the programs on cc-get?
Cookiebal #113
Posted 14 April 2012 - 12:29 AM
I actually never used CC-get, but if you want some of my programs ingame on a server without much hassle feel free to use CC-get for it, just give me credit where necessary and all that basic stuff.
Esteban #114
Posted 22 April 2012 - 08:18 AM
Hey Cookiebal, I watched your world eater project vid on youtube. First : congratulations for the awesome prospects it offers to the world of minecraft.
Secondly : I saw you were having some problems with colliding/conflicting turtles in this vid. One solution would be to mimick the way the ethernet protocol avoids collisions. Only one frame at a time can travel through an ethernet cable, and for this reason, engineers have thought out a way to avoid series of chained collisions (kinda like the stupid loop behavior your turtles adopted). The solution is to make them wait a random/exponential duration.
You can find more infos about this at
http://en.wikipedia.org/wiki/Ethernet
and more specifically there
http://en.wikipedia.org/wiki/Exponential_backoff

Hope it'll help you !
Cookiebal #115
Posted 22 April 2012 - 12:07 PM
I actually already fixed that problem simply by changing the order in which they try to avoid obstacles above/below them :)/>/>
Mightygod27 #116
Posted 01 June 2012 - 04:32 AM
I'm probably just missing something here, but how do we set the coordinates for the bucket?
arbot #117
Posted 03 June 2012 - 04:29 PM
So. I like the look of this Skynet API.
However, how do we check if a computer is in range?
Leo Verto #118
Posted 03 June 2012 - 06:47 PM
arbot #119
Posted 04 June 2012 - 10:26 AM

Lolwut?

Cookiebal; do you mind if I make some modifications to your SkynetAPI? That is to say, modifications I post somewhere..
Would you rather I posted changes in this topic, or can I create my own and give you credit?
Cookiebal #120
Posted 04 June 2012 - 04:56 PM
I'm probably just missing something here, but how do we set the coordinates for the bucket?

Manually in one of the files.

So. I like the look of this Skynet API.
However, how do we check if a computer is in range?

There is no range check.

It's a bit like a giant rednet broadcast (with some code to make sure each message is only repeated once per repeater), only one computer can hear it with skynet, but all computers can hear it with regular rednet.


I actually did less Redpower computer/frame stuff than planned. I'm doing neither Redbuss nor CC at the moment D:

I originally had Project World Eater planned as something mounted on a frame airship. I should get to again at one point. I'm going on holiday in July where I won't have proper computer/internet access besides my laptop, so there still is hope.

Cookiebal; do you mind if I make some modifications to your SkynetAPI? That is to say, modifications I post somewhere..
Would you rather I posted changes in this topic, or can I create my own and give you credit?

Feel free to modify it, giving credit where necessary is enough.
Leo Verto #121
Posted 04 June 2012 - 05:00 PM
I like your frame machines, too, please go on developing them, unfortunately I'm not able to copy the file for your 6x6x6 engine into the proper server directory.
arbot #122
Posted 04 June 2012 - 08:09 PM
Cookiebal; do you mind if I make some modifications to your SkynetAPI? That is to say, modifications I post somewhere..
Would you rather I posted changes in this topic, or can I create my own and give you credit?

Feel free to modify it, giving credit where necessary is enough.

You're awesome, I'll get back to you on it :3
Cookiebal #123
Posted 04 June 2012 - 08:23 PM
I like your frame machines, too, please go on developing them, unfortunately I'm not able to copy the file for your 6x6x6 engine into the proper server directory.

I think that one is outdated because of the B2 update. Haven't gotten around to reprogram the whole thing.
RP really needs another way to program stuff besides ingame typing. :)/>/>
Leo Verto #124
Posted 04 June 2012 - 10:04 PM
I think that one is outdated because of the B2 update. Haven't gotten around to reprogram the whole thing.
RP really needs another way to program stuff besides ingame typing. :)/>/>
Oh yes, that's really annoying, and it's also hard to find out how to code. That's why I prefer CC and LUA.
kazagistar #125
Posted 05 June 2012 - 01:15 AM
Oh yes, that's really annoying, and it's also hard to find out how to code. That's why I prefer CC and LUA.

Funny you should mention that, seeing as I just made a program for quickly typing local files directly into mine craft… I'm sure you could repurpose it from CC to RPcontrol very easily. http://www.computercraft.info/forums2/index.php?/topic/1963-minecopy-v2-linuxwindows/
Mightygod27 #126
Posted 05 June 2012 - 03:31 AM
Sorry to bother you again Cookiebal :)/>/> I found the files I needed >.> but now, after my turtle goes down one shaft, and up the next, it goes to the bucket, which is fine, but then it stops after dropping everything and gives this error:
"startup:28: attempt to call nil"
but my turtle doesn't have a startup program :/
Cookiebal #127
Posted 05 June 2012 - 06:55 PM
Could you post what you have currently?

It's been quite some time since I worked on my turtles and I have changed the code so many times even I lost track of what was what. :)/>/>
gaz492 #128
Posted 06 June 2012 - 11:47 PM
This might be a noobish question but how to i install skynet on to my tekkit's computercraft?
Cookiebal #129
Posted 07 June 2012 - 11:57 AM
I don't use any tekkit stuff since I like to put together my own mod combinations, but I'm going to assume it's the same as regular CC.

1: Place the computer or active the one you want to get the Skynetapi on.
2: Run the computer ID program (probably just ID) and note the number it gives.
3: Make a file called "skynetapi" (edit skynetapi and save it empty)
4: Go to the folder your computercraft files are stored (.minecraft/saves/<world name>/computer/ with the regular version) and go into the folder that matches the computer ID (step 2) and then open the file called skynetapi (from step 3)
5: copy the skynet api code from this thread into the opened file.
6: Save and done.

To use the skynet api you have to use its functions in your programs, be sure to add a "shell.run("skynetapi")" at the top of all programs using it.
arbot #130
Posted 07 June 2012 - 07:24 PM
I don't use any tekkit stuff since I like to put together my own mod combinations, but I'm going to assume it's the same as regular CC.

1: Place the computer or active the one you want to get the Skynetapi on.
2: Run the computer ID program (probably just ID) and note the number it gives.
3: Make a file called "skynetapi" (edit skynetapi and save it empty)
4: Go to the folder your computercraft files are stored (.minecraft/saves/<world name>/computer/ with the regular version) and go into the folder that matches the computer ID (step 2) and then open the file called skynetapi (from step 3)
5: copy the skynet api code from this thread into the opened file.
6: Save and done.

To use the skynet api you have to use its functions in your programs, be sure to add a "shell.run("skynetapi")" at the top of all programs using it.

That works, or you could do this..

> Go to the mods folder in your server files
> Go to the ComputerCraft folder
> Go to lua/rom/apis
> Create the "skynet" file and copy his stuff into it

It works differently from sticking it in the root of your PC because you no longer need to run it when you want it, and you have to prefix the functions with "skynet.". But I feel like it's better that way, since it becomes global.
sinnaj123 #131
Posted 02 July 2012 - 09:37 PM
Can you give us the turtle factory save (world)



(sorry for my bad english,i am from german)
Cookiebal #132
Posted 03 July 2012 - 10:35 PM
I can't.

I got the world, but that's useless without the mods and config files. :/
xondk #133
Posted 19 July 2012 - 05:31 AM
So I've begun playing around with skynet and it worked fine, but all of a sudden, the repeater function stopped working, and without it I cant sent up repeaters to send the message to the IRC server, I am running with the stock code as it is, but the repeater simply refuses to send the message onwards. any ideas?
Wolf9988 #134
Posted 27 July 2012 - 08:16 AM
Hey i just found this today and i have been looking for something that automate turtle mining i got all the code and realized i needed the automine code so i got it and set it up but when i use automine it flys up into the air and i changed my gamemode to follow it then i clicked on it and there was this error:

pathfinding:191: attempt to compare __l t on nil and number

and when i came out of the console it was going straight down and starting mining my setup below.

Please Help
strideynet #135
Posted 08 August 2012 - 02:36 PM
Hey cookie! hows it hanging.seem syour doing well. ;)/>/>
Cookiebal #136
Posted 10 August 2012 - 08:48 PM
Uh, I kinda went inactive. Mostly busy playing other games/reading. ;)/>/>
Cookiebal #137
Posted 12 August 2012 - 12:51 AM
It's been a long while since I made something with Computercraft, or even any other minecraft related stuff.

But a few hours ago I started building/programming the Frame Engine Constructor turtle.



I'm basing it on my most advanced frame engine design, but I'll probably ditch the wireless redstone part (unless the workaround takes a lot of space/is impossible).

Some things are really a pain in the ass to get done. Like the motors, when a turtle places them the presence of a block behind or under the newly placed motor causes it to face a different direction, and since the screwdriver can only change the arrow's direction (and not the way the arrow is facing, if that makes sense), it needs to be right. Another thing was with the not gates on the panels, they can only be placed by a turtle if there is no block below. But I think the most difficult part (apart from possible the wiring) is done now.
Cookiebal #138
Posted 12 August 2012 - 06:59 PM
Frame Engine Factory
This Turtle makes an entire compact 6 directional frame engine all by itself (after you build the construction area and run the program). The video is on 4x speed for the most part, the turtle takes about 10-15 minutes building the whole thing. It's based on the frame engine I made that can be seen in my nuke missile and engine tutorial video, with some minor changes. Power input and controls are supposed to be external.

[media]http://www.youtube.com/watch?v=4yROBWMLDW8[/media]


Code:
Spoiler
function dropslotxto16(minslot)
for currentdropslot = minslot, 16 do
  turtle.select(currentdropslot)
  turtle.dropDown()
end
turtle.select(1)
end

function getamountfrominventory(amountneeded)
turtle.suckDown()
repeat
  amountinturtle = turtle.getItemCount(1)
  if amountinturtle < amountneeded then
   turtle.suckDown()
   dropslotxto16(2)
  end
until
  amountinturtle >= amountneeded
if amountinturtle > amountneeded then
  turtle.dropDown(amountinturtle-amountneeded)
end
end

function getframes(amountneeded)
turtle.up()
turtle.back()
turtle.back()
getamountfrominventory(amountneeded)
turtle.forward()
turtle.forward()
turtle.down()
end

function getpanels(amountneeded)
turtle.up()
turtle.back()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
getamountfrominventory(amountneeded)
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.down()
end

function getnotgates(amountneeded)
turtle.up()
turtle.back()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
turtle.back()
getamountfrominventory(amountneeded)
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.down()
end

function getmotors(amountneeded)
turtle.up()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
getamountfrominventory(amountneeded)
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.down()
end

function getbatterybox(amountneeded)
turtle.up()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
turtle.back()
turtle.back()
getamountfrominventory(amountneeded)
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.down()
end

function getbattery()
turtle.up()
turtle.back()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
turtle.back()
turtle.back()
turtle.back()
turtle.suckDown()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.down()
end

function getscrewdriver()
turtle.up()
for n=1, 4 do turtle.back() end
turtle.suckDown()
for n=1, 4 do turtle.forward() end
turtle.down()
end

function dropoffscrewdriver()
turtle.up()
for n=1, 4 do turtle.back() end
turtle.dropDown()
for n=1, 4 do turtle.forward() end
turtle.down()
end

function getredwire(amountneeded)
turtle.up()
turtle.back()
turtle.back()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
getamountfrominventory(amountneeded)
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.down()
end

function getbluewire(amountneeded)
turtle.up()
turtle.back()
turtle.back()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
turtle.back()
turtle.back()
getamountfrominventory(amountneeded)
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.down()
end

function makebaseframefloor()
turtle.up()
turtle.forward()
for m=1, 3 do
  for n=1, 6 do
   turtle.placeDown()
   turtle.forward()
  end
  turtle.turnRight()
  turtle.forward()
  turtle.turnRight()
  turtle.forward()
  for n=1, 6 do
   turtle.placeDown()
   turtle.forward()
  end
  turtle.turnLeft()
  turtle.forward()
  turtle.turnLeft()
  turtle.forward()
end
  turtle.up()
  turtle.forward()
  turtle.turnLeft()
  turtle.forward()
  turtle.forward()
  turtle.placeDown()
  turtle.forward()
  turtle.forward()
  turtle.placeDown()
  turtle.forward()
  turtle.placeDown()
  turtle.turnRight()
  turtle.forward()
  turtle.turnRight()
  turtle.forward()
  turtle.placeDown()
  turtle.forward()
  turtle.placeDown()
  turtle.forward()
  turtle.placeDown()
  turtle.turnLeft()
  turtle.forward()
  turtle.turnLeft()
  turtle.forward()
  turtle.placeDown()
  turtle.forward()
  turtle.placeDown()
  turtle.forward()
  turtle.placeDown()
  turtle.turnRight()
  turtle.forward()
  turtle.turnRight()
  turtle.placeDown()
  turtle.forward()
  turtle.forward()
  turtle.placeDown()
  turtle.forward()
  turtle.placeDown()
  for n=1, 4 do turtle.back() end
  turtle.turnLeft()
  for n=1, 5 do turtle.back() end
  turtle.down()
  turtle.down()
end

function placepanels()
turtle.up()
turtle.forward()
for n=1, 4 do
  turtle.forward()
  turtle.forward()
  turtle.turnRight()
  turtle.forward()
  turtle.place()
  turtle.back()
  turtle.turnLeft()
  for m=1, 3 do turtle.forward() end
  turtle.turnRight()
end
turtle.back()
turtle.down()
end

function placenotgates()
turtle.up()
turtle.forward()
for n=1, 4 do
  turtle.forward()
  turtle.forward()
  turtle.turnRight()
  turtle.digDown()
  turtle.down()
  turtle.dig()
  turtle.up()
  turtle.place()
  turtle.down()
  turtle.select(2)
  turtle.place()
  turtle.up()
  turtle.placeDown()
  turtle.select(1)
  turtle.turnLeft()
  for m=1, 3 do turtle.forward() end
  turtle.turnRight()
end
turtle.back()
turtle.down()
end

function placemotorsinside()
for m=1, 2 do turtle.up() end
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
for n=1, 4 do
  turtle.forward()
  turtle.turnLeft()
  turtle.place()
  turtle.turnRight()
  turtle.forward()
  turtle.forward()
  turtle.turnLeft()
end
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
for m=1, 2 do turtle.down() end
end

function placemotorsoutside()
turtle.up()
turtle.forward()
turtle.turnRight()
for n=1, 4 do
  turtle.forward()
  turtle.forward()
  turtle.turnLeft()
  turtle.dig()
  turtle.forward()
  turtle.turnLeft()
  turtle.turnLeft()
  turtle.placeUp()
  turtle.turnLeft()
  turtle.turnLeft()
  turtle.back()
  turtle.select(2)
  turtle.place()
  turtle.select(1)
  turtle.turnRight()
  turtle.forward()
  turtle.forward()
  turtle.forward()
  turtle.turnLeft()
end
turtle.turnLeft()
turtle.back()
turtle.down()
turtle.down()
end

function adjustmotors()
for m=1, 3 do turtle.up() end
for m=1, 2 do turtle.forward() end
turtle.turnRight()
for m=1, 2 do turtle.forward() end
for m=1, 3 do turtle.placeDown() end
for m=1, 2 do turtle.forward() end
for n=1, 2 do
  turtle.turnLeft()
  turtle.forward()
  for m=1, 3 do turtle.placeDown() end
  for m=1, 2 do turtle.forward() end
end
turtle.turnLeft()
turtle.forward()
for m=1, 3 do turtle.placeDown() end
turtle.turnLeft()
turtle.forward()
for n=1, 4 do
  turtle.placeDown()
  turtle.forward()
  turtle.turnRight()
end
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
turtle.back()
turtle.back()
for m=1, 4 do turtle.down() end
end

function placebatteryboxes()
for m=1, 3 do turtle.up() end
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
for n=1, 4 do
  turtle.forward()
  turtle.turnLeft()
  turtle.place()
  turtle.turnRight()
  turtle.forward()
  turtle.forward()
  turtle.turnLeft()
end
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
for m=1, 3 do turtle.down() end
end

function placesecondframeset()
for m=1, 4 do turtle.up() end
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
for n=1, 4 do
  turtle.down()
  turtle.placeDown()
  turtle.up()
  turtle.placeDown()
  for m=1, 2 do turtle.forward() end
  turtle.placeDown()
  turtle.forward()
  turtle.turnLeft()
end
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
for m=1, 4 do turtle.down() end
end

function placeupmotors()
for m=1, 4 do turtle.up() end
for m=1, 3 do turtle.forward() end
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.turnLeft()
turtle.place()
turtle.digDown()
turtle.down()
turtle.turnRight()
turtle.turnRight()
turtle.placeUp()
turtle.forward()
turtle.turnRight()
turtle.turnRight()
turtle.select(2)
turtle.place()
turtle.select(1)
turtle.back()
turtle.turnRight()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
for m=1, 3 do turtle.down() end
end

function adjustupmotors()
for m=1, 5 do turtle.up() end
for m=1, 3 do turtle.forward() end
turtle.turnRight()
for m=1, 2 do turtle.forward() end
for m=1, 2 do turtle.placeDown() end
turtle.turnLeft()
turtle.forward()
for m=1, 2 do turtle.placeDown() end
turtle.back()
turtle.turnRight()
for m=1, 2 do turtle.back() end
turtle.turnLeft()
for m=1, 3 do turtle.back() end
for m=1, 5 do turtle.down() end
end

function placefifthbatbox()
for m=1, 5 do turtle.up() end
for m=1, 3 do turtle.forward() end
turtle.turnRight()
for m=1, 3 do turtle.forward() end
turtle.placeDown()
for m=1, 3 do turtle.back() end
turtle.turnLeft()
for m=1, 3 do turtle.back() end
for m=1, 5 do turtle.down() end
end

function placedownmotors()
for m=1, 5 do turtle.up() end
for m=1, 5 do turtle.forward() end
turtle.turnRight()
for m=1, 3 do turtle.forward() end
turtle.turnRight()
turtle.forward()
turtle.place()
turtle.back()
turtle.place()
turtle.turnLeft()
for m=1, 3 do turtle.back() end
turtle.turnLeft()
for m=1, 5 do turtle.back() end
for m=1, 5 do turtle.down() end
end

function placesomeframes()
for m=1, 5 do turtle.up() end
for m=1, 2 do turtle.forward() end
turtle.turnRight()
for n=1, 2 do
  turtle.forward()
  turtle.placeDown()
end
for n=1, 2 do
  for m=1, 2 do turtle.forward() end
  turtle.turnLeft()
  turtle.placeDown()
  turtle.forward()
  turtle.placeDown()
end
for n=1, 2 do
  turtle.forward()
  turtle.placeDown()
end
turtle.turnLeft()
turtle.forward()
turtle.placeDown()
for m=1, 2 do turtle.forward() end
turtle.turnLeft()
turtle.back()
turtle.turnLeft()
for m=1, 2 do turtle.back() end
for m=1, 5 do turtle.down() end
end

function placesecondpanels()
for m=1, 4 do turtle.up() end
for m=1, 3 do turtle.forward() end
turtle.turnRight()
turtle.forward()
turtle.placeDown()
for m=1, 2 do turtle.up() end
for m=1, 3 do turtle.forward() end
turtle.down()
turtle.placeDown()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
turtle.down()
turtle.placeDown()
for m=1, 2 do turtle.up() end
for m=1, 3 do turtle.forward() end
turtle.down()
turtle.placeDown()
turtle.forward()
turtle.turnRight()
for m=1, 4 do turtle.back() end
for m=1, 5 do turtle.down() end
end

function placesecondnotgates()
for m=1, 6 do turtle.up() end
for m=1, 4 do turtle.forward() end
turtle.turnRight()
turtle.forward()
turtle.placeDown()
for m=1, 3 do turtle.forward() end
turtle.down()
turtle.turnRight()
turtle.turnRight()
turtle.placeDown()
turtle.up()
for m=1, 4 do turtle.forward() end
turtle.turnRight()
for m=1, 4 do turtle.back() end
for m=1, 6 do turtle.down() end
end

function placemoreframes()
for m=1, 2 do turtle.up() end
turtle.forward()
for n=1, 4 do
  for m=1, 3 do turtle.forward() end
  turtle.placeDown()
  for m=1, 2 do turtle.forward() end
  turtle.turnRight()
end
turtle.up()
turtle.forward()
turtle.place()
turtle.back()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.place()
turtle.up()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.place()
turtle.back()
turtle.back()
turtle.turnRight()
for m=1, 5 do turtle.back() end
turtle.turnLeft()
for m=1, 4 do turtle.down() end
end

function placemorepanels()
for m=1, 2 do turtle.up() end
turtle.forward()
for n=1, 4 do
  for m=1, 3 do turtle.forward() end
  turtle.placeDown()
  for m=1, 2 do turtle.forward() end
  turtle.turnRight()
end
for m=1, 2 do turtle.up() end
for m=1, 2 do turtle.forward() end
turtle.placeDown()
for m=1, 2 do turtle.back() end
turtle.turnRight()
for m=1, 3 do turtle.forward() end
turtle.placeDown()
turtle.turnLeft()
turtle.forward()
turtle.placeDown()
turtle.turnRight()
turtle.up()
for m=1, 2 do turtle.forward() end
turtle.turnLeft()
turtle.forward()
turtle.placeDown()
for m=1, 3 do turtle.back() end
turtle.turnRight()
for m=1, 5 do turtle.back() end
turtle.turnLeft()
for m=1, 5 do turtle.down() end
end

function placeredwire()
turtle.up()
turtle.up()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
for n=1, 4 do
  for m=1, 4 do turtle.forward() end
  turtle.turnRight()
  turtle.place()
  turtle.turnLeft()
  for m=1, 3 do turtle.forward() end
  turtle.turnRight()
end
for m=1, 3 do turtle.up() end
for m=1, 3 do turtle.forward() end
turtle.turnRight()
for n=1, 2 do
  turtle.forward()
  turtle.placeDown()
end
turtle.up()
for m=1, 2 do turtle.forward() end
for n=1, 2 do
  turtle.forward()
  turtle.placeDown()
end
for m=1, 5 do turtle.back() end
turtle.turnLeft()
for m=1, 3 do turtle.back() end
for m=1, 6 do turtle.down() end
end

function placebluewire()
for m=1, 5 do turtle.up() end
turtle.forward()
turtle.turnRight()
for m=1, 3 do turtle.forward() end
turtle.placeDown()
turtle.turnLeft()
turtle.forward()
turtle.placeDown()
turtle.back()
turtle.back()
turtle.turnRight()
for m=1, 3 do turtle.back() end
turtle.turnLeft()
for m=1, 5 do turtle.down() end
end

function placeright()
turtle.turnRight()
turtle.place()
turtle.turnLeft()
end

function placeleft()
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end

function placeshellpartone()
turtle.up()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
for i=1, 4 do
  for n=1, 4 do
   for m=1, 6 do
	turtle.forward()
	placeright()
   end
   turtle.forward()
   turtle.turnRight()
  end
turtle.up()
end
for m=1, 5 do turtle.down() end
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end

function placeshellparttwo()
for m=1, 4 do turtle.up() end
turtle.turnRight()
for m=1, 4 do turtle.forward() placeleft() end
turtle.forward()
turtle.forward()
turtle.up()
turtle.turnLeft()
for n=1, 4 do
  for m=1, 6 do
   turtle.forward()
   placeleft()
  end
  turtle.forward()
  turtle.turnLeft()
end
turtle.up()
turtle.up()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
for n=1, 3 do
  for m=1, 6 do
   turtle.placeDown()
   turtle.forward()
  end
  turtle.turnLeft()
  turtle.forward()
  turtle.turnLeft()
  turtle.forward()
  for m=1, 6 do
   turtle.placeDown()
   turtle.forward()
  end
  turtle.turnRight()
  turtle.forward()
  turtle.turnRight()
  turtle.forward()
end
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.digDown()
turtle.down()
turtle.placeDown()
turtle.up()
turtle.placeDown()
turtle.back()
turtle.back()
turtle.turnLeft()
turtle.back()
turtle.back()
turtle.back()
for m=1, 7 do turtle.down() end
end

function givepower()
for m=1, 5 do turtle.up() end
for m=1, 6 do turtle.back() end
turtle.turnRight()
turtle.forward()
turtle.forward()
for n=1, 3 do
  redstone.setOutput("bottom", true)
  sleep(0.5)
  redstone.setOutput("bottom", false)
  sleep(0.5)
end
sleep(30)
turtle.forward()
turtle.forward()
turtle.forward()
for n=1, 3 do
  redstone.setOutput("bottom", true)
  sleep(0.5)
  redstone.setOutput("bottom", false)
  sleep(0.5)
end
for m=1, 5 do turtle.back() end
turtle.turnLeft()
for m=1, 6 do turtle.forward() end
for m=1, 5 do turtle.down() end
end

function moveengineup()
for m=1, 4 do turtle.up() end
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
for m=1, 3 do turtle.forward() end
turtle.turnRight()
redstone.setOutput("front", true)
sleep(0.5)
redstone.setOutput("front", false)
turtle.turnLeft()
for m=1, 3 do turtle.back() end
turtle.turnLeft()
turtle.back()
turtle.turnRight()
for m=1, 4 do turtle.down() end
end



getframes(48)
makebaseframefloor()
getpanels(4)
placepanels()
getnotgates(4)
placenotgates()
getmotors(8)
placemotorsinside()
placemotorsoutside()
getscrewdriver()
adjustmotors()
dropoffscrewdriver()
getbatterybox(4)
placebatteryboxes()
getframes(12)
placesecondframeset()
getmotors(2)
placeupmotors()
getscrewdriver()
adjustupmotors()
dropoffscrewdriver()
getbatterybox(1)
placefifthbatbox()
getmotors(2)
placedownmotors()
getframes(9)
placesomeframes()
getpanels(4)
placesecondpanels()
getnotgates(2)
placesecondnotgates()
getframes(7)
placemoreframes()
getpanels(8)
placemorepanels()
getredwire(8)
placeredwire()
getbluewire(2)
placebluewire()
getframes(64)
placeshellpartone()
getframes(59)
placeshellparttwo()
givepower()
moveengineup()

FuzzyPurp #139
Posted 13 August 2012 - 10:06 AM
Wow Cookie, this just awesome! Downloading immediately!
Cookiebal #140
Posted 13 August 2012 - 11:21 AM
Here's the setup for the chests.

Spoiler

I haven't counted how much of each material gets used, but only frames use more than one stack, be sure to have plenty of them.
Cookiebal #141
Posted 02 September 2012 - 01:19 AM
Someone requested it recently and now I need it again so I might as well make it public, the download link contains the computer part of the world eater save. Parts of it might not work entirely correctly, but if you have really want to this is the best way to obtain the full set if the world eater project's entire code. It also has a bunch of my skynet related projects though most of it was abandoned near start with the exception of the released skynet stuff.

http://www.sendspace.com/file/il31s8
Cookiebal #142
Posted 14 September 2012 - 07:34 PM
Movement System (update)
I added an ui thingy to the movement system that makes it easier to use manually. It will first ask if you want to use the currently saved coordinates, enter them manually or use GPS locating to get them (of course the turtle needs to have a modem and access to some gps hosts). After that you enter the waypoints/destination and type done to send it on its way.

I put all the necessary code in an installer program and uploaded it to pastebin: http://pastebin.com/1vyVpVKq
The main file ("movesys", in the root folder) is what you need to run after installing.
You don't have to worry about anything in the "movementsystem" folder.

I also made some changes to the persistent variables api and movecoord api (different named functions) and put them in the main file.
gknova61 #143
Posted 20 September 2012 - 02:27 AM
Was wondering if someone could clear this up.
Quote:
"skyneteventmessage() – This one works more like an os.pullEvent() with an extra event named "skynet" (which has the first parameter as message), so that you can wait for a skynet message or a key press or anything else."

Does this add an event named "skynet" that can be fired or does it not and it was a misinterpretation? What I want to do is substitute the event rednet_message for the "skynet" event I think exists. Also, if it does exist, does it return the same as rednet_message (parameters senderId, message, and distance)?
Cookiebal #144
Posted 20 September 2012 - 02:40 AM
It waits until an event is given, if it is a skynet message (over rednet) it will return the string "skynet" (event name) and the message. If any other event happens it returns the event name and the first two parameters, the same thing as a normal os.pullEvent() (as long as it doesn't have three or more additional parameters I guess, so wireless rednet wouldn't give the distance for example).
martejj #145
Posted 11 November 2012 - 08:01 PM
hi i have done all of the installing stuff for the frame engine factory, it shows up in my mining turtle but when i try to run it goes up one block and back 2 and then says" createframeengine:10: attempt to call nil" can someone please if they know whats wrong tell me? thx
Cookiebal #146
Posted 11 November 2012 - 10:46 PM
Weird, that error would be at
turtle.suckDown()

But I don't see how that could be a problem.


Does that command work (With the lua thingy you get when you type lua in the shell) if you put a turtle above a chest with items in it?
Maybe you're using an older version of CC than I used and the command wasn't implemented yet? The CC 1.4 patch notes does mention changes to this command.
Ajt86 #147
Posted 07 February 2013 - 05:57 AM
Do you mind if I attempt to improve some of the latest ComputerCraft programs you made into better programs?
Note that I will give you credit for compiling them.
My idea is for example if they require files to have them automatically created by the programs themselves and can be filled up within the program. Making it easier for people who do not know Lua programming to be able to use these programs.
If you do not authorize it, I do not mind.
If you authorize it, thanks, it will keep me busy.

Ajt86
anonimo182 #148
Posted 07 February 2013 - 01:27 PM
Thanks for reviving this post, as almost any other…
<sarcasm>
adamrocks130 #149
Posted 17 February 2013 - 07:52 AM
hi i have done all of the installing stuff for the frame engine factory, it shows up in my mining turtle but when i try to run it goes up one block and back 2 and then says" createframeengine:10: attempt to call nil" can someone please if they know whats wrong tell me? thx

I'm having issues too and i have no idea how to fix it.

And I'm running ComputerCraft 1.32
adamrocks130 #150
Posted 18 February 2013 - 02:02 PM
Now I'm having issues with the frame engine on ComputerCraft 1.4
The turtle does an endless cycle through all 16 slots and it doesn't stop.
Please help!
Skullblade #151
Posted 18 February 2013 - 02:20 PM
Now I'm having issues with the frame engine on ComputerCraft 1.4
The turtle does an endless cycle through all 16 slots and it doesn't stop.
Please help!
Dont bump
Cookiebal #152
Posted 21 February 2013 - 01:10 AM
Do you mind if I attempt to improve some of the latest ComputerCraft programs you made into better programs?
Note that I will give you credit for compiling them.
My idea is for example if they require files to have them automatically created by the programs themselves and can be filled up within the program. Making it easier for people who do not know Lua programming to be able to use these programs.
If you do not authorize it, I do not mind.
If you authorize it, thanks, it will keep me busy.

Ajt86

With appropriate credits saying that I made my code, sure.

Now I'm having issues with the frame engine on ComputerCraft 1.4
The turtle does an endless cycle through all 16 slots and it doesn't stop.
Please help!

Is your setup completely right? (contents in the chests and start position/face of the turtle included). If so, on what part of the process does it go wrong? Did it put anything in the inventory when it's cycling trough?
adamrocks130 #153
Posted 03 March 2013 - 10:32 AM
Sweet it works, thanks
Brodur #154
Posted 08 July 2013 - 06:55 PM
So… I've made a network of relays to host an IRC across server, but after relay 35 the signal no longer get returned, all relays are spaced at 63 blocks apart. relay 35 works to send IRC, 36 does not. It is very odd.
Just had to reboot the server computer to integrate the new relays. Woopsi.
icecube45 #155
Posted 15 September 2013 - 06:48 PM
Someone requested it recently and now I need it again so I might as well make it public, the download link contains the computer part of the world eater save. Parts of it might not work entirely correctly, but if you have really want to this is the best way to obtain the full set if the world eater project's entire code. It also has a bunch of my skynet related projects though most of it was abandoned near start with the exception of the released skynet stuff.

http://www.sendspace.com/file/il31s8
Cookiebal
I thought you had left, but since I just saw you were active yesterday, I guess I can finally ask this

The file has expired, so I'm wondering if you still have a copy of project world eater, as I would love to utalize it
Thank you!
-ice
Cookiebal #156
Posted 19 September 2013 - 07:37 PM
Someone requested it recently and now I need it again so I might as well make it public, the download link contains the computer part of the world eater save. Parts of it might not work entirely correctly, but if you have really want to this is the best way to obtain the full set if the world eater project's entire code. It also has a bunch of my skynet related projects though most of it was abandoned near start with the exception of the released skynet stuff. http://www.sendspace.com/file/il31s8
Cookiebal I thought you had left, but since I just saw you were active yesterday, I guess I can finally ask this The file has expired, so I'm wondering if you still have a copy of project world eater, as I would love to utalize it Thank you! -ice

I still check around every once in a while. I also still read every comment posted on my videos, more often than I check these forums.

I couldn't find the files in a quick search, I might have them on another computer or on my external hard drive. Or perhaps on this laptop in some forgotten folder? I'll keep an eye out for it in any case.

I do have something else though, a never finished project, the Advanced Chicken Factory. Basically a giant factory with breeding rooms, chicken teleporters, incinerators, and a chicken transport system.
http://www.sendspace.com/file/won0qe
The factory itself is mostly build, however I kinda forgot about the project in the early stages of programming it.


Recently I've been busy with irl electronics stuff(like two weeks or so) and the Arduino microcontroller (2 days), which is programmable, like a tiny computer.


(This image is a screenshot of a short movie made with my phone.)
icecube45 #157
Posted 20 September 2013 - 12:47 AM
Someone requested it recently and now I need it again so I might as well make it public, the download link contains the computer part of the world eater save. Parts of it might not work entirely correctly, but if you have really want to this is the best way to obtain the full set if the world eater project's entire code. It also has a bunch of my skynet related projects though most of it was abandoned near start with the exception of the released skynet stuff. http://www.sendspace.com/file/il31s8
Cookiebal I thought you had left, but since I just saw you were active yesterday, I guess I can finally ask this The file has expired, so I'm wondering if you still have a copy of project world eater, as I would love to utalize it Thank you! -ice

I still check around every once in a while. I also still read every comment posted on my videos, more often than I check these forums.

I couldn't find the files in a quick search, I might have them on another computer or on my external hard drive. Or perhaps on this laptop in some forgotten folder? I'll keep an eye out for it in any case.

I do have something else though, a never finished project, the Advanced Chicken Factory. Basically a giant factory with breeding rooms, chicken teleporters, incinerators, and a chicken transport system.
http://www.sendspace.com/file/won0qe
The factory itself is mostly build, however I kinda forgot about the project in the early stages of programming it.


Recently I've been busy with irl electronics stuff(like two weeks or so) and the Arduino microcontroller (2 days), which is programmable, like a tiny computer.


(This image is a screenshot of a short movie made with my phone.)

Nice!
Thanks for the chicken farm,
Let me know if you find the files!
Cookiebal #158
Posted 09 April 2014 - 11:37 PM
Turtle Platform (More like turtle umbrella)

I made a tiny program using the pocket computer that, at the moment, makes a tiny turtle umbrella above your head that follows you around. The intention was a platform that you could use to get across chasms and such, but I kinda took the wrong approach so I got this instead. Feel free to improve it.

To use it you need a pocket computer with the platform and platformbroadcaster programs and a tiny swarm of turtles with the turtleplatform and the movement system stuff I used and slightly edited. Those turtles need their coordinates set too, you can do it manually in /movementsystem/pervar/ or run movesys and select either manual or locate, when it goes to the next step just reboot and start up turtleplatform.

When you start platform on the pocket computer you get an interface with currently two possible commands: platform (gathers the computers and gives them the offset for a platform above your head (max 9) and start, which starts the coordinates broadcaster that attracts the turtles.

Spoiler

Spoiler

Spoiler

Spoiler

Spoiler


Code: http://www.sendspace...file/d2g69s

There might be a bunch of bugs in it too, didn't test it much + half the code is two years old and my lua knowledge is rusty.

Some tips if you want to make something similar to my original intentions: Don't use offsets like I did, when I move the turtle below me wants to stay right below me and the turtle I just stepped on wants to go forward. Select an unused turtle each time you move to move with you, instead of all turtles.
Edited on 09 April 2014 - 09:45 PM
apemanzilla #159
Posted 10 April 2014 - 01:09 PM
Turtle Platform (More like turtle umbrella)

I made a tiny program using the pocket computer that, at the moment, makes a tiny turtle umbrella above your head that follows you around. The intention was a platform that you could use to get across chasms and such, but I kinda took the wrong approach so I got this instead. Feel free to improve it.

To use it you need a pocket computer with the platform and platformbroadcaster programs and a tiny swarm of turtles with the turtleplatform and the movement system stuff I used and slightly edited. Those turtles need their coordinates set too, you can do it manually in /movementsystem/pervar/ or run movesys and select either manual or locate, when it goes to the next step just reboot and start up turtleplatform.

When you start platform on the pocket computer you get an interface with currently two possible commands: platform (gathers the computers and gives them the offset for a platform above your head (max 9) and start, which starts the coordinates broadcaster that attracts the turtles.

Spoiler

Spoiler

Spoiler

Spoiler

Spoiler


Code: http://www.sendspace...file/d2g69s

There might be a bunch of bugs in it too, didn't test it much + half the code is two years old and my lua knowledge is rusty.

Some tips if you want to make something similar to my original intentions: Don't use offsets like I did, when I move the turtle below me wants to stay right below me and the turtle I just stepped on wants to go forward. Select an unused turtle each time you move to move with you, instead of all turtles.
He's back :o/> (I hope?)
MineFarms #160
Posted 17 June 2014 - 01:24 AM
Hey Cookiebal Your download link for the turtle platform is broken. Please Fix this
Cookiebal #161
Posted 21 June 2014 - 08:29 AM
Hey Cookiebal Your download link for the turtle platform is broken. Please Fix this

Here you go: https://www.sendspace.com/file/qow1tm