Jump to content


Abstract's Content

There have been 7 items by Abstract (Search limited from 29-March 23)


By content type

See this member's

Sort by                Order  

#1041 Too Long Without Yielding

Posted by Abstract on 22 February 2012 - 03:13 PM in Ask a Pro

I need some help with my program. What it should do is,output redstone to the left, if redstone comes from the front, stop outputting redstone to the right wait and reboot. this is my code:
startup:
while true do
shell.run"redside"
end
redside:
redstone.setOutput("right", true)
if redstone.getInput("front", true)
then redstone.setOutput("right", false)
sleep(10)
os.restart()
end
but if I reboot now, it works for only a couple of seconds and a error pops up which says 'Too long without yielding'. What did I do wrong?



#1048 Too Long Without Yielding

Posted by Abstract on 22 February 2012 - 03:46 PM in Ask a Pro

View PostCasper7526, on 22 February 2012 - 03:28 PM, said:

When your code just loops endlessly without yielding for a few seconds, you receive that error.

You should use a pullevent to only check when redstone is changed instead.

startup:
redstone.setOutput("right", true)
while true do
event, param = os.pullEvent()
   if event == "redstone" and redstone.getInput("front") == true then
   redstone.setOutput("right", false)
   sleep(10)
   redstone.setOutput("right", true)
   end
end
[string "redside"]:4: 'then' expected
Don't know why I've typed everything like you
EDIT: works, had a spelling mistake <_</>



#11835 turtle slot selection

Posted by Abstract on 07 May 2012 - 12:04 PM in Ask a Pro

thanks, worked fine^^ also good to know where the computerprograms are located, now I'll never lose a file again



#11741 turtle slot selection

Posted by Abstract on 06 May 2012 - 05:48 PM in Ask a Pro

sry for that, I'm stupid as hell^^ anyways, i've got another problem now, I always get an "too long without yielding error" how can I fix this (and are there any ways to copy+paste the code on my local machines onto the forums?)



#11727 turtle slot selection

Posted by Abstract on 06 May 2012 - 02:46 PM in Ask a Pro

How can I make my turtle select another slot of Items to place?



#44271 Rednet help

Posted by Abstract on 25 October 2012 - 05:13 PM in Ask a Pro

thanks, that worked



#44263 Rednet help

Posted by Abstract on 25 October 2012 - 05:03 PM in Ask a Pro

Hi everybody

I've played around with rednet a little bit and wrote a little program, which doesn't work correctly.. Here is what it should do:
If it gets the command, it should extend a pisten and with another command it should retract it
Now here's the problem: It only extends and does not retract... here's the code of my receiver computer(id4)

rednet.open("left")
while true do
os.pullEvent()
id,message = rednet.receive()
if message == "on" then
rs.setOutput("back", true)
end
if message == "off" then
rs.setOutput("back", false)
end
end
what is wrong/missing there? I would be glad if someone could help me