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

[1.5+] Dark Chat - rednet chat program! (Works on 1.6+)

Started by darkrising, 13 December 2012 - 01:23 PM
darkrising #1
Posted 13 December 2012 - 02:23 PM
Hello, this is a simple chat program I wrote a while ago! All you need is a computer (preferably colour) with a modem and your good to go!

Features:
  • Does not require a server program!
  • Simple IM styled chat
  • Channels and colour too!
  • Scrollable chat (Bar goes yellow when scrolling - see screenshots)
  • Nice slash command system
The chat will work as far as rednet can reach! Default is 60 blocks at minimum height.

Downloadcommands:
/exit - leaves in a friendly manner and exits the program! (<name> has quit!)
/quit - same as /exit
/me - roleplay like talking for example, /me is a pie! -&amp;gt; <name> is a pie!
/channel <number> - switch channel example: /channel 10
/list - shows who is in the channel
/clear - clears the chat
/help - no need to explain what that does
/nick <nickname> - Changes your nickname

Planned Changes
  • Add colour support - Added
  • re-do chat to be more supportive of slash commands - Done
  • Add in channel switching - Added
  • Add history / scrollable chat - Added
  • Add in user filtering
  • Add channel 'admins'
  • Channel 'dictionary' ?
Changelog:
Spoiler1.5
  • Added /quit command, does the same thing as /exit
  • Added some arguments so you can launch the program with your username directly or launch it a bit easier with other programs (OS and such)
  • Updated to Computercraft 1.6+
1.4.2
  • Exit will now exit instead of rebooting
1.4
  • Added scrollable chat
  • Added /help command
  • Bottom bar has yellow pixels when scrolling!
1.3.3
  • Added new command /list
1.3.2
  • Did a code clear-up (its a lot tidy now)
  • Added new private / public config options
1.3.1
  • Added channel support
  • Added '/me' command
  • Added '/channel' command
1.3
  • Added Colour Support
  • Created a whole new commands system
1.22
  • Added Dark Chat to my github
  • Added my auto updater function (might end up using my api but we'll see)
1.2
  • Fixed the 'sending to self' problem
  • Changed communication from split to tables (more supportive
1.1
  • Added "enter" and "leave" message
1.0
  • initial release

Screenshots:
Spoiler




Any suggestions? found a bug?
leave a comment below!</number></name></name>

Check out my other programs!
Edited on 20 April 2014 - 06:14 PM
momona5 #2
Posted 25 February 2013 - 05:22 AM
uhmmm. So I'm not sure why, but I'm on my friends server with this chat and whenever i join, leave, or chat, it says it twice…

Kingdaro #3
Posted 25 February 2013 - 05:35 AM
Methinks that the program is receiving rednet signals from itself in that case.
TwelveEight #4
Posted 25 February 2013 - 12:09 PM
Oh my god, you deserve a medal. I've been trying to write something like this, but I kept messing up, haha.
Shnupbups #5
Posted 25 February 2013 - 12:55 PM
This topic got no posts up until today? Wow. Two months.

I'm making a new program a lot like this, but with colour, and support for channels.
SuicidalSTDz #6
Posted 25 February 2013 - 12:57 PM
Looks nice, never even saw this thread before or I would have posted a response :P/>

EDIT: Can two users have the same name? If so you should store all nicknames in a file and compare before they can join.
darkrising #7
Posted 26 February 2013 - 06:56 AM
Didn't think anyone was interested in this program :o/>

But anyway I did a small update and fixed the "sending to self" problem.


Looks nice, never even saw this thread before or I would have posted a response :P/>

EDIT: Can two users have the same name? If so you should store all nicknames in a file and compare before they can join.

I'm planning to do this soon, as well as a channels feature.

Edit: Added dark chat to my github, bring on auto updates!
SuicidalSTDz #8
Posted 26 February 2013 - 09:13 AM
Didn't think anyone was interested in this program :o/>

But anyway I did a small update and fixed the "sending to self" problem.


Looks nice, never even saw this thread before or I would have posted a response :P/>

EDIT: Can two users have the same name? If so you should store all nicknames in a file and compare before they can join.

I'm planning to do this soon, as well as a channels feature.

Edit: Added dark chat to my github, bring on auto updates!
I will be pleased to see how this program plays out once the channels and all are added. Keep up the great work!
darkrising #9
Posted 26 February 2013 - 10:32 AM
Added colour support and a whole new slash command handler.
SuicidalSTDz #10
Posted 26 February 2013 - 10:34 AM
Loving it. Keep it up ;)/>
darkrising #11
Posted 26 February 2013 - 11:17 AM
Loving it. Keep it up ;)/>

