Author Topic: Script not detecting chat {resolved}  (Read 3784 times)

Still doesn't work..

It isn't a syntax error, its just not responding

Oh, I never actually checked to make sure what you were doing made sense. You're checking if each word is equal to a string with more than one word.

Do this instead:

Code: [Select]
package bootup
{
    function NMH_Type::Send(%this)
    {
        %message = %this.getValue();
        Parent::Send(%this);
        if(striPos(%message, "Bootup, JSys") > -1 || %message $= "Boot!")
        {
            activatepackage("SystemMain");
            commandToServer('messagesent',"JSys²: Booting up.");
            schedule(2000, 0, "commandtoServer", 'messageSent', "Beware: This is for use only with Johnny Blockhead.");
        }
    }
};
activatepackage("bootup");

You could also use striPos to check for "Boot!", but I'm sure that you don't want to boot JSys in a scenario where you said something like "I lost my boot!"

EDIT: I also moved the send parent to the beginning of the function so that your messages send in the correct order.
« Last Edit: August 10, 2013, 06:33:39 PM by $trinick »


Ran this through:

Code: [Select]
//Boot Sequence

package bootup
{
    function NMH_Type::Send(%this)
    {
        %message = %this.getValue();
        Parent::Send(%this);
        if(striPos(%message, "Bootup, JSys") > -1 || %message $= "Boot!")
        {
            activatepackage("SystemMain");
            commandToServer('messagesent',"JSys²: Booting up.");
            schedule(2000, 0, "commandtoServer", 'messageSent', "JSys²: Beware: This is for use only with Johnny Blockhead.");
        }
    }
}
activatepackage(##"##bootup");

Syntax errors like so


Also another question: Will this reconize my chat only or everyone's chat

Close the package with }; and not }
This only checks your chat.

Worked perfectly, just a thing:

How would you make it so it detects anyone in the server's chat?

I'm making a grammar national socialist script

Package newChatHud_addLine(%text)
%text is a string.


See my below post
« Last Edit: August 10, 2013, 11:37:19 PM by {Pacnet2013} »

That function doesn't seperate the sender's name and the message.

Wait, what?
So I have to add (%text) when I do package grammarnational socialist

Warning - while you were typing a new reply has been posted. You may wish to review your post.

evil

You're going to code a bot that knows the ins and outs of the entire language?
k, good luck.

You're going to code a bot that knows the ins and outs of the entire language?
k, good luck.

Just some Commonly misspelled words
so I can annoy peoples
« Last Edit: August 10, 2013, 11:28:03 PM by Johnny Blockhead »

That function doesn't seperate the sender's name and the message.

Sorry,  I meant
clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)

%msg is the chat they typed, %name is the name of the client who typed it

Also, packaging any torque function simply means to put it in a package with a parent statement.
« Last Edit: August 10, 2013, 11:39:20 PM by {Pacnet2013} »

Sorry,  I meant
clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)

%msg is the chat they typed, %name is the name of the client who typed it

Wait, I am confused :/

I have a string chatbot script from Yelona a while back, Guess I will use that.

Wait, I am confused :/

I have a string chatbot script from Yelona a while back, Guess I will use that.

if(%msg $= "jsut") {
 commandtoserver('messageSent', "just*");
}

Script not working
wtf yelona :P

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

      parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
      if (name $= "Johnny Blockhead")
      {
         switch$(%msg) //let's add the switch now
         {
            case "lel":
            commandToServer('messagesent',"JSys²: Don't ya mean lol?");

            case "jsut":
            commandToServer('messagesent',"JSys²: Don't ya mean just?");

case "alot":
            commandToServer('messagesent',"JSys²: I really hope you mean't to say a lot.");
           

         }
      }
   }

};