Author Topic: Check chat, and reply  (Read 1017 times)

I want a client side script that checks the server text. If it is called by something, then it makes me say something.

How it should look:

SuperMario: Boom Bot: I hate you
Boom: Boom Bot -> I hate you too.

Simple enough, right?

For the string parsing, there is a large list of string functions here.

For the string parsing, there is a large list of string functions here.
Hurr thats what i study off of :)

For the string parsing, there is a large list of string functions here.

This helps, but I do not wish to manipulate strings. I just want to check the chat for certain messages, then reply to that message.

Think of it as <var:client:lastmsg>, but for the entire server.

This helps, but I do not wish to manipulate strings. I just want to check the chat for certain messages, then reply to that message.

Think of it as <var:client:lastmsg>, but for the entire server.
You do want to manipulate the string, because likely you want to convert a message into commands - whether you actually modify the string or just read it over, it's string manipulation.

Damn it just tell him what function to override.

Its some function used by newChatText.
Try packaging newChatText.addtext("text",true)

Code: [Select]
package BoomBot {
   function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
   {
        parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
        if(getWords(%msg,0,2) $= "Block Bot:")
        {
             BlockBotParseMessage(%name, getWords(%msg,2));
        }
    }
};
activatePackage(BoomBot);
I don't know what %a, %b, and %c are, but %fmsg is the full message, %cp is clan prefix, %name is obvious, %cs is clan suffix, and %msg is message.

EDIT:
Damn it just tell him what function to override.

Its some function used by newChatText.
Try packaging newChatText.addtext("text",true)
I believe you're thinking of NewMessageHud::onLine, which would be a bitch and a half to overwrite.
« Last Edit: April 21, 2010, 10:28:27 PM by Triple Nickels »

Code: [Select]
package BoomBot {
   function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
   {
        parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
        if(getWords(%msg,0,2) $= "-> Boom Bot:")
        {
             BoomBotParseMessage(%name, getWords(%msg,2));
        }
    }
};
activatePackage(BoomBot);
I don't know what %a, %b, and %c are, but %fmsg is the full message, %cp is clan prefix, %name is obvious, %cs is clan suffix, and %msg is message.

EDIT:I believe you're thinking of NewMessageHud::onLine, which would be a bitch and a half to overwrite.

Wouldn't that just make my messages "Boom: -> Boom Bot: What I was saying". I want it to repsond to my chat. Not make another person so that I can talk to myself.

I think I have it:

Code: [Select]
package BoomBot
{
function serverCmdmessageSent(%client, %text)
{

if(strstr(%text, "I Hate You") >= 0) //What you want to check for
{
                                                       commandToServer('MessageSent', " -> BoomBot: I hate You too."); //Makes you speak.
              }

parent::serverCmdmessageSent(%client, %text);
}
};
activatePackage(BoomBot);

Any errors, please do correct me.

I really dislike these chat bots because there's barely any purpose to them aside from spamming the chat.

I think I have it:

Code: [Select]
package BoomBot
{
function serverCmdmessageSent(%client, %text)
{

if(strstr(%text, "I Hate You") >= 0) //What you want to check for
{
                                                       commandToServer('MessageSent', " -> BoomBot: I hate You too."); //Makes you speak.
              }

parent::serverCmdmessageSent(%client, %text);
}
};
activatePackage(BoomBot);

Any errors, please do correct me.

I'll try this. Thanks.



I really dislike these chat bots because there's barely any purpose to them aside from spamming the chat.

Boom: Boom Bot: Insult the noob.
Boom: -> Boom Bot: That noob is a stupid monday.

lol. :D