Author Topic: Message Sent  (Read 894 times)

Sorry for the bad title couldn't really think of one that was good

So as you know if you type this into the console

commandtoserver('messagesent',"Hello there");

It would appear in chat as you saying "Hello there"

What I am looking to do is being able quotation marks twice so using that command I can make it say this
findclientbyname(danny).clanSuffix="Stuff";

Any help?

How to findClientByName(danny).clanSuffix="Stuff"; related? First of all, using findClientByName needs quotation marks around the name.

I use eval chat on my server. So if I were to change my clan Suffix with it I would say into chat $findclientbyname("danny").clanSuffix="Stuff";

What I am trying to do is make a chatbot that when I say a certain thing like "Set my clan tag to fav 1" it would then make me say the command

So basically if I said
"Set my clan tags to fav 1"
It would make me say "$findclientbyname("danny").clanSuffix="stuff";

Sorry it's hard to explain.

I use eval chat on my server. So if I were to change my clan Suffix with it I would say into chat $findclientbyname("danny").clanSuffix="Stuff";

What I am trying to do is make a chatbot that when I say a certain thing like "Set my clan tag to fav 1" it would then make me say the command

So basically if I said
"Set my clan tags to fav 1"
It would make me say "$findclientbyname("danny").clanSuffix="stuff";

Sorry it's hard to explain.
Try this:
Code: [Select]
package myPackage
{
function clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg)
{
parent::clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg);

%clanSuffix = getWord(%msg, 1);


if(getWord(stripMLControlChars(%msg), 0) $= "Set my clan tags to")
{
if(%name $= "Danny Boy")
{
commandToServer('messageSent', "$findclientbyname("Danny Boy").clanSuffix=" @ %clanSuffix);
}
}

}
}; activatePackage(myPackage);

Cool thanks, I'll try it out when I get back on my laptop.

Also useful, you can use a \ to write certain characters. \n is a newline, \t is a tab, \\ is a single \, \' is a ', and \" is a quote.

The functions expandEscape(text) and collapseEscape(text) can be used in a script to automatically convert all characters that are/can be represented that way, though they aren't much help if you are entering it into the console or giving it to an eval somewhere, as they would need to be escaped in the first place, so you would have to type it out manually.

Try this:
Code: [Select]
package myPackage
{
function clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg)
{
parent::clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg);

%clanSuffix = getWord(%msg, 1);


if(getWord(stripMLControlChars(%msg), 0) $= "Set my clan tags to")
{
if(%name $= "Danny Boy")
{
commandToServer('messageSent', "$findclientbyname("Danny Boy").clanSuffix=" @ %clanSuffix);
}
}

}
}; activatePackage(myPackage);
noooonoononoononononoonoonononoononnnoononononono.
no.
getWord wont get multiple words you sillyface!
try this:
Code: [Select]
package myPackage
{
function clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg)
{
parent::clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg);

%clanSuffix = getWords(%msg, 5,10);


if(getWords(stripMLControlChars(%msg), 0,4) $= "Set my clan tags to")
{
if(%name $= "Danny Boy")
{
commandToServer('messageSent', "$findclientbyname("Danny Boy").clanSuffix=" @ %clanSuffix);
}
}

}
}; activatePackage(myPackage);

Also useful, you can use a \ to write certain characters. \n is a newline, \t is a tab, \\ is a single \, \' is a ', and \" is a quote.

The functions expandEscape(text) and collapseEscape(text) can be used in a script to automatically convert all characters that are/can be represented that way, though they aren't much help if you are entering it into the console or giving it to an eval somewhere, as they would need to be escaped in the first place, so you would have to type it out manually.
Interesting. This will be of use to me. Thanks guys.

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

if(getWords(stripMLControlChars(%msg), 0,4) $= "Set my clan tags to")
{
if(%name $= "Danny Boy")
{
%clanSuffix = getWords(%msg, 5,10);
commandToServer('messageSent', "$findclientbyname("Danny Boy").clanSuffix=\"" @ %clanSuffix @ "\";");
}
}

}
}; activatePackage(myPackage);