This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
MagicalMidge's profile picture

[SOLVED] Wait for 60 second whilst being accessible? [SOLVED]

Started by MagicalMidge, 24 June 2013 - 01:50 PM
MagicalMidge #1
Posted 24 June 2013 - 03:50 PM
– EDIT –

Okay guys well, I ended up just sitting down with a pen and piece of paper and figured it out, thanks to "Lyqyd" and "Freack100" for creating this into a thread and attempting to help me!

FOR ANYONE WANTING TO KNOW THE SOLUTION I WENT WITH:


Instead of having the turtle "sleep" I simply have him enter a "rednet.receive(60) the 60 is a timeout buffer so if he receives a message within that time he will simply send a message to the next turtle telling him he needs to do the job. If the timeout, times out then it will simply loop back to the very first rednet.receive() that doesn't have a timeout.

If anyone would like further information or even the actual code I used please do not hesitate to ask me!

One more thanks to the guys who helped/ attempted to help ;)/>

ORIGINAL POST

"Here is the issue, I am trying to make a very simple system that will send a rednet message to a turtle telling him there are items in an ender chest that he needs to suck up and then drop down into a machine, the problem is if he gets another message within the time that the first batch of items are still being processed the system will clog up, so I have 5 turtles, 5 machines and 5 enderchests, this should be enough for what I will be using the system for.

The problem is, I want a turtle to receive its orders then go into "notFree" mode, if that is the case it then sends out a rednet message to the next turtle in line the problem I am having is the only way I know to get the turtles/computers to count in seconds is to use the sleep function, but if I tell a turtle to sleep for 60 seconds it completely ignores any incoming rednet messages.

What I need: I need a way for a turtle to count to 60 seconds whilst being able to receive a rednet message. The 60 seconds is just the amount of time I am allowing one machine to process a stack of items.

Thanks in advanced, if you need any additional information then please let me know! ;)/>"
Lyqyd #2
Posted 24 June 2013 - 04:49 PM
Split into new topic.
MagicalMidge #3
Posted 24 June 2013 - 04:57 PM
Split into new topic.

Thanks!
H4X0RZ #4
Posted 24 June 2013 - 05:06 PM
After the 60 seconds the turtle can't receive, right?
MagicalMidge #5
Posted 24 June 2013 - 05:13 PM
After the 60 seconds the turtle can't receive, right?

No, he is fine to receive after the 60 seconds, however I want him to be in receive mode while he is in "notFree" mode meaning he will then go on to send a message to another turtle saying "Hey I am not free so you do this task" <– code wise. Then after the 60 seconds he will change "notFree" to false or 1 meaning he will be able to do tasks again.

Hope this clears up things