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

Chatroulette?

Started by TheOddByte, 07 December 2012 - 07:52 AM
TheOddByte #1
Posted 07 December 2012 - 08:52 AM
Hi!
I would think it would be nice if you just randomly connected to a person when you wanted to
and was just thinking is it possible to make Chatrouette based chat in CC?
Here is a little of the code i was thinking of.

id = math.random(0,100)
write("Would You Like To Connect To Someone? Yes/No:")
answ = read()
if answ == "Yes" or answ == "yes" then
checkID(id) --Check Id would be the function thats checks if it Active
if id == true then
term.clear()
term.setCursorPos(1,1)
print("Connecting to"..id)
sleep(1)
connect(id) --This function would ofcourse connect to the ID
elseif answ == "No" or answ == "no" then
os.reboot()
end
end

But what im wondering is how to check if the ID is active and not idle.
Cranium #2
Posted 07 December 2012 - 09:10 AM
You would have to use some sort of ping system, where it sends a message to a server, where it will ping ALL ids it has had contact with. If any of them respond, then it adds those responses to a table.
From there, it's only a matter of using math.random to choose an id to chat with.
ChunLing #3
Posted 07 December 2012 - 09:12 AM
Have a server that maintains a list of active connections.
TheOddByte #4
Posted 07 December 2012 - 11:17 AM
Ok thanks for the help!
Will start with it tomorrow I think because I need to do my homework(Should have delivered 2 or 3 weeks ago) :rolleyes:/>
juliedangerous #5
Posted 14 December 2012 - 06:06 PM
As long as the server maintains active connections, it is possible to make a chat roulette based chat in CC