Noob needing help with computercraft.

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Darque77

New Member
Jul 29, 2019
4
0
0
I have been looking for computercraft tutorials that can explain what im looking for but I haven't had any luck so I thought I would ask if anyone here is decent with computercraft. I would like to learn computercraft but it is soo confusing.

I am designing a train station for a private server (few friends) and trying to make a computer react to redstone signals that it recieves and in turn displaying on a monitor different text for a different color redstone signal (from redpower). For example: When the blue wire is activated the computer says something like "Blue Line: Ocean Station", and when yellow is activated it says something like "Yellow Line: Desert Station" and so on. The computer would say "Welcome" if there were no signals activated.

Anyone able to help? If someone could even direct me to a simple tutorial that could help would be appreciated. Thanks in advance. And be gentle :p
 

Bomb Bloke

New Member
Jul 29, 2019
612
0
0
It'd help to know what you're already familiar with in terms of programming. Are you already up on functions, variables and whatnot?
 

RedBoss

New Member
Jul 29, 2019
3,300
0
0
I don't know of any pure tutorials but the computercraft forums would probably be a better source. Look them up, its all dedicated to computercraft.
 

tompy97

New Member
Jul 29, 2019
85
0
0
You can use this:
colors.test (redstone.getBundledInput("back"), colors.blue)
It will return true if the blue colour connected to the back of the computer is on.

You can then combine that with the monitors:

m = peripheral.wrap("side monitor is on")
if colors.test (redstone.getBundledInput("back"), colors.blue) then
m.write("Blue line: ocean station")
elseif colors.test(redstone.getBundledInput("back"), colors.yellow) then
m.write("Yellow line: dessert station")
elseif etc etc
 

Darque77

New Member
Jul 29, 2019
4
0
0
I have just started on computercraft and watched a couple tutorials, but havent had a chance to really play with it in a test world. And I checked the computercraft forums but didnt really find anything (that was easy to understand anyway lol) for what I was looking for. I also registered to ask this question there but for some reason it wouldn't let me start a new topic, so I asked here :)
 

tompy97

New Member
Jul 29, 2019
85
0
0
Yeh, the computercraft forums don't allow brand new members to start new topics straight away. There is a topic on the 'ask a pro' subforum where you can submit your question though, its stickied to the top.
 

Darque77

New Member
Jul 29, 2019
4
0
0
Ahh. I was looking for something like that but must have skimmed right over it... getting too sleepy to function right lol
 

VikeStep

New Member
Jul 29, 2019
1,117
0
0
Do you know how to create a program? choose the name and go
Code:
edit name
replacing name with the name of the program

this is the first step, next we need to figure out how the build is being set up. I recommend feeding all the different coloured cables into a bundled cable which then leads into the front a computer
then behind that computer place a monitor of whatever size you want it to be facing the opposite way to the computer

the code could be as follows, remember anything followed by two dashes is a comment and is ignored by the computer so you can leave it in there if you want to change it later
Code:
mon = peripheral.wrap("back") -- this will link the monitor to the computer
while true do -- This will make the code below loop forever
  if colors.test(redstone.getBundledInput("front"), colors.blue) == true then -- this will do the following if blue is on
    mon.setCursorPos(1,1) -- places cursor on the first line
    mon.clearLine() -- removes anything on the first line
    mon.write("Blue line: Ready") -- writes the following on the first line
  else -- if blue isn't on then it does the following
    mon.setCursorPos(1,1)
    mon.clearLine()
    mon.write("Blue line: Not Ready")
  end -- ends the if statement
  if colors.test(redstone.getBundledInput("front"), colors.yellow) == true then -- does same as above but with yellow
    mon.setCursorPos(1,2) -- puts the cursor on the second line
    mon.clearLine()
    mon.write("Yellow line: Ready")
  else
    mon.setCursorPos(1,2)
    mon.clearLine()
    mon.write("Yellow line: Not Ready")
  end -- repeat the above if you want more colours
  if redstone.getInput("front") == false then -- this will do the following if there is no redstone being sent
    mon.clear() -- this clears the whole screen and not one line
    mon.write("Welcome") -- prints welcome
  end
sleep(1) -- this makes it wait a second each time so that its not too laggy
end

EDIT: just noticed tompy's version, well its here if you want haha
 

Hydra

New Member
Jul 29, 2019
1,869
0
0
You need to learn lua programming and that takes quite some time if you havent done any programming before. You cant really go and ask for tips untill you've mastered the basics.
 

AliveGhost

New Member
Jul 29, 2019
167
0
0
Check out direwolf's tutorials. They are brilliant!

Sent from my HTC Desire X using Tapatalk 2