Author Topic: chatbot issue [solved]  (Read 1624 times)

I'm trying to make a chatbot but for some reason this won't work if I chat "test" without quotes
code:

Code: [Select]
package Robotron
{
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
{
Parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);

echo(%msg);
if (%msg $= "test")
{
commandToServer('messageSent',"Robotron: Hello World.");
}
}
};
activatePackage(Robotron);

what did I do wrong?
« Last Edit: December 08, 2011, 05:59:07 PM by zmaster »


Code: [Select]
package Robotron
{
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
{
Parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
%msg = stripMLControlChars(%msg);
echo(%msg);
if (%msg $= "test")
{
commandToServer('messageSent',"Robotron: Hello World.");
}
}
};
activatePackage(Robotron);
Try that.


thank you.
Quote
echo(%msg);
This is useless.
that was for seeing what %msg was

thank you.This is useless.

that was for seeing what %msg was
But it would always echo test because that is what you told it to look for.

...Considering TML isn't in chat...
Yes, it is.
But it would always echo test because that is what you told it to look for.
That makes no sense, the echo was just there so that he could see what the message was, it doesnt do anything else. Dont say it does something else, because it doesnt.

And your welcome zmaster.

Yes, it is.
Odd. I've never seen anyone have to actually do that.

I tried his first posted code and it worked fine : /

You say "test" and it'd work.

Odd. I've never seen anyone have to actually do that.

  • Server gets message.
  • Server removes any Torque Markup Language tags.
  • Server adds Torque Markup Language tags for http:// links if any are there.

You say "test" and it'd work.
In his original code you only had to say "test"(without the quotation marks) and it worked exactly how he desired.

  • Server gets message.
  • Server removes any Torque Markup Language tags.
  • Server adds Torque Markup Language tags for http:// links if any are there.
Yeah.  I had thought that was unnecessary since the server did that.