[ComputerCraft] Newbish Help needed

  • 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

ShneekeyTheLost

Too Much Free Time
Dec 8, 2012
3,728
3,004
333
Lost as always
Okay, so despite the fact that I used to do a bit of coding back in the day, Computercraft is kicking my backside.

I'm trying to write a program that will send pulses through the bundled cable attached in the back to a specific color, then after it has done that, send pulses to a different color. These colors are attached to Filters. They are helping me shift around non-stacking items. 24 of them to be precise.
Code:
-- This subprogram will pulse filter 24 times
-- in sequential order. This will transfer cooling
-- cells properly.
-- Bundled Color Code:
--  Orange = Filter on towers
--  Magenta = Filter on holding chests
for i = 1, 24 do
  rs.setBundledOutput("back", color.orange)
  sleep(0.1)
  rs.setBundledOutput("back", 0)
  sleep(0.5)
end
sleep(1)
for i = 1, 24 do
  rs.setBundledOutput("back", color.magenta)
  sleep(0.1)
  rs.setBundledOutput("back"), 0)
  sleep(0.1)
end

When I try to run the program, however, I end up with this:


Also, when I checked rom/apis I was shocked to discover that the redstone api is missing, as are several others.

So, I'm betting I made some newbish mistake here. What did I do wrong?
 

NTaylor

New Member
Jul 29, 2019
221
0
0
rs.setBundledOutput("back"), 0)

This string on line 17 you need to remove the bracket after "back", computer craft has a brilliant error system by reading the error you can pick up on what is wrong ergo where it says :17: that means the error is on line 17 and unexpected symbol means there is a symbol out of place, a pretty newbish mistake but tbh we all make them I am pretty bad with computercraft myself and sometimes forget to put do at the end of a for command.
 

ShneekeyTheLost

Too Much Free Time
Dec 8, 2012
3,728
3,004
333
Lost as always
rs.setBundledOutput("back"), 0)

This string on line 17 you need to remove the bracket after "back", computer craft has a brilliant error system by reading the error you can pick up on what is wrong ergo where it says :17: that means the error is on line 17 and unexpected symbol means there is a symbol out of place, a pretty newbish mistake but tbh we all make them I am pretty bad with computercraft myself and sometimes forget to put do at the end of a for command.

*headdesk*

Yep, forgot to desk check my work.

I also typo'd because it should be color*s*.<colorname> rather than color.<colorname>, but now I got it working just fine.

Now to set up my micro-cycle timer and I should be good to go.

In essence, the logic is:

Code:
for i=1, <number of micro-cycles per cycle> do
-- number of micro-cycles per cycle is a pre-defined number rather than a variable, although I could make a local variable to input here
   rs.setBundledOutput("back",  colors.white) 
   -- white is the redstone color that turns on the reactor
   Sleep(<micro-cycle duration>)
   -- micro-cycle duration pre-defined, not a variable, although I could always create a local variable to input here
   rs.setBundledOutput("back", 0)
   -- turns off reactor
   transfer
   -- the previous program I just got done debugging, swaps nearly empty cooling cells with fresh ones from the cooling tower
end