6 posts
Posted 30 December 2012 - 03:07 AM
as im not sure if this is a bug, or my own self bieng stupid, but i type in my normal lua code, all is correct etc no problems (i triple checked it) and then where it should sleep, it doesnt…. im not sure if i typed something wrong becosue the pc isnt spitting out an error but yet its still doing it, the code is(till fixed)
redstone.setOutput("left", true)
sleep=5
print("10 second wait")
sleep=10
al it does is activate the redstone and is instantly finnished, this is kind of a pain as my initial redstone needs time diferences as i said im not sure if its my own stupidity or just a bug, so im asking here
p.s., all things i tried: sleep(5) *expected =* sleep=(5) *nothing* sleep=5 *nothing* <– all those options just with os.sleep same thing
anny1 know?
21 posts
Posted 30 December 2012 - 03:11 AM
I'm not sure if this is the problem, but you can try this:
redstone.setOutput("left", true)
sleep(5.0)
print("10 second wait")
sleep(10.0)
example program which creates a 1 tick redstone pulse:
print("Pulse will come in 5 seconds from now")
sleep(5.0)
rs.setOutput("left", true)
sleep(0.1)
rs.setOutput("left", false)
print("pulse just happened")
sleep(5.0) --wait another 5 seconds so that the person has time to read the last message
6 posts
Posted 30 December 2012 - 03:13 AM
I'm not sure if this is the problem, but you can try this:
redstone.setOutput("left", true)
sleep(5.0)
print("10 second wait")
sleep(10.0)
just tried it, still does the exact same, doesnt wait at all, the enitial program ha sa looping system in it, it works and all too, but the sleep function acts as if it wasnt there, if it helps im running craftos .14 on mindcrack v4 1.4.6
6 posts
Posted 30 December 2012 - 03:19 AM
heres the enitial script i have for the thing to work (without prints)
for i=1,10 do
redstone.setOutput("left, true)
sleep(0.5)
redstone.setOutput("left, false)
sleep(0.5)
end
when i type in the program to start this script, it is instantly done and did nothing on the redstone….
21 posts
Posted 30 December 2012 - 03:20 AM
hmm then I don't know what's wrong, sorry :/
EDIT:
How is your redstone connected to the side? Is it red alloy wire or just redstone dust?
6 posts
Posted 30 December 2012 - 03:25 AM
red alloy wire directly onto the computer leading streight down, it worked on tekkit 1.2.5, dont know why it wont annymore… i also tried without the off function and the wire recieves the redstone, its jsut the sleep function broke
21 posts
Posted 30 December 2012 - 03:57 AM
alright, then I can't help you :/ I thought that maybe the red alloy wire was placed on the floor next to the computer, without it going upwards up to the side.
515 posts
Location
Australia
Posted 30 December 2012 - 04:33 AM
Try this:
local function setAll(bool)
for _, v in pairs(rs.getSides()) do
rs.setOutput(v, bool)
end
end
print("Start")
for i=1,10 do
setAll(true)
sleep(0.5)
setAll(false)
sleep(0.5)
end
print("End")
1054 posts
Posted 30 December 2012 - 05:17 AM
Do you still have a "sleep=<anything>" somewhere? You could be overriding the sleep function somewhere. (or you could try "os.sleep(5)" again). Anyway, "sleep=5" is not the way to go, you're just redefining the sleep function as a number that way.
1548 posts
Location
That dark shadow under your bed...
Posted 30 December 2012 - 05:20 AM
heres the enitial script i have for the thing to work (without prints)
for i=1,10 do
redstone.setOutput("left, true)
sleep(0.5)
redstone.setOutput("left, false)
sleep(0.5)
end
when i type in the program to start this script, it is instantly done and did nothing on the redstone….
you didn't close your string in the redstone.setOutput command. you need another "
6 posts
Posted 30 December 2012 - 07:00 AM
ok during the code type i forgot the " after left, is in the actual mprogramm, my bad, annyways when i try to do the sleep sleep(1.0) it says attempt to call number, witch its sposed to or am i mistakend? and the rest of the code has no sleep=**** annywhere, just that part, also where its the 1st time sleep… however, if i do the 1 1lann posted, it works…. still as clueless as before lol
6 posts
Posted 30 December 2012 - 07:02 AM
ah, the error seemd to have fixxed itself… for some reason it wont print that error annymore…. but thanks for the help all :D/> now i can continue on this ^^
1054 posts
Posted 30 December 2012 - 08:31 AM
My bet is that you set 'sleep' to a number before from lua terminal or a previous version of your program. Rebooting your computer fixes that. I'm glad it works now. :)/>
2005 posts
Posted 30 December 2012 - 08:30 PM
I should incorporate that into my sig, replace "have a sleepless night" with "set sleep = nil". Maybe replace other parts with set someFunction = nil too. For laughs.
1688 posts
Location
'MURICA
Posted 30 December 2012 - 08:42 PM
I should incorporate that into my sig, replace "have a sleepless night" with "set sleep = nil". Maybe replace other parts with set someFunction = nil too. For laughs.
I shouldn't be laughing this hard.
2005 posts
Posted 30 December 2012 - 08:50 PM
It's funny 'cause I'm mean ;)/>
6 posts
Posted 01 January 2013 - 07:00 AM
Maybe try placing space between print and ("<some words>")
8543 posts
Posted 01 January 2013 - 07:05 AM
Maybe try placing space between print and ("<some words>")
No. That won't change the functionality of the program either way, it just makes the code look worse, in my opinion.