Hi i want to make a mob farm with the soul shards mod, in the ultimate FTB pack, what these can do is spawn mobs at any light level, but when a redstone signal is applied to them they will stop spawning. Anyways i want to make a code for a computer so that it will redstone pulse to the right of the computer every two seconds when there is no signal, but turn off when a redstone current is applied to the left. If anybody could help me with some coding i would REALLY appreciate it! thanks to anybody who can offer some coding advice.
Inverted Redstone signal
Started by Bloodhawk1990, Apr 07 2013 11:11 AM
5 replies to this topic
#1
Posted 07 April 2013 - 11:11 AM
#2
Posted 07 April 2013 - 11:26 AM
local on = false -- So we'll know whether to fire the pulse or not.'
local function doTime -- The pulse
rs.setOutput("right", true)
sleep(0.2)
rs.setOutput("right", false)
end
while true do
local tmr = os.startTimer(2.0) -- Make a timer for 2 seconds
local evt, arg1, arg2 = os.pullEvent() -- Catch-all for our functions
if evt == "redstone" then
if rs.getInput("left") then -- If left is on
on = true
else -- Or not.
on = false
end
elseif evt == "timer" and arg1 == tmr and on then
doTime()
end
end
And I did that in about a minute, give or take typing speed.
#3
Posted 07 April 2013 - 07:03 PM
For OmegaVest, you have a few bugs, and it didn't suit OP requirements, see spoiler for more.
For Bloodhawk1990, here is the fixed code.
Spoiler
For Bloodhawk1990, here is the fixed code.
Spoiler
Edited by theoriginalbit, 08 April 2013 - 06:34 AM.
#4
Posted 08 April 2013 - 06:25 AM
When i do your code it says startup:1: Expected string, did i type something wrong into the first line? sorry for being so helpless
#5
Posted 08 April 2013 - 06:34 AM
Nope that was my fault, sorry, go again.
#6
Posted 08 April 2013 - 06:42 AM
That worked, thanks for all the help
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












