This Is A Code To Make Monitors Wireless Can You correct It For Me?
Wireless Monitor Changer
*******************************
Server/Main PC:
=============================================
print("Wireless Monitor Editor By Musicgack")
rednet.open("back")
while true do
sleep(0.5)
monitortext = read()
rednet.broadcast(monitortext)
end
===============================================
PC With The Monitor ("Client")
===============================================
mon.write("This Software Is Made By Musicgack")
print("This Software Is Made By Musicgack")
sleep(5)
mon.clear()
term.clear()
rednet.open("back")
while true do
sleep(0.5)
id, msg = rednet.recieve()
monitortext = rednet.recieve()
mon.write(monitortext)
if msg = "clear" and id = "10" then
mon.clear()
end
if msg = "shutdown" and id = "10" then
mon.clear()
os.shutdown()
end
if msg = "font5" then
mon.setfontsize(5)
end
if msg = "font4" then
mon.setfontsize(4)
end
if msg = "font3" then
mon.setfontsize(3)
end
if msg = "font2" then
mon.setfontsize(2)
end
if msg = "font1" then
mon.setfontsize(1)
end
if msg = "nextline$" then
mon.nextline()
end
if msg = "restart" then
mon.setCursorPos(1,1)
end
if msg = "commands" then
mon.clear()
mon.setCursorPos(1,1)
mon.write("Commands")
mon.write("===========")
mon.write("font1 > font5 -Changes Font Size")
mon.write("clear -Clears The Monitor")
mon.write("nextline$ -Goes To The Next Line")
mon.write("shutdown -Shutdown The Computer")
mon.write("restart -Goes To 1st Line")
mon.write("Anything Else Will Go On The Screen")
mon.write("Clear The Screen Again =P")
end
end
=================================================
Can You Correct My Code? Monitor Changer
Started by musicgack, Jun 07 2012 11:51 PM
4 replies to this topic
#1
Posted 07 June 2012 - 11:51 PM
#2
Posted 08 June 2012 - 12:54 AM
You didn't tell us what your error was, or what you were doing when you got it.
Anyway, I know what it is. Remove "mon.write(monitortext)" from your code. Why did you code this in anyway? The variable monitortext is only used in one line of code. Change "mon.write(monitortext)" to "mon.write(msg)" and it'll work fine. There is also a better way to use an "if" statement by using "elseif" but I'll let you figure that one out. Also, remove the sleep statements and take out "and id = 10".
Last thing, when you are comparing two things with an "if" statement, you use 2 equals.
Anyway, I know what it is. Remove "mon.write(monitortext)" from your code. Why did you code this in anyway? The variable monitortext is only used in one line of code. Change "mon.write(monitortext)" to "mon.write(msg)" and it'll work fine. There is also a better way to use an "if" statement by using "elseif" but I'll let you figure that one out. Also, remove the sleep statements and take out "and id = 10".
Last thing, when you are comparing two things with an "if" statement, you use 2 equals.
local x = 0 while x == 0 do if x == 0 then x = 1 end end
#3
Posted 26 June 2012 - 06:50 AM
I dont get that D=, and anyways can you test it?
#4
Posted 26 June 2012 - 05:47 PM
You can test your own code.
I also don't see anything setting up the monitor on the other computer. Is this the complete code?
I also don't see anything setting up the monitor on the other computer. Is this the complete code?
#5
Posted 26 June 2012 - 06:29 PM
I don't have a clue about monitors or rednet but try putting mon.setFontSize(1,2,3,4,5) with the caps and if msg == whatever (you need 2 equal signs)
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











