Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local link = "wget -f https://pastebin.com/raw/VFjeDZHF exp.lua"
- local robot = require("robot")
- local term = require("term")
- local computer = require("computer")
- local component = require("component")
- local sides = require("sides")
- local keyboard = require("keyboard")
- robot.select(1);
- robot.swing();
- lastExp = 0
- local function printStuff()
- local double expdouble = component.experience.level()
- exp = string.format("%.4f",expdouble);
- local double diff = expdouble - lastExp;
- lastExp = expdouble;
- diffExp = string.format("%.8f",diff);
- term.clear();
- print("I have " .. exp .. " Exp.\nThats " .. diffExp .. " more than last time.");
- robot.turnRight();
- component.sign.setValue("I have\n" .. exp .. " Exp.\n(+" .. diffExp .. ")");
- robot.turnLeft();
- end
- local function errorStuff(err)
- print(err);
- end
- local function updateStuff()
- error = xpcall(printStuff, errorStuff);
- while (error == false) do
- os.sleep(1);
- error = xpcall(printStuff, errorStuff);
- end
- end
- local function interruptStuff()
- if keyboard.isKeyDown(keyboard.keys.c) and keyboard.isControlDown() then
- os.exit();
- end
- end
- local function doStuff()
- local counter = 0;
- local maxCounter = 100;
- while (counter < maxCounter) do
- counter = counter + 1;
- robot.place();
- interruptStuff();
- robot.swing();
- end
- end
- while true do
- updateStuff()
- doStuff()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement