Program error.
theoriginalbit 14 Jan 2013
ahhh ok... i suggest inverting the returns in value() then... have it return true, indicating it can mine it, and false indicating it can't... then when using value() do
if value() then dig() else somethingElse() end
detsuo04 14 Jan 2013
wait i take it back. it almost works. for some reasone it skips an ore occationaly
detsuo04 14 Jan 2013
it would have to be random. since the program only identifies slot 1 2 and 3 of its inv which has dirt stone and gravel.
im thinking its skiping a compare one one or more of its turns.
edit
it skips ores on its back and left side reletive to starting orientation.
im thinking its skiping a compare one one or more of its turns.
edit
it skips ores on its back and left side reletive to starting orientation.
theoriginalbit 14 Jan 2013
hmmm not too sure... I'll have a look in a minute...
also what with your random
inside your while loop, you don't need to localise that code... you can remove that do end statement...
also what with your random
do end
inside your while loop, you don't need to localise that code... you can remove that do end statement...
crazyguymgd 14 Jan 2013
In your walls function:
Thats a scenario I imagined that could cause this problem. There are probably plenty more.
To solve this, turn right when value() returns true and when it returns false. So you will at least always check every wall.
function walls() for j = 1,4 do print("value function") if value() then turtle.dig() rn (base, "ore collected at "..z.." ") else turtle.turnRight() end end endLets say there is an ore when j = 1, the value function will return true, you'll dig the ore, sit still, then j increments to 2. Then value will return false, you'll turn right, and j increments to 3. say there is another ore here (we're only on the second wall at this point). value will return true, you'll dig, and then j will increment to 4. Value returns false, you turn right, but now the for loop is done, walls() returns and you never actually check the back or left wall.
Thats a scenario I imagined that could cause this problem. There are probably plenty more.
To solve this, turn right when value() returns true and when it returns false. So you will at least always check every wall.
detsuo04 14 Jan 2013
TheOriginalBIT, on 14 January 2013 - 03:46 PM, said:
hmmm not too sure... I'll have a look in a minute...
also what with your random
inside your while loop, you don't need to localise that code... you can remove that do end statement...
also what with your random
do end
inside your while loop, you don't need to localise that code... you can remove that do end statement...
edit: i added a turn right command after it collects ore so that should fix that. thanks
while true do print("2") f = turtle.getFuelLevel() if f < z + 10 then rn (base , "Danger! fuel levels low.") turtle.select(16) turtle.refuel() z = turtle.getFuelLevel() if f < z + 10 then rn (base , "Insuficient Coal, Returning.") home() end
theoriginalbit 14 Jan 2013
detsuo04, on 14 January 2013 - 03:57 PM, said:
you meen here?
while true do print("2") f = turtle.getFuelLevel() if f < z + 10 then rn (base , "Danger! fuel levels low.") turtle.select(16) turtle.refuel() z = turtle.getFuelLevel() if f < z + 10 then rn (base , "Insuficient Coal, Returning.") home() end
crazyguymgd 14 Jan 2013
crazyguymgd 14 Jan 2013
detsuo04 14 Jan 2013
lol missingno attacks
it worked all opperations are good. still have to check the out of fuel operation though.
it worked all opperations are good. still have to check the out of fuel operation though.
detsuo04 15 Jan 2013
The results of my hard labor
Lil Cal and Lil Hal both running my program in tandom.
Thanks for all the help guys!!!
Lil Cal and Lil Hal both running my program in tandom.
Thanks for all the help guys!!!
theoriginalbit 15 Jan 2013
remiX 15 Jan 2013
detsuo04 15 Jan 2013
thats some cool stuff. i think i will however first i need to revuild my base deeper into the earth. thousands of spiders keep screaming at me through the roof and zombies keep knocking like sales guys....
im wrighting a program now to tunnel out a room with player imputed variabls for x y and z
edit:
and the code is done.there is a moment where lil hal mines x to the end and comes back then he goes up z and mines x again.. then oddly he skips his up z step and runs the middle x again. after that he comtinues up and finishes the program.
he re runs the x on z 2 for every y. weired. anyway here is the code.
fixed
im wrighting a program now to tunnel out a room with player imputed variabls for x y and z
edit:
and the code is done.
he re runs the x on z 2 for every y. weired. anyway here is the code.
fixed
rednet.open("right") print("Room clearing program") sleep(1) print("What is my base id: ") a = tonumber(read()) rn = rednet.send rn (a , "connection established") print ("what is the rooms length (forward)?") x = tonumber(read()) print ("ok. Now the width (right)?") y = tonumber(read()) print ("ok. And finaly the hight (up)?") z = tonumber(read()) rn (a , "the room will be "..x.." long,") rn (a , " "..y.." wide,") rn (a , "and "..z.." tall.") --======paramiters of room are set=======-- print ("Is the size right? ") b = read() if b ~= "yes" then os.shutdown() end f = turtle.getFuelLevel() rn (a , "fuel is "..f.." units.") need = (x*y*z) + x + y + z rn (a , "assignment needs "..need.." fuel") if f < need then rn (a , "incificient fuel for assignment") os.shutdown() end x2 = 1 y2 = 0 z2 = 1 done = 0 l = 0 while l == 0 do while y2 ~= y do while z2 ~= z do while x2 ~= x do turtle.dig() turtle.forward() x2 = x2 +1 end while x2 ~= 1 do turtle.back() x2 = x2 - 1 end if z2 ~= z then turtle.digUp() turtle.up() z2 = z2 + 1 end while x2 ~= x and z2 == z do turtle.dig() turtle.forward() x2 = x2 + 1 end while x2 ~= 1 and z2 == z do turtle.back() x2 = x2 - 1 end end while z2 ~= 1 do turtle.down() z2 = z2 - 1 end if y2 ~= y and l == 0 then turtle.turnRight() turtle.dig() turtle.forward() turtle.turnLeft() y2 = y2 + 1 end end l = 1 end