Blockland Forums > Modification Help

chatbot issue [solved]

Pages: (1/3) > >>

zmaster:

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


--- Code: ---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);
--- End code ---

what did I do wrong?

jes00:


--- Quote from: zmaster on December 08, 2011, 06:40:47 PM ---
--- Code: ---echo(%msg);

--- End code ---

--- End quote ---
This is useless.

Ipquarx:


--- Code: ---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);
--- End code ---
Try that.

otto-san:


--- Quote from: Ipquarx on December 08, 2011, 06:57:06 PM ---
--- Code: ----snip-
--- End code ---
Try that.

--- End quote ---
...Considering TML isn't in chat...

zmaster:

thank you.

--- Quote from: jes00 on December 08, 2011, 06:56:52 PM ---
--- Quote ---echo(%msg);
--- End quote ---
This is useless.

--- End quote ---
that was for seeing what %msg was

Pages: (1/3) > >>

Go to full version