Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local channel = 8899 -- numéro de canal personnalisé
- local program_path = shell.getRunningProgram()
- print("The path to this program is: " .. program_path)
- mon = peripheral.find("monitor")
- mon.setBackgroundColor(colors.black)
- mon.clear()
- rednet.open("top")
- w,h = mon.getSize()
- if not w == 57 and not h == 38 then
- print("monitor required 3*3")
- else
- term.redirect(mon)
- mon.setTextScale(0.5)
- local function centerTextTop(text)
- mon.setCursorPos(math.floor(w/2-text:len()/2+.5), 1)
- mon.write(text)
- end
- local function centerTextBottom(text)
- mon.setCursorPos(math.floor(w/2-text:len()/2+.5), h)
- mon.write(text)
- end
- function printText(txt1, color1)
- local oldColor = term.getTextColor() -- sauvegarde de la couleur courante
- term.setTextColor(color1)
- print(txt1)
- term.setTextColor(oldColor) -- restauration de la couleur courante
- end
- function doubleTextColor(txt1, color1, txt2, color2)
- local oldColor = term.getTextColor()
- term.setTextColor(color1)
- term.write(txt1)
- term.setTextColor(color2)
- term.write(txt2)
- term.setTextColor(oldColor)
- end
- function centerDoubleTextTop(txt1, color1, txt2, color2)
- local text = txt1 .. txt2
- centerTextTop(text)
- local oldX, oldY = term.getCursorPos()
- term.setCursorPos(oldX - text:len(), oldY)
- doubleTextColor(txt1, color1, txt2, color2)
- end
- function centerDoubleTextBottom(txt1, color1, txt2, color2)
- local text = txt1 .. txt2
- centerTextBottom(text)
- local oldX, oldY = term.getCursorPos()
- term.setCursorPos(oldX - text:len(), oldY)
- doubleTextColor(txt1, color1, txt2, color2)
- end
- local Info = {}
- --mon.setPaletteColour(colors.blue, 0x018281) -- win 95/98
- while true do
- --mon.clear()
- --mon.setCursorPos(1,1)
- mon.setTextColor(colors.black)
- paintutils.drawFilledBox(1,1,57,1,colors.lightGray)
- paintutils.drawFilledBox(1,h-1,57,h,colors.lightGray)
- --centerTextTop("computer ID: "..os.getComputerID())
- --centerTextBottom("size: L x".. w .." : H x".. h)
- centerDoubleTextTop("computer ID: ", colors.black, ""..os.getComputerID(), colors.yellow)
- centerDoubleTextBottom("taille: ", colors.black, "L x".. w .." : H x".. h, colors.yellow)
- mon.setCursorPos(50, h)
- doubleTextColor(" V.",colors.black, "1.3.2",colors.yellow)
- --write(" V.1.3.2")
- paintutils.drawFilledBox(2,5,19,11,colors.cyan) --cyan
- paintutils.drawFilledBox(21,5,37,11,colors.white)
- paintutils.drawFilledBox(39,5,56,11,colors.yellow)
- paintutils.drawFilledBox(21,13,37,17,colors.purple)
- paintutils.drawFilledBox(2,19,56,35,colors.orange) -- 1.12.2
- --paintutils.drawFilledBox(2,35,56,19,colors.orange) -- 1.16.5
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.white)
- mon.setCursorPos(21,3)
- if (Info.Etat or "Waiting") ~= "In progress" then
- mon.setTextColor(colors.red)
- else
- mon.setTextColor(colors.green)
- end
- mon.clearLine()
- print("State: " ..(Info.Etat or "Waiting"))
- mon.setTextColor(colors.black)
- mon.setBackgroundColor(colors.cyan)
- Info.LigneEnCour = (Info.LigneEnCour or 0)
- mon.setCursorPos(3,6)
- print("Line: "..(Info.LigneEnCour or 0) .. "/"..(Info.ligneMax or 0))
- mon.setCursorPos(3,8)
- print("Column: " ..(Info.Colonne or 0) .. "/"..(Info.colonneMax or 0))
- mon.setCursorPos(3,10)
- print("Depth: " ..(Info.Profondeur or 0) .. "/" ..(Info.ProfondeurMax or 0))
- mon.setBackgroundColor(colors.white)
- mon.setTextColor(colors.black)
- mon.setCursorPos(22,6)
- mon.setTextColor(colors.blue)
- print("Cobalt: " ..(Info.Cobalt or 0))
- mon.setCursorPos(22,7)
- mon.setTextColor(colors.orange)
- print("Ardite: " ..(Info.Ardite or 0))
- mon.setCursorPos(22,8)
- mon.setTextColor(colors.brown)
- print("Debris: " ..(Info.Debris or 0))
- mon.setCursorPos(22,9)
- mon.setTextColor(colors.green)
- print("Vibranium: " ..(Info.Vibranium or 0))
- mon.setBackgroundColor(colors.purple)
- mon.setTextColor(colors.black)
- mon.setCursorPos(22,14)
- print(Info.Tourne or "I do nothing")
- mon.setCursorPos(22,16)
- print(Info.Descend or "I do nothing")
- mon.setBackgroundColor(colors.yellow)
- mon.setTextColor(colors.black)
- mon.setCursorPos(40,6)
- print("Lvl Fuel: " ..(Info.NivFuel or 0))
- mon.setCursorPos(40,8)
- print("Coal: " ..(Info.Charbon or 0))
- mon.setCursorPos(40,10)
- print("Mob: " ..(Info.Monstre or "No Mob"))
- local function centerTextX3(text)
- mon.setCursorPos(math.floor(w/2-text:len()/2+.5), 20)
- mon.setTextColor(colors.gray)
- mon.write(text)
- end
- mon.setBackgroundColor(colors.lightGray)
- centerTextX3(" Inventory ")
- -- mon.setBackgroundColor(colors.black)
- -- mon.setTextColor(colors.white)
- testtxt = "Empty"
- if Info.slot ~= nil then
- for i = 1,13 do
- mon.setBackgroundColor(colors.orange)
- mon.setTextColor(colors.black)
- mon.setCursorPos(4,21 + i)
- if Info.slot[i] ~= nil then
- -- if Info.slot[i].name == "minecraft:netherrack" then
- -- name = "netherrack"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "minecraft:blackstone" then
- -- name = "blackstone"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "mysticalagriculture:soulstone_cobble" then
- -- name = "soulstone_cobble"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "biomesoplenty:flesh" then
- -- name = "flesh"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "minecraft:nether_wart_block" then
- -- name = "nether_wart_block"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "silentgear:raw_crimson_iron" then
- -- name = "raw_crimson_iron"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "minecraft:obsidian" then
- -- name = "obsidian"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "tconstruct:cobalt_ore" then
- -- name = "cobalt"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "rftoolsbase:dimensionalshard" then
- -- name = "dimensionalshard"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "minecraft:gravel" then
- -- name = "gravel"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "minecraft:soul_sand" then
- -- name = "soul_sand"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "minecraft:flint" then
- -- name = "flint"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "minecraft:quartz" then
- -- name = "quartz"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "minecraft:shroomlight" then
- -- name = "shroomlight"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "minecraft:crimson_hyphae" then
- -- name = "crimson_hyphae"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "minecraft:gold_nugget" then
- -- name = "gold_nugget"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "minecraft:magma_block" then
- -- name = "magma_block"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "mysticalagriculture:inferium_essence" then
- -- name = "inferium_essence"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "mysticalagriculture:prosperity_shard" then
- -- name = "prosperity_shard"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "mysticalagriculture:soulium_dust" then
- -- name = "soulium_dust"
- -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- -- elseif Info.slot[i].name == "biomesoplenty:fleshchunk" then
- --else
- --print(i .. ". " .. Info.slot[i].name .. " x" .. Info.slot[i].count)
- --end
- local colonIndex = string.find(Info.slot[i].name, ":", 1, true)
- name = string.sub(Info.slot[i].name, colonIndex + 1)
- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
- else
- --print(i .. ".", testtxt) -- colorTextVide("vide")
- doubleTextColor(i .. ". ", colors.black, testtxt, colors.red)
- end
- -- print(Info.slot[1].name .. " x" .. Info.slot[1].count)
- -- print(Info.slot[2].name .. " x" .. Info.slot[2].count)
- -- print(Info.slot[3].name .. " x" .. Info.slot[3].count)
- -- for k,v in pairs(Info.slot) do
- -- for i,n in pairs(v) do
- -- print(i,n)
- -- end
- -- end
- end
- end
- mon.setBackgroundColor(colors.black)
- id,message = rednet.receive()
- Info = textutils.unserialise(message)
- -- local printerSide = "bottom" -- Remplacez "top" par le côté de votre imprimante
- -- local id, message = rednet.receive()
- -- local info = textutils.unserialize(message)
- -- -- Définition du texte à imprimer
- -- local text = "Tourne : " .. tostring(info.Tourne) .. "\n" ..
- -- "Descend : " .. tostring(info.Descend) .. "\n" ..
- -- "NivFuel : " .. tostring(info.NivFuel) .. "\n" ..
- -- "Monstre : " .. tostring(info.Monstre) .. "\n" ..
- -- "Cobalt : " .. tostring(info.Cobalt) .. "\n" ..
- -- "Ardite : " .. tostring(info.Ardite) .. "\n" ..
- -- "Vibranium : " .. tostring(info.Vibranium) .. "\n" ..
- -- "Debris : " .. tostring(info.Debris) .. "\n" ..
- -- "LigneEnCour : " .. tostring(info.LigneEnCour) .. "\n" ..
- -- "Colonne : " .. tostring(info.Colonne) .. "\n" ..
- -- "Profondeur : " .. tostring(info.Profondeur) .. "\n" ..
- -- "Etat : " .. tostring(info.Etat) .. "\n" ..
- -- "ProfondeurMax : " .. tostring(info.ProfondeurMax) .. "\n" ..
- -- "colonneMax : " .. tostring(info.colonneMax) .. "\n" ..
- -- "ligneMax : " .. tostring(info.ligneMax) .. "\n" ..
- -- "Charbon : " .. tostring(info.Charbon) .. "\n" ..
- -- "slot : " .. tostring(info.slot)
- -- -- Impression du texte
- -- local printer = peripheral.wrap(printerSide)
- -- printer.newPage()
- -- printer.setPageTitle("Info")
- -- printer.write(text)
- -- printer.endPage()
- --local senderId, message = rednet.receive(channel) -- recevoir les données envoyées sur le canal personnalisé
- --print("Données reçues de l'ordinateur "..senderId..":")
- --print(textutils.serialise(message)) -- afficher les données reçues
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement