Author Topic: Chat responce  (Read 1257 times)


Yes, doesn't work

:O but... i did the same exact thing and it worked... UNLESS you have those commands within the package. if they are inside it, they wont work

:O but... i did the same exact thing and it worked... UNLESS you have those commands within the package. if they are inside it, they wont work
I want to post the script but I do not think Poiuyt would let me since he gave me it. It is a client script though.

I want to post the script but I do not think Poiuyt would let me since he gave me it. It is a client script though.
you could just pm it to truce or me, not share to the whole forums

Poiuyt said that a PM to truce is allowed. Truce, would you mind?

Poiuyt said that a PM to truce is allowed. Truce, would you mind?

Yes, I would. Don't PM me.
Also, just read through your script -- the errors are obvious if you read it carefully.

It worked without the Cmd. Before it just had activate packages things after every package.

I have this
Code: [Select]
function serverCmdHeedboton(%client)
{
activatePackage(spawk);
};

package spawk
{
function clientCmdChatMessage(%c,%a,%b,%fmsg,%cs,%name,%cp,%msg)

{
stuffherenotallowedtopost
}};

Do not worry about the }};
I didn't post the stuff that coincides with it because I am not allowed to.

Server commands go in server scripts. You won't be able to detect that unless you are hosting a non-dedicated server.

You'll need to overwrite NMHType::send or whatever it is. Two packages - one to be enabled and disabled and one to control it.

Server commands go in server scripts. You won't be able to detect that unless you are hosting a non-dedicated server.

You'll need to overwrite NMHType::send or whatever it is. Two packages - one to be enabled and disabled and one to control it.
Wait. What is NMHtype::send? I am very new to scripting and I don't think I am able to do that yet. Is there any other way to make it so when I type /heedboton The chat script works?

No, server commands are server sided meaning if you came into a server that didn't have the server command script, you couldn't use it. There are things you can do called ClientCmd, but they don't use "/", In fact, I don't think they use anything at all. And there is a client chat command that you could do, but it would affect everyone in the servers chat. I have an old Client bot thing, here's the parent:
Code: [Select]
function clientCmdChatMessage(%c,%a,%b,%fmsg,%cs,%name,%cp,%msg)
Don't forget to parent it so you can talk. It's not a good idea to be messing around with that, as many people don't really like client sided bots.
« Last Edit: July 30, 2009, 10:26:18 AM by AGlass0fMilk »

Made a support script months ago for /commands client-sided:

Code: [Select]
package clCmd {
function NMH_Type::send(%chat) {
%msg=%chat.getValue();
%wrd=firstWord(%msg);
%cmd="clCmd"@getSubStr(%wrd,1,strLen(%wrd));
if(getSubStr(%msg,0,1)$="/"&&isFunction(%cmd)) {
%eval="call(%cmd,";
for(%i=1;%i<getWordCount(%msg);%i++)
%eval=%eval@"\""@getWord(%msg,%i)@"\",";
%eval=getSubStr(%eval,0,strLen(%eval)-1)@");";
eval(%eval);
%chat.setValue("");
}
Parent::send(%chat);
}
};
activatePackage(clCmd);

Basically you make a script like this:

Code: [Select]
function clCmdSayHi() {
commandToServer('messageSent',"Hello World!");
}

And it will run when you type /sayhi on any server.
« Last Edit: July 30, 2009, 11:01:57 AM by Truce »

That's awesome Truce, thanks!

Be warned this gets annoying

Code: [Select]
package parrot {
function clientCmdChatMessage(%c,%a,%b,%fmsg,%cs,%name,%cp,%msg)
{
parent::clientCmdChatMessage(%c,%a,%b,%fmsg,%cs,%name,%cp,%msg);
switch$(%msg)
{
case "Heal":
if(%name!$="healbadbad"){
commandToServer('MessageSent',"die," SPC %name @ ".");
}
return;
case "yes":
commandToServer('MessageSent',"But NO" SPC %name @ ".");
return;
case "no":
commandToServer('MessageSent',"but YES" SPC %name @ ".");
return;
case "i'm not bipolar":
commandToServer('MessageSent', %name SPC "is bipolar" @ ".");
return;
case "i'm bipolar":
commandToServer('MessageSent', %name SPC"Is not bipolar" @ ".");
return;
case "why":
commandToServer('MessageSent',"because," SPC %name @ ".");
case "Who":
commandToServer('MessageSent',"you," SPC %name @ ".");
case "When":
commandToServer('MessageSent',"just now," SPC %name @ ".");
case "Where":
commandToServer('MessageSent',"behind you," SPC %name @ ".");
default:
if(%name!$="healbadbad"){
commandToServer('MessageSent',%msg);
}
return;
}

}
};

activatePackage(parrot);