March 28, 2024, 11:57:27 pm

Author Topic: Echo bot interfering with ! and /c prefixed commands  (Read 1705 times)

0 Members and 1 Guest are viewing this topic.

Sammael

  • Vice Underdogs (Inactive)
  • Regular
  • *
  • Posts: 58
  • Country: us
  • Current nick: Sachiko
    • View Profile
Echo bot interfering with ! and /c prefixed commands
« on: April 15, 2013, 05:48:43 pm »
Hate to be a bother again, being somewhat new to SQ... but the echo bot stuff WiLsOn handed me works...just interferes with the ! and /c prefixed commands in the server.

I pin-pointed it to this because it was the last thing added. I had added a /c reload command and a !fix command prior to adding the lines to echo from the server to the echo channel. Figured I'd ask here, try some fixes while waiting for an answer, and if I find an answer before an answer is received, compare any given and chose the best of the possibilities.

Since nobody has answered, I assume they want/need the code to look at. So here it is.

Code: [Select]
function onPlayerChat( player, text )
{
  if ( text )
  {
  if ( text.slice( 0, 1 ) == "!" )
  {
local i = NumTok( text, " " );

if ( i == 1 ) onPlayerCmd( player, GetTok( text.slice( 1 ).tolower(), " ", 1 ), null );
  else onPlayerCmd( player, GetTok( text.slice( 1 ), " ", 1 ).tolower(), GetTok( text.slice( 1 ), " ", 2, i ) );
  }
  }
 EchoMessage("["+player.ID+"] "+player.Name+": "+text);
}

function onPlayerJoin( player )
{
EchoMessage ( ICOL_LGREY + "[" + player.ID + "] " + ICOL_BROWN + player.Name + " has joined the server." );
}
function onPlayerPart( player, reasonid )
{
local reason = "Uknown";
switch ( reasonid )
{
case PARTREASON_DISCONNECTED:
reason = "Disconnected";
break;
case PARTREASON_TIMEOUT:
reason = "Timeout";
break;
case PARTREASON_KICKED:
reason = "Kicked";
break;
case PARTREASON_BANNED:
reason = "Banned";
break;
}
EchoMessage( ICOL_LGREY + "[" + player.ID + "] " + ICOL_BROWN + player.Name + " has left the server. " + ICOL_RED + "[" + reason + "]" );
}

The onPlayerChat is WiLsOn's. The onPlayerJoin is mine. And onPlayerPart is something I modified from LUIrc Echo. The last two parts work fine in conjunction with the ! and /c commands. But just showing all I have added to the Original FBS-Echo.nut so far to see if that could shed some light on why the echoing of player chat to the channel messes with the commands.
« Last Edit: April 17, 2013, 04:54:43 am by Sammael »
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor