[script] tell

[script] tell

Postby bonifarz » 01 Oct 2013, 13:09

Here is another small utility i would like to share here. I find myself frequently typing playernames at the beginning of chat messages. It turns out that some sort of tab-completion for this is quite convenient. For simplicity, i prefix these commands with tell_, which is not to be confused with private messaging. All this does is a simple /saycommand with the corresponding player name and the color specified in the script.

EDIT: No more trouble with spaces and [] in playernames *facepalm*

{l Code}: {l Select All Code}
// tell scipt by Bonifarz:
// Creates aliases with tab-completion
// for chat messages starting with a playername.

chatcolour = (concatword "^f[" $playercolour "]")
tellnames = ""

tellupdate = [
    echo "executing /tellupdate, current player aliases:"
    looplist tt $tellnames [
        setcomplete $tt 0
    ]
    tellnames = ""
    loop i $serverclients [
        if (! (isai $i)) [
            t = (getclientname $i)
            if (strlen $t) [
                tt = (concatword "tell_" $t)
                tt = (strreplace $tt "[" "_")
                tt = (strreplace $tt "]" "_")
                tt = (strreplace $tt " " "_")
                $tt = [ saycommand $chatcolour @t," "]
                append tellnames $tt
                setcomplete $tt 1
                echo $tt
            ]
        ]
    ]
]

setcomplete "tellupdate" 1
tellupdate
User avatar
bonifarz
 
Posts: 379
Joined: 09 Apr 2012, 12:16
Location: switzerland

Who is online

Users browsing this forum: No registered users and 1 guest