Blockland Forums > Modification Help
My chatbot is not working
<< < (5/23) > >>
Port:

--- Quote from: Deoxys And One Noob on December 31, 1969, 07:00:13 PM ---Description.txt:

"NoobBot, Deoxys & One Noobs cool chatbot"

--- End quote ---

description.txt


--- Quote ---Title: NoobBot
Author: Deoxys & One Noob

--- End quote ---
FFSO:
package chatbot
{
   function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
   {
      parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
      switch(%msg $= "NoobBot" && %name $= "Deoxys & One Noob")
      {
            commandToServer('messageSent', "What a cool chatbot!");
      }
   }
};
activatePackage(chatbot);

Should work now
Chrono:
No, that still shouldn't work.
Port:

--- Code: ---package chatbot
{
function clientCmdChatMessage( %cl, %voice, %pitch, %line, %pre, %name, %suf, %msg )
{
parent::clientCmdChatMessage( %cl, %voice, %pitch, %line, %pre, %name, %suf, %msg );
%self = ( %name $= $Pref::Player::NetName );

switch$ ( %msg )
{
case "NoobBot":
if ( %self )
{
commandToServer( 'messageSent', "What a cool chatbot!" );
}
}
}
};

activatePackage( "chatbot" );
--- End code ---
Wordy:

--- Quote from: Port on March 10, 2012, 12:50:17 AM ---
--- Code: ---package chatbot
{
function clientCmdChatMessage( %cl, %voice, %pitch, %line, %pre, %name, %suf, %msg )
{
parent::clientCmdChatMessage( %cl, %voice, %pitch, %line, %pre, %name, %suf, %msg );
%self = ( %name $= $Pref::Player::NetName );

switch$ ( %msg )
{
case "NoobBot":
if ( %self )
{
commandToServer( 'messageSent', "What a cool chatbot!" );
}
}
}
};

activatePackage( "chatbot" );
--- End code ---

--- End quote ---
What makes Switch different? I don't understand how switch should/could be used.
Navigation
Message Index
Next page
Previous page

Go to full version