Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- find_monitor_colors.lua
- local monitor = peripheral.wrap("monitor_0") -- Ersätt om ditt namn är annorlunda
- if not monitor then error("Monitor hittades inte!") end
- monitor.clear()
- monitor.setTextScale(0.75)
- monitor.setBackgroundColor(0x8000) -- Din svarta bakgrund
- monitor.setCursorPos(1,1)
- monitor.setTextColor(0x1) -- Din vita text
- monitor.write("Hitta farger for din monitor:")
- local x_pos = 1
- local y_pos = 3
- -- Testa 16-bitars bitmaskvärden (2^0 till 2^15) som är vanliga i äldre CC
- for i = 0, 15 do
- local color_id = 2^i
- monitor.setCursorPos(x_pos, y_pos)
- monitor.setTextColor(color_id)
- monitor.write(string.format("ID 0x%X ", color_id))
- x_pos = x_pos + 12 -- Flytta till nästa kolumn
- if x_pos > monitor.getWidth() - 12 then -- Om för långt, gå till nästa rad
- x_pos = 1
- y_pos = y_pos + 1
- end
- end
- -- Testa sekventiella ID:n 0-15 också, för säkerhets skull
- monitor.setCursorPos(1, y_pos + 2)
- monitor.setTextColor(0x1) -- Vit
- monitor.write("Sekventiella ID:n 0-15:")
- x_pos = 1
- y_pos = y_pos + 3
- for i = 0, 15 do
- monitor.setCursorPos(x_pos, y_pos)
- monitor.setTextColor(i)
- monitor.write(string.format("ID %d ", i))
- x_pos = x_pos + 8 -- Flytta till nästa kolumn
- if x_pos > monitor.getWidth() - 8 then
- x_pos = 1
- y_pos = y_pos + 1
- end
- end
- print("Test klart. Titta pa monitorn for farg-ID:n.")
Advertisement
Add Comment
Please, Sign In to add comment