This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
dylanrhodes0's profile picture

Redpower Wire Management Program(Toggle)

Started by dylanrhodes0, 20 March 2014 - 09:16 PM
dylanrhodes0 #1
Posted 20 March 2014 - 10:16 PM
This is a program that I made not too long ago. It has been a work in progress and a lot of fun to do. I'm happy or share this with you in hope that you find it useful or inspire you to code yourself. I know that its not 100% with all of the possibilities that I could implement, but I have yet to find a bug in it. So it works! And I have yet to find anything else like it. So enjoy! =)

Here it is: http://pastebin.com/QxG3R33B

So, I'm going to try to explain as best I can the new code. First is what to do before use, and how to use.
Before:
There is a section with variables, in there is: name, side, and option.
-Name is your name, simple. Leave " " around it.
-Side is the side the bundled cable is connected to.
For each option you want you must add a line to the option array. The array looks like this:

   local option = {
   --{Name, wire color, 0}
   {"House Lights", colors.white, 0},
   }
The third line is what you need to make for each option. So if I wanted to add lets say, "Front Door", I would add this below the "House Lights":
{"Front Door", colors.red, 0}
. Giving me:
   local option = {
   --{Name, wire color, 0}
   {"House Lights", colors.white, 0},
   {"Front Door", colors.red, 0},
   }
So the name that will show in the menu, the wire color, and the variable used to tell if its on or off, default is 0.

How to use:
On the screen, if I had the option above, I would see this:
1 - House Lights [OFF] ON
2 - Front Door [OFF] ON
At the bottom it would ask me for my input. This is where you enter the NUMBER of what you want to toggle, and only the number. So to turn House Lights on, I type 1 and hit enter. *ON*. To turn off, 1, *OFF*. The brackets will move to whichever the current status is, so don't worry.
Edited on 11 May 2014 - 11:15 PM
Agoldfish #2
Posted 20 March 2014 - 10:20 PM
You should explain what it does in more detail.
"Menu Toggle Program" isn't too descriptive.
dylanrhodes0 #3
Posted 20 March 2014 - 10:35 PM
You should explain what it does in more detail.
"Menu Toggle Program" isn't too descriptive.
My apologies! >,< heh, I'll try to remember that next time. Hopefully what I have added is ok?
Edited on 20 March 2014 - 09:35 PM
ZeeSays #4
Posted 20 March 2014 - 10:56 PM
Is it supposed to be you type the number to toggle it on and off? If that is the case, it only toggles on whenever you type the number in.
dylanrhodes0 #5
Posted 23 March 2014 - 09:32 PM
Is it supposed to be you type the number to toggle it on and off? If that is the case, it only toggles on whenever you type the number in.
So "1" should turn the same thing on AND off.
ByteZz #6
Posted 24 March 2014 - 01:58 AM
That's a nice start to your program. I suggest you start adding hotkeys to do the work for you. For instance, if the player presses 'L' to switch lights the program detects it and toggles lights and that is the same for everything else :)/>
dylanrhodes0 #7
Posted 24 March 2014 - 02:11 AM
That's a nice start to your program. I suggest you start adding hotkeys to do the work for you. For instance, if the player presses 'L' to switch lights the program detects it and toggles lights and that is the same for everything else :)/>
I can't say I know exactly what you mean. "L" toggles ALL lights?

ATM there are three toggled outputs: One on the red wire, blue wire, and orange wire. The green is special, I'll get to that. 1 - red, 2 - orange, and 3 - blue. When the program starts they are all off. When the user types for instance, "1", it checks the state, kept in a variable, and turns it on. Now, the user can type "1" again, and when it checks the state, seeing that it is already on, it turns it off. If a user types "2", or "3", it will do exactly the same. By having all three states kept in a different var, this makes it so one can have "1" and "3" on, without messing with "2".

"4", or the green wire, is a pulse. It was made for a dispenser that shoots cake. Hence it didn't need to be toggled.

Hopefully this clears up a bit? Sorry for the holes I'm leaving >~<
unobtanium #8
Posted 24 March 2014 - 11:42 AM
You are able to change the title again with the "Use Full Editor" when editing your post ;D
Other then that it seems to be a solid simple program.
dylanrhodes0 #9
Posted 25 March 2014 - 01:44 AM
You are able to change the title again with the "Use Full Editor" when editing your post ;D
Other then that it seems to be a solid simple program.
>~> <~< this is my first topic/post, I'm sorry, still new. But thank you for the tip =^,^=
dylanrhodes0 #10
Posted 17 April 2014 - 05:10 AM
Updated: http://pastebin.com/YA6679wD added new feature "on" turns everything on, and "off" turns everything off. =^,^=
dylanrhodes0 #11
Posted 20 April 2014 - 06:55 AM
Fixed bug for turning an input off after all on. http://pastebin.com/QxG3R33B
RustyDagger #12
Posted 23 April 2014 - 06:03 AM
Your addcolors function seems to do absolutely nothing what is the point of it?

i'm looking at expanding this to add an auto off system after a time delay so that I cant accidentally leave farms running. I have already colored the text so its not painful on the eyes :D/>
dylanrhodes0 #13
Posted 10 May 2014 - 07:26 AM
Your addcolors function seems to do absolutely nothing what is the point of it?

i'm looking at expanding this to add an auto off system after a time delay so that I cant accidentally leave farms running. I have already colored the text so its not painful on the eyes :D/>

The add colors is used to turn get the number so it can turn all of the lights on. And the next step was to have the text be a different color on Adv. Computers. Then to have buttons, like what direwolf20 has made, to toggle.
dylanrhodes0 #14
Posted 15 May 2014 - 05:36 AM
UPDATE: After finals and school chaos I hope to be able to put quite a lot of time into the program. At the moment there is about 5 features I would like to add. My hope is to have a program that's even easier to use by not having the user edit the program itself to be able to use. Instead have a 'setup' section where the user can easily add their options. Along with this, allow one to change the options without having to leave the program, "in program editing". Next is taking RustyDagger's idea and giving a timer option so it can be used with engines or farms, thanks Rusty for the idea :)/>. Lastly is a separate version for advanced computers. To have colored text and buttons. These should hopefully keep me busy during the break, we'll see. I will try to keep this as up-to-date as I can. Thanks for the supports guys! ^_^/>
dylanrhodes0 #15
Posted 22 March 2016 - 12:26 AM
Alright…finally able to do a video about it to explain what it does and how to use. Also added a small thing. In that you can have things on be default by setting the third value, after colors.whatever, to 1. And when the program starts it will be on. On version 1.82. Hope to still add things others have suggested…just need to find the time….any contributions would be great! And I would be happy to give the proper credit for your contributions.

Toggle V1.82 http://pastebin.com/jsr5KUca
YouTube Video: https://www.youtube.com/watch?v=WAGQsmaKk8g
Edited on 21 March 2016 - 11:31 PM
FoxData #16
Posted 25 March 2016 - 10:00 PM
Anything that allows you to control it and poll back data is known as a scada system.
dylanrhodes0 #17
Posted 30 March 2016 - 05:34 AM
Anything that allows you to control it and poll back data is known as a scada system.

Thank you for the info. And this is 100% curiosity, but what prompted it? Just letting me know? Or…? I don't mean to sound rude, I am just asking. Glad to put a name to what is happening, and always happy learning new things coding. Just don't really know where it came from ^_^/>'. Sorry.