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

Cant wrap a Wireless Modem

Started by gfcwfzkm, 02 March 2014 - 07:48 PM
gfcwfzkm #1
Posted 02 March 2014 - 08:48 PM
Hi,

when i try to wrap a monitor, i get the error:
MinerControl.lua:5: attemp to call nil

http://pastebin.com/ZfAKV2tF

:(/>
It only fails when im using the modem at the back
CometWolf #2
Posted 02 March 2014 - 08:49 PM
you wrote peripheral.warp…
gfcwfzkm #3
Posted 02 March 2014 - 08:51 PM
is it wrong? Got it from: http://computercraft.info/wiki/Modem_%28API%29
CometWolf #4
Posted 02 March 2014 - 08:56 PM
"warp", "wrap". See the difference? You're even using the correct one in your post.
gfcwfzkm #5
Posted 02 March 2014 - 09:01 PM
(facepalm) thanks.
By the way, got a little question…
in the code im 'waiting' to receive a message from the Wireless-Modem.
That means the program is "stopped" until it get something. But how can i break this too? like by using a 1 second-timer?
CometWolf #6
Posted 02 March 2014 - 09:10 PM

local timeOut = os.startTimer(timeGoesHere) --this will fire an event in the given time, with the id it returns.
local tEvent = {os.pullEvent()}
if tEvent[1] == "modem_message" then
  --message code here
elseif tEvent[1] == "timer" and tEvent[2] == timeOut then
  --timeout code here
end
Im guessing you don't know how tables work, so i'll just put this here aswell.

event = tEvent[1]
side = tEvent[2]
freqency = tEvent[3]
replyFrequency = tEvent[4]
message = tEvent[5]
distance = tEvent[6]
gfcwfzkm #7
Posted 02 March 2014 - 10:13 PM
Thanks =)