I'm having troubles getting a program to loop. I want these two pastebins to switch between each other (
http://pastebin.com/itU4Uf4P and
http://pastebin.com/fVJe04E4). This is the code I was using to display it on the monitor.
shell.run("Rules")
sleep(5)
shell.run("Banned")
end
return
I am going to assume that you meant to put a while true do loop above the shell.run("Rules") in that case what is happening is you are writing the information from rules, sleeping 5 seconds writing the stuff from banned and then immediately overwriting it with the stuff from rules again. You would need to put another sleep after the shell.run("Banned")
If you are in fact using a while true do loop that return will never be reached, and is not needed.
example:
while true do
shell.run("Rules")
sleep(5)
shell.run("Banned")
sleep(5)
end
I personally do not like using shell.run when it is unneeded, so I would do something more like this
example
mon = peripheral.wrap("left")
function Banned()
mon.clear()
mon.setTextScale(1)
mon.setCursorPos(5,1)
mon.write("Banned Items: ")
mon.setCursorPos(2,2)
mon.write("1. Nuke")
mon.setCursorPos(2,3)
mon.write("2. Industrial TNT")
mon.setCursorPos(2,4)
mon.write("3. Nova Catalyst")
mon.setCursorPos(2,5)
mon.write("4. Nova Cataclysm")
mon.setCursorPos(2,6)
mon.write("5. Destruction Catalyst")
mon.setCursorPos(2,7)
mon.write("6. Catalytic Lens")
mon.setCursorPos(2,8)
mon.write("7. Cart Dispenser")
mon.setCursorPos(2,9)
mon.write("8. Chest Cart, Tank Cart, Work Cart")
mon.setCursorPos(2,10)
mon.write("9. Wireless Tracker")
mon.setCursorPos(2,11)
mon.write("10. Harvest Goddess Banned ")
mon.setCursorPos(2,12)
mon.write("(creates massive lag when used to make emc farms)")
mon.setCursorPos(2,13)
mon.write("11. Mining Laser")
mon.setCursorPos(5,15)
mon.write("Uncraftable Items:")
mon.setCursorPos(2,16)
mon.write("1. All collectors (Can buy from adminshop or other players)")
mon.setCursorPos(2,17)
mon.write("2. World Anchor (Can buy from adminshop or other players)")
end
function Rules()
mon.clear()
mon.setTextScale(1)
mon.setCursorPos(5,1)
mon.write("Banned Items: ")
mon.setCursorPos(2,2)
mon.write("1. Nuke")
mon.setCursorPos(2,3)
mon.write("2. Industrial TNT")
mon.setCursorPos(2,4)
mon.write("3. Nova Catalyst")
mon.setCursorPos(2,5)
mon.write("4. Nova Cataclysm")
mon.setCursorPos(2,6)
mon.write("5. Destruction Catalyst")
mon.setCursorPos(2,7)
mon.write("6. Catalytic Lens")
mon.setCursorPos(2,8)
mon.write("7. Cart Dispenser")
mon.setCursorPos(2,9)
mon.write("8. Chest Cart, Tank Cart, Work Cart")
mon.setCursorPos(2,10)
mon.write("9. Wireless Tracker")
mon.setCursorPos(2,11)
mon.write("10. Harvest Goddess Banned ")
mon.setCursorPos(2,12)
mon.write("(creates massive lag when used to make emc farms)")
mon.setCursorPos(2,13)
mon.write("11. Mining Laser")
mon.setCursorPos(5,15)
mon.write("Uncraftable Items:")
mon.setCursorPos(2,16)
mon.write("1. All collectors (Can buy from adminshop or other players)")
mon.setCursorPos(2,17)
mon.write("2. World Anchor (Can buy from adminshop or other players)")
end
while true do
Rules()
sleep(5)
Banned(5)
sleep(5)
end