Posted 14 April 2013 - 11:45 PM
i tried to make a little program to make the redstone gates in my survival world cheaper and smaller but every time I try to tun this i get "bios:337: [string "redgates"]:14: ´=´ expected" here is the code
function ChooseGate(...)
Print("1=NotGate 2=AndGate 3=NandGate 4=OrGate 5=RedClock 6=XorGate 7=XnorGate")
Gate = io.read()
if Gate == 1 then
NotGate()
elseif Gate == 2 then
AndGate()
elseif Gate == 3 then
NandGate()
elseif Gate == 4 then
Orgate()
elseif Gate == 5 then
RedClock
elseif Gate == 6 then
XorGate()
elseif Gate == 7 then
XnorGate()
end
end
function redclock(...)
Print("RedClock")
Print("Ticks")
clockspeed = io.read()
clockspeedm = tonumber(clockspeed)
clockspeedm = clockspeedm/10
Print("Side")
side = io.read()
while true do
redstone.setOutput("left", true)
sleep(clockspeedm/2)
redstone.setOutput(side, false)
sleep(clockspeedm/2)
end
end
function AndGate(...)
Print("AndGate")
while true do
rightredstone = redstone.getInput("right")
leftredstone = redstone.getInput("left")
if rightredstone == true and leftredstone == true then
redstone.setOutput("back", true)
else
redstone.setOutput("back", false)
end
sleep(0.1)
end
end
function OrGate(...)
Print("OrGate")
while true do
rightredstone = redstone.getInput("right")
leftredstone = redstone.getInput("left")
if rightredstone == true or leftredstone == true then
redstone.setOutput("back", true)
else
redstone.setOutput("back", false)
end
sleep(0.1)
end
end
function XorGate(...)
Print("XorGate")
while true do
rightredstone = redstone.getInput("right")
leftredstone = redstone.getInput("left")
if rightredstone == true and leftredstone == false then
redstone.setOutput("back", true)
elseif rightredstone == false and leftredstone == true then
redstone.setOutput("back", true)
else
redstone.setOutput("back", false)
end
sleep(0.1)
end
end
function NotGate(...)
Print("NotGate")
while true do
frontredstone = redstone.getInput("front")
if frontredstone == false then
redstone.setOutput("back", true)
else
redstone.setOutput("back", false)
end
sleep(0.1)
end
end
function NandGate(...)
Print("NandGate")
while true do
rightredstone = redstone.getInput("right")
leftredstone = redstone.getInput("left")
if rightredstone == false and leftredstone == false then
redstone.setOutput("back", true)
else
redstone.setOutput("back", false)
end
sleep(0.1)
end
end
function XnorGate(...)
Print("XnorGate")
while true do
rightredstone = redstone.getInput("right")
leftredstone = redstone.getInput("left")
if rightredstone == true and leftredstone == true then
redstone.setOutput("back", true)
elseif rightredstone == false and leftredstone == false then
redstone.setOutput("back", true)
else
redstone.setOutput("back", false)
end
sleep(0.1)
end
end
Print("RedGates 1.0")
ChooseGate()