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

[1.0.0] Chatty - A network chatter - Now with user commands!

Started by Mackan90096, 29 March 2015 - 09:17 AM
Mackan90096 #1
Posted 29 March 2015 - 11:17 AM
Chatty

A way to communicate



Chatty is a chat program that runs on network cables.

It currently has features such as
  • Name changing
  • Recieve messages while typing one
  • Action commands.
  • A message when a user changes their nickname
  • Messages when users join and leave
  • Making your own commands!
To get Chatty, do

pastebin get CQpx4kVm Chatty

Then run Chatty.

To be able to use Chatty, you need to have a wired modem on your computer. You'll also need to connect every computer you want to be able to chat in the network with cables.

Pictures you say?
SpoilerRight after running:



A user has joined!



A user uses the /me command



Bob changed his name



A user sent a message by pressing enter, typing the message and pressing enter again!




A user has left


User commads
To make your own commands, go into the chatty program using edit.
In there, look for


local cmds = {
    ["me"] = {
        ["does"] = function(args)
            send('* '..name..' '..args) 
        end
    },
    ["nick"] = {
        ["does"] = function(nc)
            send(name..' is now known as '..nc)
            name=nc
        end
    }
}

Edit this to your preferences.
For example, let's say we want a command that reverses what the user typed.
We'd do this;


local cmds = {
    ["me"] = {
        ["does"] = function(args)
            send('* '..name..' '..args) 
        end
    },
    ["nick"] = {
        ["does"] = function(nc)
            send(name..' is now known as '..nc)
            name=nc
        end
    },
    ["reverse"] = { -- ["reverse"] is the command (The text after the / character)
        ["does"] = function(args) -- ["does"] is what the command does and args is the arguments. This is required for the command to function
            print(args:reverse())
        end
    }
}
Edited on 23 April 2015 - 06:19 AM
Creator #2
Posted 29 March 2015 - 11:34 AM
Nice work. Keep up the good work.
LDDestroier #3
Posted 26 April 2015 - 08:25 PM
Nice! Are there seperate channels? And can you set permissions for commands?
Mackan90096 #4
Posted 09 May 2015 - 09:28 AM
Nice! Are there seperate channels? And can you set permissions for commands?

You can setup separate channels by changing the
channel
variable. This will however be made changable by a command later on.

You cannot currently set permissions for commands, altough I'll look into adding it.