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

Need some help with my MFFS control code

Started by devillwithin, 10 July 2013 - 01:54 PM
devillwithin #1
Posted 10 July 2013 - 03:54 PM
Title: Need some help with my MFFS control code

Question:
I just started messing with computercraft and i have a lot of ideas with it.
But for starters i have this base


this is the main gate made with mffs (modular force field system)

over here is my main computer and the turtle sending the wireless signal



and the one receiving it


the codes for my turtles are simple and working one way or another
so i dont need help with those ^^

i want to be able to turn the mffs on/off from my house, from the inside of the gate
and through a player detector from the outside.
the player detector thing is still something i have to start coding it.
so let me try getting that to work myself.

i got 2 advanced monitors with the button api from direwolf20
and my own piece of (not working well) code.

my problem is that i cant get both advanced monitors to work at the same time
one screen displays the buttons as coded from the button api
but the other stays black
and i cant figure out why and i think i'm or missing a long piece of code
or i made some stupid mistake


currently i have dires button code edited like this:
pastebin get hq54Q6Xu button

and my own code:
pastebin get QFUBbxB3 mffsbuttons


one way or another thanks in advance for you time and help ^^
LBPHacker #2
Posted 10 July 2013 - 06:40 PM
Here it is (pastebin get csp26hfu mffscontroller). Everything is self-explaining, but ask if you don't think so.
devillwithin #3
Posted 11 July 2013 - 12:22 PM
oh wow you really just made the player detector to get working ^^ though i wanted to try it myself first :P/>

maybe i wasnt clear on the monitor thingy :P/>
i have 2 sets of monitors, one inside my house the other at the gate entrance ^^
and i cant get both to do exactly the same
LBPHacker #4
Posted 11 July 2013 - 03:19 PM
Okay, revision #2 (pastebin get iGd6t0X0 mffscontrol). What the program does now:
  • Supports two monitors (inner and outer)
  • Toggles the redstone output if the inner monitor gets touched or if the player detector detects a player with access to toggle the MFFS
  • Displays the status of the MFFS on both monitors
Believe me, this is the easiest way to do this. No need of making it more complicated.
devillwithin #5
Posted 11 July 2013 - 04:01 PM
hahaha thanks i just couldnt figure the 2 screens at a time thing out :P/> and i dont think il need any
more ways to turn it on/off for now :)/>
thanks mate i owe you one ^^

edit:
well both screens seem to turn on and show the green screen with the mffs on/off text but only the inner screen is
working, outermonitor isnt reacting to any inputs

player detector is working fine ^^
LBPHacker #6
Posted 11 July 2013 - 04:23 PM
The outer monitor isn't meant to be working (reacting to user input). The only way to get in is by identifying yourself on the player detector.
EDIT: Like I said, no need to make it more complicated.
devillwithin #7
Posted 11 July 2013 - 04:34 PM
hmmm okay too bad, as i walk into my base through player detector i want to shut the door behind with the screen
at the inside of my wall.

then as people come by to check out my place i wanted to open the mffs door by using the screen inside my house.
if its a no-go too bad but ofc id like to have it working that way ^^
LBPHacker #8
Posted 11 July 2013 - 04:40 PM
The screen inside the base DOES toggle the power of the MFFS (unless you forgot to configure the names of the peripherals at the top of the program).
devillwithin #9
Posted 11 July 2013 - 05:05 PM
yea but the outside isnt ^^ so when i walk into my base i have to get into my house first to close the door again
LBPHacker #10
Posted 11 July 2013 - 05:19 PM
There is the player detector outside, you can control the MFFS with that. But in case of misunderstanding (image):
Spoiler
devillwithin #11
Posted 11 July 2013 - 05:35 PM
this is the layout im talking about ^^
Spoiler

i miss redpower with it this would be so much easier, on the other hand this is more fun to figure out ^^
LBPHacker #12
Posted 11 July 2013 - 05:38 PM
Ah. I get it now. Line 53: Remove the right operand of the AND statement that checks if the monitor_touch came from the inner monitor. Pastebin updated (still pastebin get iGd6t0X0 mffscontrol).
devillwithin #13
Posted 11 July 2013 - 05:47 PM
That did the trick both screens working now, though the player detector isnt anymore….
LBPHacker #14
Posted 11 July 2013 - 06:12 PM
Did you download the updated version from pastebin?
devillwithin #15
Posted 11 July 2013 - 06:24 PM
ah im sorry, as i indeed re-downloaded the pastebin i forgot to edit the code again to made the
detector accept my username ^^

well everything is working fine now im glad this all worked out great
thank you very much for your help LBPHacker B)/>
LBPHacker #16
Posted 11 July 2013 - 06:28 PM
Hey, no prob. By the way, a normal (non-advanced) computer is capable of controlling advanced monitors, so you can use that advanced one somewhere else.