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

variables

Started by tysciman7, 03 April 2013 - 07:56 AM
tysciman7 #1
Posted 03 April 2013 - 09:56 AM
I cannot figure out my problem with this code. First of all i dont know how to make it simpiler for me and seconded the way im doing is not working
tesla1889 #2
Posted 03 April 2013 - 10:06 AM
you're setting all of those variables to the result of each of those function calls (nil).
if you want to make a function called Oon that would call
redstone.setOutput("bottom",true)
you would want
local function Oon()
redstone.setOutput("bottom",true)
end
and you'd call it using
Oon()
Lasere123456 #3
Posted 03 April 2013 - 10:07 AM
is this what you want?


function Oon()
rs.setOutput("bottom", true )
end

(do this for evry function you want to make)

function doorin()
Oon()
Ooff()
sp()
end
tesla1889 #4
Posted 03 April 2013 - 10:12 AM
because you at least made an effort at writing you're own program, the fixed code would be:
local function Oon()
redstone.setOutput("bottom",true)
end
local function Ooff()
redstone.setOutput("bottom",false)
end
local function Mon()
redstone.setOutput("top",true)
end

local function Moff()
redstone.setOutput("top",false)
end

local function Won()
redstone.setOutput("right",true)
end

local function Woff()
redstone.setOutput("right",false)
end

local function Bon()
redstone.setOutput("left",true)
end

local function Boff()
redstone.setOutput("left",false)
end
local function sp()
sleep(0.5)
end
function doorin()
Oon()
Ooff()
sp()
end

EDIT: what's with these function names btw?
tysciman7 #5
Posted 03 April 2013 - 10:24 AM
Thank you very much and the names are colors of the redpower wires i relize i can just use bundled but i couldnt figure out how to make that api any simpler so i had four wires and just put them on there on sides so O is orange W is White etc

this is for a redpower fallout version vault i am making
SuicidalSTDz #6
Posted 03 April 2013 - 11:07 AM
this is for a redpower fallout version vault i am making
Post some screenies when you're done! I love Fallout ^_^/>
tysciman7 #7
Posted 03 April 2013 - 03:32 PM
gotcha i will tomorrow when im officially done