here are the codes.
the semi-working updated code:
local bridge = peripheral.wrap("top") while true do local event, destination = os.pullEvent("chat_command") if destination == "radio" then bridge.clear() bridge.addText(6, 6, "You are now in the Radio Channel") bridge.addText(6, 15, "Please select a station: Station1, Station2, Off") local event, station = os.pullEvent("chat_command") if station == "Station1" then bridge.clear() bridge.addText(6, 6, "Please Select a Volume: 1-15") local event, volIn = os.pullEvent("chat_command") local volOut = tonumber(volIn) redstone.setOutput("back", false) redstone.setOutput("bottom", false) redstone.setAnalogOutput("back", volOut) bridge.clear() bridge.addText(6, 6, "You are Listening to") bridge.addText(6, 15, "Station1 Radio,") bridge.addText(6, 24, "Enjoy!") sleep(15) bridge.clear() end end local event, station = os.pullEvent("chat_command") if station == "Station2" then bridge.clear() bridge.addText(6, 6, "Please Select a Volume: 1-15") local event, volIn = os.pullEvent("chat_command") local volOut = tonumber(volIn) redstone.setOutput("back", false) redstone.setOutput("bottom", false) redstone.setAnalogOutput("bottom", volIn) bridge.clear() bridge.addText(6, 6, "You are Listening to") bridge.addText(6, 15, "Station2,") bridge.addText(6, 24, "Enjoy!") sleep(15) bridge.clear() end end local event, station = os.pullEvent("chat_command") if station == "Off" then bridge.clear() bridge.addText(6, 6, "Radio Shutting Off") redstone.setOutput("back", false) redstone.setOutput("bottom", false) sleep(10) bridge.clear() bridge.addText(6, 6, "Radio Off") sleep(5) bridge.clear() endand the working original:
local function use() print("Stations") print("Station1") print("station2") end local tArgs = { ... } if tArgs[1] == nul then print("Usage: <Station> <Volume>") print("Stations: Off, Station1, station2") print("Volume: 0-15") end local tArgs = { ... } if tArgs[1] == "Off" then redstone.setOutput("back", false) redstone.setOutput("bottom", false) print(" Shutting Off") print("Bye!") end local tArgs = { ... } local vol = tonumber(tArgs[2]) if tArgs[1] == "Station1" then redstone.setOutput("back", false) redstone.setOutput("bottom", false) redstone.setAnalogOutput("bottom", vol) print("You are Listening to") print("Station1 ") print("Enjoy!") end local tArgs = { ... } local vol = tonumber(tArgs[2]) if tArgs[1] == "station2" then redstone.setOutput("back", false) redstone.setOutput("bottom", false) redstone.setAnalogOutput("back", vol) print("You are Listening to") print("station2") print("Enjoy!") endthanks!