And boom! channel support like a boss.
TwelveEight #12
Posted 26 February 2013 - 08:29 PM
Colour chat and Channel Switching? *pukes rainbows*
I saw this yesterday and it is already so much better! c:
darkrising #13
Posted 27 February 2013 - 07:02 AM
Colour chat and Channel Switching? *pukes rainbows*
I saw this yesterday and it is already so much better! c:

Yeah when I put my mind to something usually it gets done quick :)/>
hopefully I'll have slash colours working sometime soon (or even bukkit colours)

Edit: added config option for public / private
Edit2: Added the '/list' command to see who's online
TwelveEight #14
Posted 27 February 2013 - 04:18 PM
Colour chat and Channel Switching? *pukes rainbows*
I saw this yesterday and it is already so much better! c:

Yeah when I put my mind to something usually it gets done quick :)/>
hopefully I'll have slash colours working sometime soon (or even bukkit colours)

Edit: added config option for public / private
Edit2: Added the '/list' command to see who's online

I can tell!!
If you added slash colours, I would love you forever.
darkrising #15
Posted 28 February 2013 - 11:44 AM
Another update!
  • Scrollable chat
  • /help command
  • new screenshots above
I need some more ideas, suggestions would be appreciated!
momona5 #16
Posted 28 February 2013 - 12:56 PM
Wow. I started this project back up i guess haha. Happy you fixed it so quickly, and wow and added a bunch of stuff! DARKCHAT FOR THE WIN!
momona5 #17
Posted 28 February 2013 - 01:18 PM
  • Added new private / public config options
What exactly do the public / private options do? What is the difference?






Also, on another note: I tried tweaking the code a bit by changing the os.reboot() for the /exit to shell.run("startup") so it won't kill anything else running, but darkchat gui shows up over everything, and if I ctrl + t the startup program it brings me back into DarkChat as if I never left. crtl + t that and I get a lovely error:

parallel:22: Terminated

then I tried:

term.clear()
shell.run("startup")
exit()


which gave me this

parellel:22: b:302 attempt to call nil
darkrising #18
Posted 28 February 2013 - 09:01 PM
  • Added new private / public config options
What exactly do the public / private options do? What is the difference?

-snip-

Private option makes it so that you can set a username and default channel which is saved, so in a sense it will auto-login as the set user.
Public option doesn't save the user on restart or exit.

And yes there's a reason I used os.reboot :)/> All the functions would have to return to exit parallel, shell.run("shell") might work, however it would just run shell on top of everything else (not a good idea).

Edit: Took a look into it and made a few changes, so now the program will exit on /exit instead of rebooting, wasn't actually that hard to implement :)/>
Derp_Herpsworth #19
Posted 01 March 2013 - 11:18 AM
I've installed this program on my test server. It was nice. Tell me, was it hard coding it?
darkrising #20
Posted 02 March 2013 - 11:38 PM
I've installed this program on my test server. It was nice. Tell me, was it hard coding it?

Not really, some parts took a lot of brainstorming but most of the code I wrote didn't take much thought, this program is unique as usually I don't write totally event based programs.

If you have any suggestions feel free to drop a comment :)/>
momona5 #21
Posted 17 March 2013 - 07:01 AM
I've been trying for a while to make the chat program run something after, but I'm not sure how to do this. Help? I tried changing a couple things, but I'm not sure how your code works exactly with the whole "/exit" thing.
FuuuAInfiniteLoop(F.A.I.L) #22
Posted 17 March 2013 - 07:58 AM
for channels you can modify you recieve and send functions o the channel can be a text!!
YoYoYonnY #23
Posted 19 March 2013 - 08:43 AM
uhmmm. So I'm not sure why, but I'm on my friends server with this chat and whenever i join, leave, or chat, it says it twice…

