Anonymous Anonymous - 5 months ago
1565 0

script i use to chat supa fast in hackmud and make it colorful


hackmud chat script

function(context, args) { // m:"", c:""    [The javascript comment here allows the script to autocomplete, meaning you press tab to be brought to the m:"" arg automatically, and again for c:""]
    var m = "`h" + args.m + "`"     [Here I add color to my text. All it does is assign the m arg from my input to a string and adds backticks to the start and end. The h is the color ID]
    if (args.c == "" ) {    [If I do not give any data the the c arg, I want it to chat to 0000 automatically. This saves me typing 0000 every time because that is where I normally chat]
        return #s.chats.send({ channel:"0000", msg:m }) }    [This sends out the message to the 0000 channel]
    var c = args.c     [If there is something in the c field, I treat it as a user and send a tell to that user with the message m]
    return #s.chats.tell({ to:c, msg:m })     [Here I send that message]