Posted 01 March 2017 - 09:44 PM
Hey Guys,
it's been a while but I'm finally motivated again so I continued programming on my Strip-mining program, which takes all ores with it aswell. Full code: http://pastebin.com/fptxKN9n
But I got 2 Problems, that I couldn't solve after hours of work, the following one and another that I will post seperatly (http://www.computerc...ut-never-after/).
So, I'm working on a menu structure for my program and I have a table defining the y-axis where stuff gets written.
So, when for example the fuellevel is set to infinity then every other line on that page can go 1 line up.
The code doesn't throw an error but the function simply seems not to work because everything else just prints at its normal line and the "deleted line" just stays clear.
If there is anything not clear feel free to ask me, if I made misleading spelling or grammar mistakes comment them aswell, I am german and don't speak the best english :)/>
Thanks in advance,
Bruno
it's been a while but I'm finally motivated again so I continued programming on my Strip-mining program, which takes all ores with it aswell. Full code: http://pastebin.com/fptxKN9n
But I got 2 Problems, that I couldn't solve after hours of work, the following one and another that I will post seperatly (http://www.computerc...ut-never-after/).
So, I'm working on a menu structure for my program and I have a table defining the y-axis where stuff gets written.
So, when for example the fuellevel is set to infinity then every other line on that page can go 1 line up.
objects = {["1"] = 1, ["2"] = 2, ["3"] = 3, ["4"] = 4, ["5"] = 5, ["6"] = 6, ["7"] = 7, ["8"] = 8, ["9"] = 9, ["10"] = 10, ["11"] = 11, ["12"] = 12, ["13"] = 13}
the table (I gave the variables this stupid string names because I was hoping it could fix it, but obviously didn't, so don't get confused)
function MoveObjects(deleted)
for k, v in ipairs(objects) do
if tonumber(k) > deleted and k < 12 then --every line after the deleted goes 1 up, except the last 2 because they are fixed
v = v - 1
end
end
end
the function that should move every Line up
if turtle.getFuelLevel ~= "infinity" then
printLeft("Fuellevel:", objects["3"])
if FuelLevel >= neededFuel*1.1 then
Fuellevel = "perfect"
elseif FuelLevel >= neededFuel then
Fuellevel = "ready"
elseif FuelLevel > neededFuel*0.8 then
Fuellevel = "risky"
else
Fuellevel = "low"
printCentered("WARNING!!!", objects["3"])
end
if help[1] == false then
help[1] = FuelLevel
end
if Color() then
if Fuellevel == "perfect" then
term.setBackgroundColor(colors.lime)
elseif Fuellevel == "ready" or Fuellevel == "risky" then
term.setBackgroundColor(colors.yellow)
elseif Fuellevel == "low" then
term.setBackgroundColor(colors.red)
end
printRight(FuelLevel.."/"..neededFuel, objects["3"])
term.setBackgroundColor(colors.black)
else
if Fuellevel == "perfect" then
printRight("+ "..FuelLevel.."/"..neededFuel, objects["3"])
elseif Fuellevel == "ready" or Fuellevel == "risky" then
printRight("+/- "..FuelLevel.."/"..neededFuel, objects["3"])
elseif Fuellevel == "low" then
printRight("- "..FuelLevel.."/"..neededFuel, objects["3"])
end
end
else
MoveObjects(3) <---------------------------------
end
example where this function gets called (ignore the rest of the code, its ugly :P/> )The code doesn't throw an error but the function simply seems not to work because everything else just prints at its normal line and the "deleted line" just stays clear.
If there is anything not clear feel free to ask me, if I made misleading spelling or grammar mistakes comment them aswell, I am german and don't speak the best english :)/>
Thanks in advance,
Bruno
Edited on 02 March 2017 - 03:01 PM