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

Modem message event question

Started by aaaallleex, 28 February 2015 - 12:58 AM
aaaallleex #1
Posted 28 February 2015 - 01:58 AM
When I type in "local messageArguments = {os.pullEvent("modem_message")}", the computer just stops, the flashy typing thing doesn't show anymore and I can't do anything more to the computer except to destroy it. Why does it do this, and how can I fix it?

Thanks.
grand_mind1 #2
Posted 28 February 2015 - 02:43 AM
When os.pullEvent() is ran, the computer will wait for an event to be fired. If the fired event is the one it was passed, the compuer will continue. By running os.pullEvent("modem_message"), you are telling the computer to wait for the "modem_message" event to be fired and *then* continue on with the code. To get around this, I believe, requires the use of coroutines.
By the way, you can terminate a program with CTRL+T rather than breaking the computer.
HPWebcamAble #3
Posted 28 February 2015 - 07:20 AM
Here is the CC Wiki on os.pullEvent()
http://computercraft.info/wiki/Os.pullEvent

To get around this, I believe, requires the use of coroutines.

Well, calling just 'os.pullEvent()' with no arguments will wait for ANY event.

I can't do anything more to the computer except to destroy it.

You can use Ctrl+t to to stop it. That literally just throws the error 'terminated' so it's possible to prevent.
If a computer really gets messed up, you can use Ctrl+r to restart it, or Ctrl+s to shut it down.