I'm trying to improve the GreetBot, but I'm having trouble.
Appears I have some syntax errors.
package niceToGreetYou
{
function newChatHud_addLine(%text)
{
//Called when any line of text is added to the chat box
Parent::newChatHud_addLine(%text);
//This will turn the "Destiny connected." into "Destiny"
%nameToGreet = strReplace(%text," connected.","");
//If the %nameToGreet variable is different to the original line greet them,
//otherwise it's something else
if(%nameToGreet !$= %text)
{
//Send a chat message saying hi to the player who joined (%nameToGreet)
%name = getWord(%msg,1);
%Greet[1] = Hey,;
%Greet[2] = Hello,;
%Greet[3] = Watsup,;
%Choose = %Greet[getRandom(1,3)];
schedule(1000,0,commandToServer,'messageSent',""@%Choose@" "@%nameToGreet@"");
}
}
};
activatePackage(niceToGreetYou);
package OnOff
{
function NMH_type::Send(%this)
{
%msg = %this.getValue();
parent::Send(%this);
if($On)
{
if(strPos(%msg,"^GreetBotOff") $= 0)
{
schedule(1000,0,clientCmdServerMessage,'messageSent',"GreetBot is now on.");
$On = 0;
}
}
else
{
if(strPos(%msg,"^GreetBotOn") $= 0)
{
schedule(1000,0,clientCmdServerMessage,'',"GreetBot is now off.");
$On = 1;
}
}
}
};
activatePackage(OnOff);
I'd also like to make it only greet the people you have
build trust or full trust with. First, I want to get the syntax error/errors
out of the way.