I'm having problems figuring out how to do the following:
$Answer[0] = "I'm AFK right now."
$Answer[1] = "I'm AFK at the moment."
$Answer[2] = "I'm AFK."
$Answer[3] = "AFK, ask me later."
package AFKBot
{
function serverCmdMessageSent(%client, %text)
{
for (%i = 0; %i < getWordCount(%text); %i++)
{
%t = getWord(%text,%i);
if (%t $= "#")
{
schedule(1000,0,messageAll,'',"<color:FFFF00>General<color:FFFFFF>: " @ $Answer[getRandom(3)]);
}
}
parent::serverCmdMessageSent(%client, %text);
}
};
activatePackage(AFKBot);
The code just checks for the word I enter where the red number symbol is, if the word is Hello and somebody says: "Hello, how's it going General?" It will return a message. I want it to check for two or more words in that sentence to return the message, for example: "Hello, how's it going General?" Both Hello and General...
I hope I made myself as clear as possible, help would be much appreciated. Thanks.