Author Topic: Chat Bot  (Read 653 times)

Could someone help me fix this??


Code: [Select]
package KatBot
{
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
{
Parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
if(isObject(KatBot))
{
switch$(%msg)
{

case "Good":
commandToServer('messageSent', "KatBot: Thats not good, thats great!"); break;

case "lol":
commandToServer('messageSent', "KatBot: HAHAHAHAHAHAHA I don't get it..."); break;

case "derp":
commandToServer('messageSent', "KatBot: Herp-a-Derp"); break;

case "wtf":
commandToServer('messageSent', "KatBot: What the Fail!? I don't understand human language at all..."); break;

case "KatBot":
commandToServer('messageSent', "KatBot: WUT?!!??!?"); break;

case "Cool":
commandToServer('messageSent', "KatBot: I am not Cold!"); break;

case "idk":
commandToServer('messageSent', "KatBot: You don't know!? Everyone knows!"); break;

case "What?":
commandToServer('messageSent', "KatBot: You heard him!"); break;

case "Wait":
commandToServer('messageSent', "KatBot: No YOU wait, MY game, MY rules!"); break;

case "shut up":
commandToServer('messageSent', "KatBot: No you shut up!"); break;

case "no you shut up":
commandToServer('messageSent', "KatBot: No YOU do the shutting up thing!"); break;

case "afk":
commandToServer('messageSent', "KatBot: Quick, he's going afk! Do all sorts of annoying stuff to him before he comes back!"); break;

case "cake":
commandToServer('messageSent', "KatBot: LIES! THERE IS NO CAKE!!"); break;

case "That makes KatBot sad":
commandToServer('messageSent', "KatBot: WAAAAAA I'M FEELING SIMULATED SADNESS!!"); break;

case "who are you?":
commandToServer('messageSent', "KatBot: To tell the truth, I have no ideaÉ"); break;

case "your stupid":
commandToServer('messageSent', "KatBot: WellÉ since I am a computer program, I am smarter than you..."); break;

case "your mom":
commandToServer('messageSent', "KatBot: I don't have a mom, I am a computer program."); break;

case "bye":
commandToServer('messageSent', "KatBot: BYE! DON'T COME BACK!!"); break;

case "gtg":
commandToServer('messageSent', "KatBot: Get The Girl? How would I do that? all ChatBots are boys!"); break;

case "KatBot Off":
KatBot.off(); break;
}
}
}
};
activatePackage(KatBotOn);

//Greeting
package KatBotGreet
{
function newChatHud_addLine(%text)
{

Parent::newChatHud_addLine(%text);
if(%text $="connected.")
{
KatBot.Greet();
}
}
};
activatePackage(KatBotGreet);

function KatBotOn()
{
new ScriptObject(KatBot)
{
Greeting[1] = "Hello.";
Greeting[2] = "Hey.";
Greeting[3] = "Welcome.";
Greeting[4] = "Hi.";
Greeting[5] = "Hey there.";
};
}

function KatBot::Greet(%this)
{
      if(!isObject(%this)) return;
      %num = getRandom(1,5);
      commandtoserver('messagesent',"KatBot: " @ %this.Greeting[%num]);
     
}

if (!$addedKatBotKeys)
{
$remapDivision[$remapCount] = "Kat Bot";
$remapName[$remapCount] = "KatBot On";
$remapCmd[$remapCount] = "KatBotOn";
$remapCount++;
$remapName[$remapCount] = "KatBot Off";
$remapCmd[$remapCount] = "KatBot.Off";
$remapCount++;
$addedTrueBotKeys = true;
}

function KatBot::Off(%this)
{
if(!isObject(%this))return;
KatBot.delete();
}

package KatBotOn
{
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
{
Parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
switch$(%msg)
{

case "KatBot On":
KatBotOn(); break;
}
}
}'
activatePackage(KatBotOn);

You aren't activating the first package.

The code looks like it was taken from Script_KillBot.

