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

Wireless Modem API 'nil' issue...

Started by Zetrious, 24 December 2017 - 01:00 PM
Zetrious #1
Posted 24 December 2017 - 02:00 PM
So I'm just trying to make a simple program where one computer is a receiver and one is a sender.

The receiver is just fine it's the sender I am having issues with.


local modem = peripheral.wrap("top")
modem.transmit(0,5,"HEY!") -- 5 being the receiver.


The error it outputs is: chat:2 attempt to call nil
KingofGamesYami #2
Posted 24 December 2017 - 04:51 PM
Double check the spelling of "transmit" and verify that the peripheral on top of the computer is aa modem.
Zetrious #3
Posted 24 December 2017 - 05:39 PM
Transmit is spelled right, there is a wireless modem ontop of each computer.
Lupus590 #4
Posted 24 December 2017 - 10:11 PM
Is 'wrap' spelt correctly in your original code?
Zetrious #5
Posted 24 December 2017 - 10:31 PM
Yes… Everything is the same.
KingofGamesYami #6
Posted 24 December 2017 - 11:39 PM
Well, I'm stumped. The error says your program is trying to call a function which does not exist, but the way it's written it should work.
Are any other peripherals attached to the computer?
Do you have any other mods installed?
What version of computercraft are you using?
If you could run this code and tell me the result it may be helpful:

local t = peripheral.getNames()
for k, v in pairs( t ) do
print( "Peripheral '" .. v .. "' is of type '" .. peripheral.getType( v ) "'" )
end
local modem = peripheral.wrap( 'top' )
if modem then
  print( "modem exists, checking for transmit" )
  if modem.transmit then
    print( "modem.transmit exists" )
  end
end
print( "Attempting to open rednet" )
local ok, err = pcall( rednet.open, "top" )
if not ok then
  print( "Rednet open failed" )
  print( err )
else
  print( "Attempting to send a message" )
  local ok, err = pcall( rednet.broadcast, "test" )
  if not ok then
    print( "Rednet send failed" )
    print( err )
 end
end
Edited on 24 December 2017 - 10:40 PM
Zetrious #7
Posted 25 December 2017 - 02:51 AM
Ok, the output comes out with.

- Transmit exists.
- Attempted to send a message.


MC version is: 1.7.10(because of modpack)
KingofGamesYami #8
Posted 25 December 2017 - 03:13 AM
There should be a lot more output than that… I have a feeling you have omitted some lines.

However, if it does say it attempted to send a message and no failure message, I'm 100% sure modem.transmit should work and something isn't lining up with what you have in game and what you're reporting here.
Zetrious #9
Posted 25 December 2017 - 03:32 AM
Well, I sorta gave up because of how stupid the issue is. I don't understand why modem.transmit wouldn't work at all :/
KingofGamesYami #10
Posted 25 December 2017 - 03:49 AM
Well, if you're not going to keep trying I can't really do much. At this point if it's not the information you're reporting some mod is really messing with computercraft or the version of computercraft you're using has been (badly) modified. Maybe with a resource pack?

What's odd is, modem.transmit appears to exist (my program says it does), and rednet.send worked (well, didn't error anyway - it uses modem.transmit internally). So it shouldn't error if you add the modem.transmit line to the end of my program. It should send the message just fine.
Zetrious #11
Posted 25 December 2017 - 04:31 AM
RIP
Lupus590 #12
Posted 25 December 2017 - 03:04 PM
Can you give us a list of your mods or a link to the modpack you are using?
Zetrious #13
Posted 25 December 2017 - 05:19 PM
Well not it's not even the mods. I went ahead setup a ComputerCraft mod only with TMI and it still didn't work. But this time the ComputerCraft version was 1.8.9 :/ I just gave up.
Lupus590 #14
Posted 25 December 2017 - 06:29 PM
Any resource packs?
Zetrious #15
Posted 26 December 2017 - 06:34 PM
Nope
Lupus590 #16
Posted 26 December 2017 - 07:32 PM
It might be worth downloding CC again.
Zetrious #17
Posted 26 December 2017 - 08:51 PM
"Well not it's not even the mods. I went ahead setup a ComputerCraft mod only with TMI and it still didn't work. But this time the ComputerCraft version was 1.8.9 :/ I just gave up. "
Lupus590 #18
Posted 26 December 2017 - 09:39 PM
Send a screenshot of the code, something may be autocorrecting a typo when you paste to the forums.
Zetrious #19
Posted 26 December 2017 - 10:49 PM
I gave up on it.