Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- NOT = "local args = {...}\
- local input = args[1]\
- local n = nil\
- local on = false\
- if args[2] then\
- n = args[2]\
- if n ~= \"1\" or n ~= \"0\" then\
- n = \"1\"\
- end\
- else\
- n = \"1\"\
- end\
- while true do\
- sleep(0)\
- for k,v in pairs(rs.getSides()) do\
- if v ~= input then\
- rs.setOutput(v,on)\
- end\
- end\
- if rs.getInput(input) then\
- if n == \"1\" then\
- on = true\
- elseif n == \"0\" then\
- on = false\
- end\
- else\
- if n == \"1\" then\
- on = false\
- elseif n == \"0\" then\
- on = true\
- end\
- end\
- end\
- ",
- rep = "local args = {...}\
- local inp = args[1]\
- local out = args[2]\
- local delay = args[3]\
- while true do\
- sleep(0)\
- if rs.getInput(inp) then\
- sleep(tonumber(delay))\
- rs.setOutput(out,true)\
- else\
- sleep(tonumber(delay))\
- rs.setOutput(out,false)\
- end\
- end\
- ",
- inverter = "local args = {...}\
- local input = args[1]\
- local output = args[2]\
- \
- local sleep = function()\
- os.queueEvent(\"hi\")\
- coroutine.yield()\
- end\
- \
- while true do\
- sleep(0)\
- if rs.getInput(input) then\
- rs.setOutput(output,false)\
- elseif not rs.getInput(input) then\
- rs.setOutput(output,true)\
- end\
- end\
- ",
- OR = "local args = {...}\
- local out = args[1]\
- local n = \"test\"\
- if args[2] then\
- n = args[2]\
- else\
- n = \"1\"\
- end\
- local on = false\
- while true do\
- sleep(0)\
- rs.setOutput(out,on)\
- if n == \"1\" then\
- on = false\
- elseif n == \"0\" then\
- on = true\
- end\
- for k,v in pairs(rs.getSides()) do\
- if v ~= out then\
- if n == \"1\" then\
- if on ~= true then\
- if rs.getInput(v) then\
- on = true\
- end\
- end\
- elseif n == \"0\" then\
- if on ~= false then\
- if rs.getInput(v) then\
- on = false\
- end\
- end\
- end\
- end\
- end\
- end\
- ",
- AND = "local args = {...}\
- local s1 = args[1]\
- local s2 = args[2]\
- local out = args[3]\
- if args[4] then\
- local n = args[4]\
- else\
- n = \"1\"\
- end\
- if n == \"1\" then\
- while true do\
- if rs.getInput(s1) and rs.getInput(s2) then\
- rs.setOutput(out,true)\
- else\
- rs.setOutput(out,false)\
- end\
- sleep(0)\
- end\
- elseif n == \"0\" then\
- while true do\
- if rs.getInput(s1) and rs.getInput(s2) then\
- rs.setOutput(out,false)\
- else\
- rs.setOutput(out,true)\
- end\
- sleep(0)\
- end\
- end\
- ",
- }
Add Comment
Please, Sign In to add comment