Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Hardware Effects Test Script
- -- Tests GPU resolution limits, RAM concurrency, and monitor API
- print("=== Hardware Effects Test ===")
- print("")
- -- Test 1: Check parallel API (RAM)
- print("--- RAM Test (Concurrent Tasks) ---")
- local maxTasks = parallel.getMaxConcurrent()
- print("Max concurrent tasks: " .. maxTasks)
- print("")
- -- Test 2: Find and test monitor
- print("--- Monitor Resolution Test ---")
- local monitor = peripheral.find("monitor")
- if monitor then
- -- Get current size
- local w, h = monitor.getSize()
- print("Current size: " .. w .. "x" .. h)
- -- Get max resolution from GPU
- local maxW, maxH = monitor.getMaxResolution()
- print("Max resolution (GPU limit): " .. maxW .. "x" .. maxH)
- -- Get current resolution
- local resW, resH = monitor.getResolution()
- print("Current resolution: " .. resW .. "x" .. resH)
- -- Try setting a custom resolution
- print("")
- print("Setting resolution to 40x20...")
- monitor.setResolution(40, 20)
- local newW, newH = monitor.getResolution()
- print("New resolution: " .. newW .. "x" .. newH)
- -- Test monitor display
- monitor.clear()
- monitor.setCursorPos(1, 1)
- monitor.setTextColor(colors.lime)
- monitor.write("Resolution Test")
- monitor.setCursorPos(1, 2)
- monitor.setTextColor(colors.white)
- monitor.write("Size: " .. newW .. "x" .. newH)
- -- Reset resolution
- print("Resetting resolution...")
- monitor.resetResolution()
- local resetW, resetH = monitor.getResolution()
- print("Reset resolution: " .. resetW .. "x" .. resetH)
- else
- print("No monitor found! Connect a monitor via cable.")
- end
- print("")
- -- Test 3: Storage capacity (HDD)
- print("--- Storage Test (HDD) ---")
- if fs.getCapacity then
- local capacity = fs.getCapacity()
- local used = fs.getUsed and fs.getUsed() or 0
- print("Storage capacity: " .. capacity .. " bytes")
- print("Storage used: " .. used .. " bytes")
- print("Storage free: " .. (capacity - used) .. " bytes")
- else
- print("Storage API not available")
- end
- print("")
- -- Test 4: Parallel task batching
- print("--- Parallel Task Batching Test ---")
- local taskCount = 0
- local function makeTask(id)
- return function()
- taskCount = taskCount + 1
- -- Simulate work
- sleep(0.1)
- end
- end
- -- Create more tasks than RAM allows
- local tasks = {}
- for i = 1, 6 do
- table.insert(tasks, makeTask(i))
- end
- print("Running 6 parallel tasks (RAM limit: " .. maxTasks .. ")...")
- parallel.waitForAll(table.unpack(tasks))
- print("Completed " .. taskCount .. " tasks")
- print("")
- -- Test 5: List all peripherals
- print("--- Connected Peripherals ---")
- local names = peripheral.getNames()
- if #names > 0 then
- for i, name in ipairs(names) do
- local pType = peripheral.getType(name)
- print(" " .. name .. " (" .. pType .. ")")
- end
- else
- print(" No peripherals connected")
- end
- print("")
- print("=== Test Complete ===")
Advertisement
Add Comment
Please, Sign In to add comment