Code: [Select]
activatepackage KatBot
{
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
{
Parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
if(isObject(KatBot))
{
switch$(%msg)
{

case "Good":
commandToServer('messageSent', "KatBot: Thats not good, thats great!"); break;

case "lol":
commandToServer('messageSent', "KatBot: HAHAHAHAHAHAHA I don't get it..."); break;

case "derp":
commandToServer('messageSent', "KatBot: Herp-a-Derp"); break;

case "wtf":
commandToServer('messageSent', "KatBot: What the Fail!? I don't understand human language at all..."); break;

case "KatBot":
commandToServer('messageSent', "KatBot: WUT?!!??!?"); break;

case "Cool":
commandToServer('messageSent', "KatBot: I am not Cold!"); break;

case "idk":
commandToServer('messageSent', "KatBot: You don't know!? Everyone knows!"); break;

case "What?":
commandToServer('messageSent', "KatBot: You heard him!"); break;

case "Wait":
commandToServer('messageSent', "KatBot: No YOU wait, MY game, MY rules!"); break;

case "shut up":
commandToServer('messageSent', "KatBot: No you shut up!"); break;

case "no you shut up":
commandToServer('messageSent', "KatBot: No YOU do the shutting up thing!"); break;

case "afk":
commandToServer('messageSent', "KatBot: Quick, he's going afk! Do all sorts of annoying stuff to him before he comes back!"); break;

case "cake":
commandToServer('messageSent', "KatBot: LIES! THERE IS NO CAKE!!"); break;

case "That makes KatBot sad":
commandToServer('messageSent', "KatBot: WAAAAAA I'M FEELING SIMULATED SADNESS!!"); break;

case "who are you?":
commandToServer('messageSent', "KatBot: To tell the truth, I have no ideaÉ"); break;

case "your stupid":
commandToServer('messageSent', "KatBot: WellÉ since I am a computer program, I am smarter than you..."); break;

case "your mom":
commandToServer('messageSent', "KatBot: I don't have a mom, I am a computer program."); break;

case "bye":
commandToServer('messageSent', "KatBot: BYE! DON'T COME BACK!!"); break;

case "gtg":
commandToServer('messageSent', "KatBot: Get The Girl? How would I do that? all ChatBots are boys!"); break;

case "KatBot Off":
KatBot.off(); break;
}
}
}
};
activatePackage(KatBotOn);

//Greeting
package KatBotGreet
{
function newChatHud_addLine(%text)
{

Parent::newChatHud_addLine(%text);
if(%text $="connected.")
{
KatBot.Greet();
}
}
};
activatePackage(KatBotGreet);

function KatBotOn()
{
new ScriptObject(KatBot)
{
Greeting[1] = "Hello.";
Greeting[2] = "Hey.";
Greeting[3] = "Welcome.";
Greeting[4] = "Hi.";
Greeting[5] = "Hey there.";
};
}

function KatBot::Greet(%this)
{
      if(!isObject(%this)) return;
      %num = getRandom(1,5);
      commandtoserver('messagesent',"KatBot: " @ %this.Greeting[%num]);
     
}

if (!$addedKatBotKeys)
{
$remapDivision[$remapCount] = "Kat Bot";
$remapName[$remapCount] = "KatBot On";
$remapCmd[$remapCount] = "KatBotOn";
$remapCount++;
$remapName[$remapCount] = "KatBot Off";
$remapCmd[$remapCount] = "KatBot.Off";
$remapCount++;
$addedTrueBotKeys = true;
}

function KatBot::Off(%this)
{
if(!isObject(%this))return;
KatBot.delete();
}

package KatBotOn
{
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
{
Parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
switch$(%msg)
{

case "KatBot On":
KatBotOn(); break;
}
}
}'
activatePackage(KatBotOn);
Like that?

I don't know what the hell you changed, but change this:
Code: [Select]
case "KatBot Off":
KatBot.off(); break;
}
}
}
};
activatePackage(KatBotOn);
to this:
Code: [Select]
case "gtg":
commandToServer('messageSent', "KatBot: Get The Girl? How would I do that? all ChatBots are boys!"); break;

case "KatBot Off":
KatBot.off(); break;
}
}
}
};
activatePackage(KatBot);

Note the final line, KatBotOn to KatBot

Also this:package KatBotOn
{
   function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
   {
      Parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
            switch$(%msg)
               {

            case "KatBot On":
            KatBotOn(); break;
               }
   }
}'
activatePackage(KatBotOn);
Change the bolded part to this:
};

ok clearly you don't actually know what you're doing

it's not necessary to have a scriptobject for any of this

you can remove all that scriptobject nonsense and just do if($KatbotOn).

and another thing, what i meant was after the first package, you're activating KatBotOn, not KatBot. Thus, the actual functions of KatBot don't work.

otto
he didn't write this

otto
he didn't write this
i knew this from the start but i didn't want to say anything
clearly he doesn't actually know what he's doing