I cant get this simple program to work because os.sleep command does not respond correctly
function actvBB (x) --this is to activate BlockBreakers
for i= 0 , 50 do
rs.setBundledOutput("left" , 8)
os.sleep (0.4)
rs.setBundledOutput("left" , 0)
end
end
this 0.4 sec delay takes about 20 secs
it worked just fine earlier in other save of mine with same settings.
EDIT: I asked it loop only once
And there are no other computer connected.
ADDITIONAL INFORMATION:
Minecraft Forge 3.3.8.152
9 replies to this topic
#1
Posted 20 September 2012 - 08:58 AM
#2
Posted 20 September 2012 - 09:50 AM
Well, i dont know why os.sleep() doesnt work, try using sleep(n) instead. If none works, try updating your Forge. That might help. Or maybe, update your ComputerCraft.
#3
Posted 20 September 2012 - 10:18 AM
The sleep delay depends on the tick duration and on the number of active computers. Maybe you're having a lot of working computers besides?
#4
Posted 20 September 2012 - 05:07 PM
How do you know how much the delay takes? By looking at the cable?
You forgot to put a sleep after setting the output to 0 (off), so it will loop back instantly and turn it on, and it will look like it never turned off.
So...
0.4 seconds x 50 iterations = cable is on 20 seconds
You forgot to put a sleep after setting the output to 0 (off), so it will loop back instantly and turn it on, and it will look like it never turned off.
So...
0.4 seconds x 50 iterations = cable is on 20 seconds
#5
Posted 21 September 2012 - 12:05 AM
LOL I feel so noobish reading this and not understanding...
#6
Posted 21 September 2012 - 08:57 AM
Mr. Fang, on 21 September 2012 - 12:05 AM, said:
LOL I feel so noobish reading this and not understanding...
Oh and... That was quite a pointless post? No offence.
#7
Posted 21 September 2012 - 10:39 AM
MysticT, on 20 September 2012 - 05:07 PM, said:
How do you know how much the delay takes? By looking at the cable?
You forgot to put a sleep after setting the output to 0 (off), so it will loop back instantly and turn it on, and it will look like it never turned off.
So...
0.4 seconds x 50 iterations = cable is on 20 seconds
You forgot to put a sleep after setting the output to 0 (off), so it will loop back instantly and turn it on, and it will look like it never turned off.
So...
0.4 seconds x 50 iterations = cable is on 20 seconds
#8
Posted 21 September 2012 - 01:28 PM
rs.setBundledOutput("left" , 8)
os.sleep (0.4)
rs.setBundledOutput("left" , 0)
os.sleep (0.4) -- <-- THIS
#9
Posted 21 September 2012 - 02:09 PM
Add a print(i) inside the loop, and you'll see that it loops 50 times.
When you see that you're wrong, add the second sleep that we said and it will work.
When you see that you're wrong, add the second sleep that we said and it will work.
#10
Posted 21 September 2012 - 06:30 PM
Let's try to make a painting to explain this,
http://s1182.photobu...zps94676460.png
The lines made by the pencil are instant, they are there just to show how it moves thru the loop
http://s1182.photobu...zps94676460.png
The lines made by the pencil are instant, they are there just to show how it moves thru the loop
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











