Author Topic: Help with server bot  (Read 1428 times)

So I made a post a while ago about a server chatbot I was making.

So I go on today after not being on for a couple of months and suddenly it stopped working.
Whenever I type a command, nothing comes out.
There are no errors in the console, and the code is the same from the thread, which is
Code: [Select]
package chatbot
{
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
{
parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);

if(%msg $= "MB>Index")
{
commandToServer('messageSent',"MagicBot: Commands, Rules, News");
}
if(%msg $= "MB>Commands")
{
commandToServer('messageSent',"MagicBot: MBAnno:restwords");
}
if(firstWord(%msg) $= "MBAnno:")
{
commandToServer('messageSent',"MagicBot: "@restWords(%msg));
}
}
};
activatepackage(chatbot);

But when I, say, type MB>Index, nothing happens.
No text, no nothing.
And as I said there are no errors in the console, so I really don't know what is happening.

Your chatbot is useless and not server-sided like you stated in the title

Your chatbot is useless and not server-sided like you stated in the title
So explain to me how to make it server sided.
Also, if you aren't going to help, don't post. You didn't help in that other thread I needed help in either, when I was asking about game creation.

Bump, this still won't work.

package chatbot
{
   function serverCmdMessageSent(%this,%msg)
   {
      switch$(%msg)
      {
         default:
            messageClient(%this,'',"MagicBot: Commands, Rules, News");
            return;
         case "MB Commands":
            messageClient(%this,'',"MagicBot: MBAnno:restwords");
            return;
         case "MB Anno":
            messageClient(%this,'',"MagicBot: " @ restWords(%msg));
            return;
      }
      Parent::serverCmdMessageSent(%this,%msg);
   }
};
activatepackage(chatbot);


It needs to have serverCmd for it to be server-sided. (Or a function that is not client-sided, but without serverCmd it would be more difficult)

You could use this as well:

package MBCommands
{
   function serverCmdMB(%this,%msg)
   {
      switch$(%msg)
      {
         default:
            messageClient(%this,'',"MagicBot: Commands, Rules, News");
            return;
         case "MB Commands":
            messageClient(%this,'',"MagicBot: MBAnno:restwords");
            return;
         case "MB Anno":
            messageClient(%this,'',"MagicBot: "@ restWords(%msg));
            return;
      }
   }
};
activatepackage(MBCommands);
« Last Edit: November 29, 2013, 03:09:34 PM by Advanced Bot »

package chatbot
{
   function serverCmdMessageSent(%this,%msg)
   {
      switch$(%msg)
      {
         default:
            messageClient(%this,'',"MagicBot: Commands, Rules, News");
            return;
         case "MB Commands":
            messageClient(%this,'',"MagicBot: MBAnno:restwords");
            return;
         case "MB Anno":
            messageClient(%this,'',"MagicBot: " @ restWords(%msg));
            return;
      }
      Parent::serverCmdMessageSent(%this,%msg);
   }
};
activatepackage(chatbot);


It needs to have serverCmd for it to be server-sided. (Or a function that is not client-sided, but without serverCmd it would be more difficult)

You could use this as well:

package MBCommands
{
   function serverCmdMB(%this,%msg)
   {
      switch$(%msg)
      {
         default:
            messageClient(%this,'',"MagicBot: Commands, Rules, News");
            return;
         case "MB Commands":
            messageClient(%this,'',"MagicBot: MBAnno:restwords");
            return;
         case "MB Anno":
            messageClient(%this,'',"MagicBot: "@ restWords(%msg));
            return;
      }
   }
};
activatepackage(MBCommands);

How would I convert the one I posted to server sided?
Or atleast how would I get it to actually work is the question.
The reason I ask this is because there are some other commands and stuff I have been working on for it, and I don't really know how I would transfer them over.

How would I convert the one I posted to server sided?
You copy the first block of code that visolator posted and replace your code with it after a few modifications.

package chatbot
{
   function serverCmdMessageSent(%this,%msg)
   {
      
Parent::serverCmdMessageSent(%this,%msg);
      switch$(%msg)
      {
        
default:
        
case "MB Index":
            messageClient(%this,'',"MagicBot: Commands, Rules, News");
            
return;
         case "MB Commands":
            messageClient(%this,'',"MagicBot: MBAnno:restwords");
            
return;
         case "MB Anno":
            messageClient(%this,'',"MagicBot: " @ restWords(%msg));
            
return;
      }
      
Parent::serverCmdMessageSent(%this,%msg);
   }
};
activatepackage(chatbot);
« Last Edit: November 29, 2013, 03:57:41 PM by Zeblote »

You copy the first block of code that visolator posted and replace your code with it.
Thats something entirely different that uses messageclient instead of commandtoserver.

So how would I make commandtoserver work? most of the things im adding are made for that, and most of the times ive tried using messageclient nothing happened or it gave me an error.

Thats something entirely different that uses messageclient instead of commandtoserver.

So how would I make commandtoserver work? most of the things im adding are made for that, and most of the times ive tried using messageclient nothing happened or it gave me an error.
commandtoserver is client-sided.

commandtoserver is client-sided.
well crap

EDIT: Can you atleast try to explain why the script suddenly stopped working?
« Last Edit: November 29, 2013, 04:11:26 PM by Gsterman »

EDIT: Can you atleast try to explain why the script suddenly stopped working?

Could you post the current code?


bump, need help with this