Posted 06 May 2013 - 01:54 AM
Title: Town Online Player list Via monitor Help
I need help making this code more efficient and able to allow multiple computers to send data via rednet to a main computer that decodes the id and set's the player as online or offline using an advanced computer and changing their name colour as Red or Lime to indicate Offline or Online.
——————————————————-
–I found this code here: http://www.computerc...le-script-help/
– It's not mine but i wanted to add this to Ask a Pro because from the comment's i read, nothing seemed to help me.
I need help making this code more efficient and able to allow multiple computers to send data via rednet to a main computer that decodes the id and set's the player as online or offline using an advanced computer and changing their name colour as Red or Lime to indicate Offline or Online.
——————————————————-
function cls()
term.clear()
term.setCursorPos(1,1)
end
function startdisplay()
display = peripheral.wrap("top")
display.setTextScale(2)
display.clear()
display.setCursorPos(1,1)
end
function testbundleback()
cwhite = rs.testBundledInput("back", 1) -- white true = on False = off
corange = rs.testBundledInput("back", 2) -- orange
cmagenta = rs.testBundledInput("back", 4) -- magenta
clightBlue = rs.testBundledInput("back", 8) -- lightBlue
cyellow = rs.testBundledInput("back", 16) -- yellow
clime = rs.testBundledInput("back", 32) -- lime
cpink = rs.testBundledInput("back", 64) -- pink
cgrey = rs.testBundledInput("back", 128) -- grey
clightgrey = rs.testBundledInput("back", 256) -- light-grey
ccyan = rs.testBundledInput("back", 512) -- cyan
cpurple = rs.testBundledInput("back", 1024) -- purple
cblue = rs.testBundledInput("back", 2048) -- blue
cbrown = rs.testBundledInput("back", 4096) -- brown
cgreen = rs.testBundledInput("back", 8192) -- green
cred = rs.testBundledInput("back", 16384) -- red
cblack = rs.testBundledInput("back", 32768) -- black
end
for i=1,10 do
cls()
startdisplay()
testbundleback()
display.setCursorPos(1,1)
display.write("Player List")
display.write("---------------")
if cwhite == true then
display.setCursorPos(1,2)
display.setTextColour(colours.lime) -- turns color of monitor text lime to indicate online
display.write("<PlayerName>")
else
display.setCursorPos(1,2)
display.setTextColour(colours.red) -- turns colour of monitor text Red to indicate offline
display.write("<PlayerName>")
end
if corange == true then
display.setCursorPos(1,3)
display.setTextColour(colours.lime)
display.write("<PlayerName>")
else
display.setCursorPos(1,3)
display.setTextColour(colours.red)
display.write("<PlayerName>")
end
if cmagenta == true then -- Code from here to*
display.setCursorPos(1,4)
display.setTextColour(colours.lime)
display.write("<playername>")
else
display.setCursorPos(1,4)
display.setTextColour(colours.red)
display.write("<playername>")
end -- *Here represent's the section i want to make smaller.
-- This part is how i think it should be set to send a rednet signal to another computer to read the value
--rednet,open("side")
--if cmagenta == true then
--rednet.send("ID, value(a1,b1,c1 etc)")
--else
--rednet.send("ID, value(a0,b0,c0 etc.)") --The value will send, and the main computer wo
--end
--The value will send, and the main computer would take the code like
--rednet.receive("Id, value")
--if Id = ("ID") then
--end
--if ("value")== ("a1") then
--display.setCursorPos(1,4)
--display.setTextColour(colours.lime)
--display.write("<playername>")
--else
--if ("value") == ("a0") then
--display.setCursorPos(1,4)
--display.setTextColour(colours.red)
--display.write("<playername>")
--end
– I know most of the code in the – doesn't work but i think it makes a point of what im trying to accomplish, so if anyone can help me then that would be awesome!–I found this code here: http://www.computerc...le-script-help/
– It's not mine but i wanted to add this to Ask a Pro because from the comment's i read, nothing seemed to help me.