Jump to content




Rednet Chat

networking wireless help

4 replies to this topic

#1 Zenon

  • Members
  • 50 posts

Posted 17 May 2015 - 06:43 PM

Hi All, I Was Just Wondering How I Could Make A Chat Function That Would ALWAYS Receive Msgs, But Still Be Able To Do Other Things. I Want To Be Able To Message A Computer, But If Im Msging, I Dont Want To Miss A Msg. Would This Be Possible? And, If So, Would It Be Better To Send The Msgs To A Server, Then Have That Send It To The Specified Computer?

Thanks In Advance!

#2 flaghacker

  • Members
  • 655 posts

Posted 17 May 2015 - 08:43 PM

Yup that's entirely possible. No, it would not help to centralize your events. Take a look at this tutorial.

#3 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 18 May 2015 - 09:46 AM

You can have the computer catch events using os.pullEvent() while still being able to do other thibgs. This is achieved using the paralell API. The docs for it can be found on the CC wiki.

Edited by Mackan90096, 18 May 2015 - 09:46 AM.


#4 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 18 May 2015 - 12:44 PM

View PostMackan90096, on 18 May 2015 - 09:46 AM, said:

You can have the computer catch events using os.pullEvent() while still being able to do other thibgs. This is achieved using the paralell API. The docs for it can be found on the CC wiki.

Not really? you could easily do the following:
while true do
    local args = { os.pullEvent() }
    if args[1] == "timer" then
        -- Run timer code
    elseif args[1] == "mouse_click" then
        -- Run mouse_click code, I use it in all my programs, do not use the parallel API at all.
    end
end

I made this tutorial for making touch screen events, but it can be used for waiting for multiple events to fire.
http://www.computerc...__fromsearch__1

Just use an if statement, and args[1] will be the event and args[2], args[3] and up to args[5] will be any returns as it is stored in a table.

#5 Zenon

  • Members
  • 50 posts

Posted 18 May 2015 - 09:50 PM

Thanks All!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users