Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

Exception_17

Members
  • Content Count

    3
  • Joined

  • Last visited

Posts posted by Exception_17

  1. 3 hours ago, cadergator10 said:

    The modem's wiki is here: https://ocdoc.cil.li/component:modem

    event.listen() returns all the variables given by the event being called. This is the modem's return:

    
    local ev, to, from, port, dist, ... = event.pull("modem_message")

    ev is the event that is returned, which for the modem should equal "modem_message"

    to is the address of the modem that received it (the wireless network card that is installed on the machine)

    from is the address of the modem that sent the message

    port is the port that the message was received on

    dist is the distance away the computer which sent the message is

    ... is any other variables that the computer passes. For instance, if you were to run 

    
    component.modem.broadcast(123,"Hello","World")

    and your event.pull looked like

    
    local ev, to, from, port, dist, message1, message2, message3 = event.pull("modem_message")

    port would be set to 123, message 1 would equal "Hello", and message2 would equal "World". message3 would just be nil

     

    Hope this helped

    So i just make like this:?

    function f()
      local _,_,_,_,_,msg = event.pull("modem")
      print(msg)
    end
    
    event.listen("modem", f())

     

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.