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

Tekkit Classic Fame Elevator

Started by shamefulChris, 13 June 2015 - 10:13 PM
shamefulChris #1
Posted 14 June 2015 - 12:13 AM
ok, so i am making a frame elvator to be controlled by 6 computers, while conveluted it has to be done this way. I am kind of a newbie at computer craft and wrote some of the program, but i can't seem to get it to work at all. Below is my code, if anyone could help me out that would be much appriciated.

local side = "back"

function pulse(color, amount, length)
for i = 1, amound do
rs.setBundledOutput(side, color)
os.sleep(length)
rs.setBundledOutput(side, 0)
os.sleep(length)
end
end

local floor = 0

if rs.getBundledInput("top", colors.blue) then
floor = 1
end
if rs.getBundledInput("top", colors.red) then
floor = 2
end
if rs.getBundledInput("top", colors.white) then
floor = 3
end
if rs.getBundledInput("top", colors.lime) then
floor = 4
end
if rs.getBundledInput("top", colors.yellow) then
floor = 5
end
if rs.getBundledInput("top", colors.orange) then
floor = b
end

while true do
term.clear()
term.setCursorPos(1,1)
print("Please Enter Call or a floor number B-5")
write("Input: ")
local input = read()
if floor == 1 and input == call then
pulse(8, 0, 0)
end
if floor == 2 and input == call then
pulse(8, 6, .4)
end
if floor == 3 and input == call then
pulse(8, 12, .4)
end
if floor == 3 and input == call then
pulse(8, 18, .4)
end
if floor == 4 and input == call then
pulse(8, 24, .4)
end
if floor == 5 and input == call then
pulse(8, 30, .4)
end
if floor == b and input == call then
pulse(4, 6, .4)
end
if input == b then
pulse(8, 6, .4)
end
if input == 1 then
pulse(0, 0, 0)
end
if input == 2 then
pulse(4, 6, .4)
end
if input == 3 then
pulse(4, 12, .4)
end
if input == 4 then
pulse(4, 18, .4)
end
if input == 5 then
pulse(4, 24, .4)
end
end



Thanks
ShamefulChris
Dustmuz #2
Posted 14 June 2015 - 12:57 AM
first off.. you can put your code in codetags :)/>

line 4: for i = 1, amound do
you dont spell amount as you do in your statement of the function
shamefulChris #3
Posted 14 June 2015 - 02:29 AM
sorry, not good with html, so i dont know codetags and fixed the miss spelling in the program and it still doesnt work.
KingofGamesYami #4
Posted 14 June 2015 - 03:42 AM
Code tags are BBC, not HTML. Besides, I'm fairly certain the forums doesn't allow HTML formatting.

Anyway, code tags are simple:

[code]code here[/code]

Result:

code here

Alternatively, you could put your program on pastebin, as it's pretty long.

Also, please describe what you "can't get to work at all". Does it give an error, does the behavior vary from what you wanted, and if so, how.
Bomb Bloke #5
Posted 14 June 2015 - 04:25 AM
if rs.getBundledInput("top", colors.blue) then

I can tell you that's not how you use rs.getBundledInput(). That expects one parameter, and returns a combined value indicating all the colours that're in use.

You'd instead want to use rs.testBundledInput().

Also bear in mind that the type of cables you can use varies depending on your mod versions. Beats me what you've got there, but if your bundled cables are from RedPower, they should do just fine.
shamefulChris #6
Posted 14 June 2015 - 05:51 AM
i changed the code to use rs.testBundledInput() and the programs seems to be working as intended. Thank you for your help.

One last thing, because someone else mentioned it. I realize the code is pretty long, If anyone has any recomendations on how to shorten it or clean it up a bit,

Thanks