New Server chat code: private messages

What do you want to see in Armagetron soon? Any new feature ideas? Let's ponder these ground breaking ideas...
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

z-man wrote:Most needed instant chat bind:
/team Stop trying to kill me, you *****! WE ARE ON THE SAME TEAM!
They should have told me while I was testing it. I've done it a few times... but you can't really blame someone at a server with a base speed of 350 and where you can easily hit the clamp at 1000.

Code: Select all

/* got tired of typing that all the time */
#define COLORSTR(r,g,b) (tColoredString::ColorString((r),(g),(b)))
#define COLORSTROBJ(o) (tColoredString::ColorString((o)->r/15.0,(o)->g/15.0,(o)->b/15.0))

/* untested but compiles */
if(say.StartsWith("/tl")) {
    tColoredString players;
    tColoredString whitecolor;
    whitecolor << COLORSTR(1,1,1);
    eTeam *team = p->CurrentTeam();
    int numplayers = team->NumPlayers();
    for(int i=0; i<numplayers; i++) {
        ePlayerNetID *netid = team->Player(i);
        players << whitecolor << netid->Owner() << ": " << COLORSTROBJ(netid) << netid->name << '\n';
    }
    sn_ConsoleOut(players, p->Owner());
    return;
}
Edit: changed from /lteam to /tl.
ˌɑrməˈɡɛˌtrɑn
User avatar
dlh
Formerly That OS X Guy
Posts: 2035
Joined: Fri Jan 02, 2004 12:05 am
Contact:

Post by dlh »

nice idea. Sometimes you enter a server while others are playing, and your are not immediately put on a team. What happens when you /tl?

Edit: I'd also change the first line to if(say.StartsWith("/tl") || say.StartsWith("/team")) {
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

nemostultae wrote:nice idea. Sometimes you enter a server while others are playing, and your are not immediately put on a team. What happens when you /tl?
It displays whatever is in CurrentTeam(). If you're put in a team only containing you it's OK, if there's no team it likely blows up.
Edit: I'd also change the first line to if(say.StartsWith("/tl") || say.StartsWith("/team")) {
I wouldn't because /team (could be /tm=team message?) is a message and /tl is a list. ;) Note that the space after /team is intentional.
ˌɑrməˈɡɛˌtrɑn
User avatar
dlh
Formerly That OS X Guy
Posts: 2035
Joined: Fri Jan 02, 2004 12:05 am
Contact:

Post by dlh »

Jonathan wrote:It displays whatever is in CurrentTeam(). If you're put in a team only containing you it's OK, if there's no team it likely blows up.
yes, i was concerned about the no team, which happens when you enter during a round in progress. And concerning /tl, doh. :o
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

Looks like we need this:

Code: Select all

if(team == NULL) {
    sn_ConsoleOut(errorcolor << "You're not in a team yet\n", p->Owner());
    return;
}
ˌɑrməˈɡɛˌtrɑn
User avatar
joda.bot
Match Winner
Posts: 421
Joined: Sun Jun 20, 2004 11:00 am
Location: Germany
Contact:

Post by joda.bot »

hi

Do you plan to separate the "server side" commands (e.g. "/msg player text", the "/team" or "{adminpw}") from the ePlayer.cpp ?

I'd really like to have a separate class for these commands, and perhaps you'd be interested in my teamname implementation ?
http://guru3.sytes.net/viewtopic.php?t=1735

The implementation used the same "hook" to allow players with older clients to change their teamname.

I also have some ideas to improve team balancing, as the current cvs HEAD seems to use the old 2.6.0 code.

I'd suggest that EVERY chat message that starts with a "/" is only processed by the eConsole.cpp (or whatever you call it).
These "/" message should not be relayed to the other clients which increases securtiy and useability.
This would allow a clean way to add further options for a server, which can be triggered by any client. There probably is no need to change the client code , is there ?

Hope someone answers this time...
joda.bot
PS: my teamname post got no replys :(
User avatar
dlh
Formerly That OS X Guy
Posts: 2035
Joined: Fri Jan 02, 2004 12:05 am
Contact:

Post by dlh »

I'd suggest that EVERY chat message that starts with a "/" is only processed by the eConsole.cpp (or whatever you call it).
These "/" message should not be relayed to the other clients which increases securtiy and useability. This would allow a clean way to add further options for a server, which can be triggered by any client. There probably is no need to change the client code , is there?
INAAAD (I'm not an Armagetron Advanced Developer), but this is how "pwd 'admin commands'" and /msg work currently. They are not broadcasted to every client, just sent to p->Owner() and the person being messaged.

I've been working on the /msg code to add string matching. This solves the messaging of people with color code in their name and odd characters. So if Player 1 and I were in a server, I could do /msg P to send Player 1 a message. Its not done yet, though.
User avatar
Tank Program
Forum & Project Admin, PhD
Posts: 6711
Joined: Thu Dec 18, 2003 7:03 pm

Post by Tank Program »

joda.bot wrote:Do you plan to separate the "server side" commands (e.g. "/msg player text", the "/team" or "{adminpw}") from the ePlayer.cpp ?

I'd really like to have a separate class for these commands

[...]

I'd suggest that EVERY chat message that starts with a "/" is only processed by the eConsole.cpp (or whatever you call it).
These "/" message should not be relayed to the other clients which increases securtiy and useability.
This would allow a clean way to add further options for a server, which can be triggered by any client. There probably is no need to change the client code , is there ?
Somewhere, I wrote up some plans for fixing this and yes relocating it...
Image
Post Reply