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

os.pullEvent Difficulty

Started by Keetster, 01 July 2012 - 12:34 AM
Keetster #1
Posted 01 July 2012 - 02:34 AM
So when I use the os.pullEvent line, I get an error:

bios:206: [string "function"]:7: unexpected symbol

The error seems to be from line 7, which is:

event, 3, param2 = os.pullEvent("rednet_message") – 3 is the id of the sender computer, param2 is the string of the rednet message

The program is called function, not sure if it helps
MysticT #2
Posted 01 July 2012 - 02:54 AM
You don't have to write the actual id, use:

local evt, id, msg = os.pullEvent("rednet_message")
And the variable "id" will contain the id of the sender, and the "msg" variable will contain the message.
You can name them whatever you want, but not just numbers. So you could do:

local a, b, c = os.pullEvent("rednet_message")
and it would be the same, just that the variable names change.
Keetster #3
Posted 01 July 2012 - 02:59 AM
You don't have to write the actual id, use:

local evt, id, msg = os.pullEvent("rednet_message")
And the variable "id" will contain the id of the sender, and the "msg" variable will contain the message.
You can name them whatever you want, but not just numbers. So you could do:

local a, b, c = os.pullEvent("rednet_message")
and it would be the same, just that the variable names change.

Oh I see! Thanks.