I think you are printing it first.
Delete that line
(For example:
input = read()
print(input)
rednet.send(input)
rednet.receive()
)
delete 'print(input)' here
darkrising #24
Posted 19 March 2013 - 12:39 PM
I've been trying for a while to make the chat program run something after, but I'm not sure how to do this. Help? I tried changing a couple things, but I'm not sure how your code works exactly with the whole "/exit" thing.

When you type '/exit' the function is called in the commands table (comD), it then queues the event 'exit' which the function 'exitEventListen' is waiting for, when that function returns it causes parallel function to also return, exiting the program.

If you wanted to run a program on exit, you could either add shell.run("<program name>") right at the bottom under parallel or add another function in to run after the parallel function has returned.

Hope this helps :)/>


for channels you can modify you recieve and send functions o the channel can be a text!!
Kinda like a label instead of number type thing? I could do something like that.


uhmmm. So I'm not sure why, but I'm on my friends server with this chat and whenever i join, leave, or chat, it says it twice…
I think you are printing it first.
Delete that line
(For example:
input = read()
print(input)
rednet.send(input)
rednet.receive()
)
delete 'print(input)' here

This was fixed ages ago…
momona5 #25
Posted 26 March 2013 - 07:45 AM
I've been trying for a while to make the chat program run something after, but I'm not sure how to do this. Help? I tried changing a couple things, but I'm not sure how your code works exactly with the whole "/exit" thing.

When you type '/exit' the function is called in the commands table (comD), it then queues the event 'exit' which the function 'exitEventListen' is waiting for, when that function returns it causes parallel function to also return, exiting the program.

If you wanted to run a program on exit, you could either add shell.run("<program name>") right at the bottom under parallel or add another function in to run after the parallel function has returned.

Hope this helps :)/>

- snip -



I tried tweaking this part. Gives me an error when i open some other things and has a little blinking cursor even when other programs are running.



function exitEventListen()
  while true do
	os.pullEvent("exit")
	modem.closeAll()
	term.clear()
	term.setCursorPos(1,1)
	shell.run("/mrom/menus/rednet")
	return exit
  end
end

also tried this




function exitEventListen()
  while true do
	os.pullEvent("exit")
	modem.closeAll()
	term.clear()
	term.setCursorPos(1,1)
	return
	shell.run("/mrom/menus/rednet")
  end
end



EDIT: The error it gave me was this:

parallel:22: serialize:1: attemp to index ? (a nil value)
spyman68 #26
Posted 26 March 2013 - 07:56 AM
You should check out Nova IRC
darkrising #27
Posted 27 March 2013 - 08:22 AM
–derp double post… —
darkrising #28
Posted 27 March 2013 - 08:24 AM
-snip-

Line 308:


  ["exit"] = {
	run = function()
	  rSend("has quit.", true)
	  os.queueEvent("exit")
	end,
	help = ""
  },

try:


  ["exit"] = {
	run = function()
	  rSend("has quit.", true)
	  os.queueEvent("exit")
	 shell.run("/mrom/menus/rednet")
	end,
	help = ""
  },
momona5 #29
Posted 01 April 2013 - 09:30 AM
I tried that and it just exits when I type /exit
and I have no clue why



EDIT: by exit, I mean it just drops you into the terminal and doesn't run the program.
darkrising #30
Posted 02 April 2013 - 10:17 PM
I tried that and it just exits when I type /exit
and I have no clue why



EDIT: by exit, I mean it just drops you into the terminal and doesn't run the program.

Okay, I'll look into it.
encrypted #31
Posted 02 July 2013 - 12:38 PM
Can you add a function to change your nickname by typing /nick followed by your username?
darkrising #32
Posted 02 July 2013 - 05:14 PM
Can you add a function to change your nickname by typing /nick followed by your username?

As you requested, I have now added this in :)/>
encrypted #33
Posted 02 July 2013 - 08:37 PM
Wow, that was fast. I was trying to figure out how to code it myself but i'm still learning this programming.
darkrising #34
Posted 03 July 2013 - 04:34 AM
Wow, that was fast. I was trying to figure out how to code it myself but i'm still learning this programming.

Yeah, I made this program to be extendible, its quite easy to add more commands, just make a new table in the comD table with a run function and help variable.

You can pretty much add whatever you want :)/>