Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modules = peripheral.wrap("back")
- local tVar = {}
- tVar.owner = "SkyCrafter0"
- tVar.afk = false
- modules.capture("^s/")
- local function split(inputstr,sep)
- sep = sep or "%s"
- local t = {}
- for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do table.insert(t, str) end
- return t
- end
- local function contains(t, value)
- for i = 1, #t do
- if t[i] == value then
- return true
- end
- end
- return false
- end
- local function main()
- while true do
- local _, message, capture, player, uuid = os.pullEvent("chat_capture")
- --print(player .. " said " .. message)
- local cmd = split(message,"/")
- local command = cmd[2]
- if player == tVar.owner and command == "afk" then
- if cmd[3] == "on" then
- tVar.afk = true
- print("AntiAFK On")
- modules.tell("AntiAFK On")
- elseif cmd[3] == "off" then
- tVar.afk = false
- print("AntiAFK Off")
- modules.tell("AntiAFK Off")
- end
- elseif player == tVar.owner and command == "scan" then
- print("Scanning for " .. cmd[3])
- local tScan = modules.scan()
- local oX,oY,oZ = 0,0,0
- local pX,pY,pZ = gps.locate()
- for i=1, #tScan do
- if tScan[i].name == cmd[3] then
- oX,oY,oZ = tScan[i].x,tScan[i].y,tScan[i].z
- end
- end
- print("Local offset: ", oX,oY,oZ)
- local rX,rY,rZ = pX+oX,pY+oY,pZ+oZ
- if rX == pX and rY == pY and rZ == pZ then
- modules.tell("Block not found")
- print("Block not found")
- else
- modules.tell("The block is at " .. tostring(rX) .. ", " .. tostring(rY) .. ", " .. tostring(rZ))
- print("Real Location: ", rX,rY,rZ)
- end
- elseif player == tVar.owner and command == "view" then
- if tVar[cmd[3]] ~= nil then
- local var = tVar[cmd[3]]
- print("Variable " .. cmd[3])
- modules.tell("Variable " .. tostring(var))
- print("Type: " .. type(var))
- modules.tell("Type: " .. type(var))
- if type(var) == "bool" then
- print("State: " .. tostring(var))
- modules.tell("State: " .. tostring(var))
- elseif type(var) == "string" then
- print("Contents: " .. tostring(var))
- modules.tell("Contents: " .. tostring(var))
- elseif type(var) == "number" then
- print("Value: " .. tostring(var))
- modules.tell("Value: " .. tostring(var))
- elseif type(var) == "table" then
- print("Contents: <NO_TBL_PRINT>")
- modules.tell("Contents:")
- local contents = textutils.serialise(var)
- modules.tell(contents)
- end
- else
- print("Variable not found")
- modules.tell("Variable not found")
- end
- end
- end
- end
- local function doJump()
- while true do
- if tVar.afk then
- modules.launch(0,-90,4)
- end
- sleep(120)
- end
- end
- parallel.waitForAny(main,doJump)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement