9 posts
Posted 21 May 2014 - 05:17 PM
Hello Lyqyd, first off I would like to thank you again for not only creating the API, but also agreeing to help me in my endeavors to make a functioning program. Basically, what I am trying to do is to have my main computer(really the brain), which functions as my touchscreen, tell my receiving computer, which in this instance is the median for a sugarcane farm, to continuously execute my sugarcane farm command until I have returned my button to the inactive state. Of course this is truly just a baseline program so that I could modify it to function on other farms and machines that I plan to have running.
Below is the code I am using(Don't mock me for how terrible it is :P/> )
Main Comp-
http://pastebin.com/C1n4eQqvReceiving Comp-
http://pastebin.com/ZTbERRzNSorry if there is discrepancies in the code. I tried to "fiddle" with it but to no avail. I got frustrated and chucked it for the time being.
8543 posts
Posted 21 May 2014 - 05:52 PM
This is what I'd do for the main computer instead:
http://pastebin.com/PT6ycdWPNote that it doesn't try to wait for the status report from the farm constantly (as that will block the rest of the buttons from working), but will still listen for a "DONE" message and deactivate the button if it receives one. If you can't figure out the couple of changes you'd have to make to the farm's computer, let me know and I'll throw a quick version of that together. I also simplified your redstone toggling code.
9 posts
Posted 21 May 2014 - 06:15 PM
If you could, I would appreciate it. Sorry I am truly terrible with coding.
8543 posts
Posted 21 May 2014 - 06:26 PM
No worries. This is how I'd rearrange the farm script:
http://pastebin.com/u8qKad3JPlease feel free to ask all of the questions you have about either script. I'd like to help you understand all of what's going on in them rather than just throwing code at you.
9 posts
Posted 21 May 2014 - 06:33 PM
Could you explain to me how these events work and how I could use them to add more machines and builds to the main computer?
8543 posts
Posted 21 May 2014 - 06:37 PM
There is a
reasonably good tutorial that covers how events work. Take a read through that and see if it helps at all. Feel free to ask questions about it here or in that topic.
9 posts
Posted 21 May 2014 - 06:46 PM
And I could simply repeat the code under the "while true do" section at the bottom of the main computer?
8543 posts
Posted 21 May 2014 - 07:42 PM
That's the main loop of the program, so you'd want to edit more functionality into that loop rather than copy it below.