Author Topic: Simple Coding Question  (Read 655 times)

I was jut wondering how to script out something say along these lines:
"on this chat message" (non-case-sensitive, and non-punctuation sensitive) "do this console command"

Anyone? I know the non-case-sensitive, and the non-punctuation sensitive might make everything complicated but still?

You can package the clientCmdChatMessage function.

for example:
Code: [Select]
package chatListener
{
function clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg)
{
parent::clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg);

if(%msg $= "Phrase here.")
doStuff();
}
};

This is client sided and will work for anyone who says the phrase.
EDIT: This is not case sensitive, but is punctuation sensitive.

You can package the clientCmdChatMessage function.

for example:
Code: [Select]
package chatListener
{
function clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg)
{
parent::clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg);

if(%msg $= "Phrase here.")
doStuff();
}
};

This is client sided and will work for anyone who says the phrase.
EDIT: This is not case sensitive, but is punctuation sensitive.
Like that old stuffty ass greetbot.
God, those things are annoying.

Like that old stuffty ass greetbot.
God, those things are annoying.
actually no, the "old" stuffty ass greetbot is packaging a function that is called whenever a line is written to the client, not when a chat message is written to the client
i believe it was something like NMHtype::newLine or something

Thanks Guys, so:
package chatListener
{
   function clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg)
   {
      parent::clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg);
      
      if(%msg $= "Hello")
         commandtosserver('messagesent', "Hello");
   }
};

Would do the thingy, ok, so how to I "Activate" the package and make it working?
and BTW thx for the help, and this is waterspear, but I got banned for no reason.

Thanks Guys, so:
package chatListener
{
   function clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg)
   {
      parent::clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg);
      
      if(%msg $= "Hello")
         commandtosserver('messagesent', "Hello");
   }
};

Would do the thingy, ok, so how to I "Activate" the package and make it working?
and BTW thx for the help, and this is waterspear, but I got banned for no reason.
activatePackage(chatListener);
This will get you banned from many servers by the way, people don't like chat bots, including me.

You were also banned for piracy, not for 'no reason'.