Posted 08 December 2012 - 11:29 AM
HAHA COMPLETE! i tried removing the quotes around the key i wanted pressed and it worked!
function main()
local sSide = "back" --side monitor is on
local mon = peripheral.wrap(sSide)
if not mon then
print("No monitor on ", sSide)
return
elseif mon then
main2()
end
end
function main2()
local serverID = 0 -- computer connecting to sever
local sSide = "back" --monitor side again
local clear = "clear" -- command to clear screen
local command = "command" -- command to be able to run other programs, will send you to function command()
local music = "music" -- to turn on music in the disk drive connected
local drive = "right" -- side drive is on
local mon = peripheral.wrap("back")
mon.setCursorPos(1,1)
term.redirect(mon)
while true do
rednet.open("left") -- change to side modem is on
event, id, msg, param1 = os.pullEvent()
if event == "rednet_message" then
if id == serverID then
if msg == clear then
mon.clear()
mon.setCursorPos(1,1)
elseif msg == command then
rom()
elseif msg == music then
disk.playAudio(drive)
else
print(msg)
end
end
elseif event == "char" and param1 == r then
os.reboot()
end
end
end
function rom()
local serverID = 0 -- again the computer connecting
local exit = "exit" -- what you want to go back to putting text on the monitor
while true do
local id, msg = rednet.receive()
if id == serverID then
if msg == exit then
main2()
else shell.run(msg)
end
end
end
end
main()