Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
Sign in to follow this  
UndyingWar

Making Messaging User-Friendly

Question

So, I've successfully sent a message to my friends computer. The problem is, it's just not very practical. We don't feel like going into the lua interpreter and typing things like =event.pull("modem") just to receive a message.

 

I also don't like having to open the modem every time I get on the computer to send a message. Is there any way I could make this whole process more user friendly? Any help would be great.

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
event = require "event"
function evthandler_modem_message(msgtype, laddr, raddr, port, dist, ...)
  print (...)
end
event.listen("modem_message", evthandler_modem_message);

You may want to check the event library documentation at http://ocdoc.cil.li/api:event

 

You will need to tell the modem to listen on a specifc port, though, no getting around that. You can put that into a program of its own, and even make it run that program when it boots the computer.

 

Finally

component = require "component"
modem = component.modem
-- process parameters to a single string
text = table.concat (... , ' ')
modem.broadcast(text)

...to make it easier to send a message.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

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