Maybe there's a better title than that I don't know.
First an explanation of the system:
I have 10 lvl 5 soul crystal spawners (playing FTB). The spawners can be turned off by supplying a redstone signal. I've set up a reciever at each spawner, and set up a transmitter for each reciever somewhere else.
From those recievers I have run bundled cable with various colors up to an advanced computer.
The computer startup program is basically just a bunch of lines saying that spawner xx is inactive.
Now I want to be able to write "cow" or whatever to turn on the cow farm, and have the text change color for the farm.
I've done this myself by just wrapping the monitor and changing the text color from red on inactive to green and write active.
Once the sleep timer has expired the program runs the startup script again so all spawners are listed as inactive again on the monitor.
The problems I'd like help with are the following:
Once I run a program I can't run others while it's running. I'd like to get some code (or help with coding failing that) that when I wrote "cow" it turns on the spawner and returns to the command prompt again while keeping the green Active state on the monitor. Then when I write "cow" again it will shut down the spawner and return to the red Inactive for the spawner. This should hopefully enable me to run multiple spawners at once.
This is the code I have for the startup script which lists all the spawners as inactive:
monitor = peripheral.wrap("top")
monitor.clear()
monitor.setTextColor(colors.white)
monitor.setCursorPos(1, 1)
monitor.write("Cow Farm:")
monitor.setTextColor(colors.red)
monitor.CursorPos(20, 1)
monitor.write("Inactive")
monitor.setTextColor(colors.white)
monitor.setCursorPos(1, 2)
monitor.write("Spider Farm:")
monitor.setTextColor(colors.red)
monitor.CursorPos(20, 2)
monitor.write("Inactive")
monitor.setTextColor(colors.white)
monitor.setCursorPos(1, 3)
monitor.write("Skeleton Farm:")
monitor.setTextColor(colors.red)
monitor.CursorPos(20, 3)
monitor.write("Inactive")
monitor.setTextColor(colors.white)
monitor.setCursorPos(1, 4)
monitor.write("Endermen Farm:")
monitor.setTextColor(colors.red)
monitor.CursorPos(20, 4)
monitor.write("Inactive")
monitor.setTextColor(colors.white)
monitor.setCursorPos(1, 5)
monitor.write("Pigmen Farm:")
monitor.setTextColor(colors.red)
monitor.CursorPos(20, 5)
monitor.write("Inactive")
monitor.setTextColor(colors.white)
monitor.setCursorPos(1, 6)
monitor.write("Blaze Farm:")
monitor.setTextColor(colors.red)
monitor.CursorPos(20, 6)
monitor.write("Inactive")
monitor.setTextColor(colors.white)
monitor.setCursorPos(1, 7)
monitor.write("Zombie Farm:")
monitor.setTextColor(colors.red)
monitor.CursorPos(20, 7)
monitor.write("Inactive")
monitor.setTextColor(colors.white)
monitor.setCursorPos(1, 8)
monitor.write("Creeper Farm:")
monitor.setTextColor(colors.red)
monitor.CursorPos(20, 8)
monitor.write("Inactive")
monitor.setTextColor(colors.white)
monitor.setCursorPos(1, 9)
monitor.write("Wither Skels Farm:")
monitor.setTextColor(colors.red)
monitor.CursorPos(20, 9)
monitor.write("Inactive")
monitor.setTextColor(colors.white)
monitor.setCursorPos(1, 10)
monitor.write("Slime")
monitor.setTextColor(colors.red)
monitor.CursorPos(20, 10)
monitor.write("Inactive")
This is the very simple code I wrote for turning the cow spawner on for 5 seconds and off again:
redstone.setBundledOutput("back", colors.blue)
sleep(5)
redstone.setBundledOutput("back", 0)
I of course put in a monitor.clear() and then change the red to green on the text color and text from inactive to active. I then just put a line telling the program to run the startup script at the end.These are the colors for the spawners:
Blue = Cow
Yellow = Spider
Red = Skeleton
Green = Endermen
White = Blaze
Purple = Pigmen
Grey = Zombie
Brown = Creeper
Lightblue = Slime
Orange = Wither Skeleton
I'm hoping someone will help me out :)/>
I'm hoping there's a better way to do it all than how I did it, and perhaps some sort of way for me not to write all the spawner states again and again for each program, so maybe the computer detects what is on and lists it as active and changes the text from inactive to active.
If there is something I didn't elaborate on which needs elaboration, then let me know and I'll do my best to explain.
Thanks in advance.