Author Topic: Chat Replacer =help=  (Read 3421 times)

Hey, I use NotePad++ for scripting.

I think for .cs files it automatically does C++ highlighting. Is there any way to make it Torque?


sublime text is so much better ._.

Hey, I use NotePad++ for scripting.

I think for .cs files it automatically does C++ highlighting. Is there any way to make it Torque?
.cs files are C#, and TorqueScript is very similar in syntaxical structure to C#


I noticed there was a lack of syntax highlighting for Torquescript, so I made my own. Please tell me anything you don't like about it or think should be changed.

Download Here
  • download file
  • open Notepad++
  • in the View menu, click "User Defined Dialogue..."
  • Click Import and select the file you downloaded
  • restart Notepad++
  • in the Language menu, you should now see a language called Torquescript at the bottom. Select it, and you're ready to go.


Here's an example file if you'd like it: Download example file

EDIT: link should be fixed


I don't see this in the view drop-down

I don't see this in the view drop-down
N++ has changed, find the language tab, then at the very bottom there is a button to define your own language

Heres my current method:

Package MainFuncts
{
   echo("Main Functions Loaded");
   function NMH_Type::Send(%this)
   {
      %message = %this.getValue();
      Parent::Send(%this);
      
      //AutoGreeter
      if(striPos(%message, "It Detects mee!") > -1 || %message $= "It Detects me, too")
      {
         schedule(200, 0, "commandtoServer", 'messageSent', "JSys²: Hello africans");
         activatepackage("mainfuncts");
      }
   }
};
      

'xept I want it to detect people I specify's chat too. (By specify maybe by bl_id? I don't know how that works.

I guess I could do a if-statement calling a function, but that would take forever
is there a easy solution to this

you're using the wrong function then, you need to use something else, i forget it off hand, ill go find it

edit;
function clientCmdChatMessage(%a,%b,%c,%msg,%cp,%name,%cs,%fmsg)
make SURE you check that it is you or a specified person sending the message by if checking %name
« Last Edit: August 27, 2013, 07:05:16 PM by Vortex »


Package MainFuncts
{##
##
   echo("Main Functions Loaded");
   function NMH_Type::Send(%this)
   {
      %message = %this.getValue();
      Parent::Send(%this);
      
      
      
   
   
   
   
      //SpeakAs
      if(striPos(%message, "JSys Activ. SpeakAs") > -1 || %message $= "JSys Activate SpeakAs")
      {
         schedule(200, 0, "commandtoServer", 'messageSent', "JSys²: Auto Greeter Activated");
         activatepackage("SpeakAs");
      }
      if(striPos(%message, "JSys Deactiv. SpeakAs") > -1 || %message $= "JSys Deactivate SpeakAs")
      {
         schedule(200, 0, "commandtoServer", 'messageSent', "JSys²: Auto Greeter Deactivated");
         deactivatepackage("SpeakAs");
      }
      
      
      
      
      
      //Detect chat
      if(striPos(%message, "JSys Activate DetectChat") > -1 || %message $= "JSys Detect the chat")
      {
         schedule(200, 0, "commandtoServer", 'messageSent', "JSys²: K boss.");
         deactivatepackage("ChatDetect");
      }
      if(striPos(%message, "JSys Deactivate DetectChat") > -1 || %message $= "JSys Don't Detect the chat")
      {
         schedule(200, 0, "commandtoServer", 'messageSent', "JSys²: K boss.");
         deactivatepackage("ChatDetect");
      }
      
   }
};


Help me thy elders
« Last Edit: August 27, 2013, 07:26:16 PM by Johnny Blockhead »

Package Bootup
{##
##   echo("Bootin up Cmds have been loaded");
   
      function NMH_Type::Send(%this)
      {
         %message = %this.getValue();
         Parent::Send(%this);
         
         //Bootup
         
         if(striPos(%message, "JSys Start") > -1 || %message $= "JSys Boot up")
            {
         schedule(200, 0, "commandtoServer", 'messageSent', "JSys²: Booted Up!");
         activatepackage("mainfuncts");
            }
            
         //Bootdown
         
         if(striPos(%message, "JSys Boot Down") > -1 || %message $= "JSys Shut Down")
            {
         schedule(200, 0, "commandtoServer", 'messageSent', "JSys²: Booted Down.");
         deactivatepackage("mainfuncts");
            }
      }
};
activatepackage("Bootup");


Probably something simple but i'm too stupid to figure it out lol

You have some invisible character after the { - delete those 2 lines that the ## are on and rewrite them


If there is other code above the package, post it

First of all, you aren't using the clientCmdChatMessage function so it will only work for you, also, Package is incorrect syntax, change it to "package" instead. It's case sensitive here.

This is very important and caused me hours of frustration:

Wrong (capitalized package):
Code: [Select]
Package mypackage
{
};

Correct (no capitalization in the word package):
Code: [Select]
package mypackage
{
};
Note that the correct one did not capitalize package. Apparently, this is case sensitive.


No, this isn't a bump, it's a sticky. Just thought someone might be having the same problem.

Sorry to bump this topic a few pages, but how would I make it so this:

This one only removes the ^ at the beginning.

package johnnyPack
{
   function NMH_Type::Send(%this)
   {
      %text = %this.getValue();

      if(getSubStr(%text, 0) $= "^")
      {
            %newText = getSubStr(%text, 1, striLen(%text)-1);
            %newText = "CHATBOT:"@%newText;

            %this.setValue(%newText);
      }

      Parent::Send(%this);
   }
};
activatePackage(johnnyPack);


to detect a ^ at any point in the message. I want this to work in compliance with a moderator thing I am working on. For example, I would say "X please follow this rule: rule1" and it would come out "X please follow this rule: No spawn camping". Of course, X would be the mischievous player's name.

First of all, you aren't using the clientCmdChatMessage function so it will only work for you, also, Package is incorrect syntax, change it to "package" instead. It's case sensitive here.


I hate seeing my old posts.

Sorry to bump this topic a few pages, but how would I make it so this:

to detect a ^ at any point in the message. I want this to work in compliance with a moderator thing I am working on. For example, I would say "X please follow this rule: rule1" and it would come out "X please follow this rule: No spawn camping". Of course, X would be the mischievous player's name.

Use strpos, i've forgotten the syntax though, and i'm too lazy to find it. Do a search.
You should read through most of the string functions, they can really help you out a lot. Here, do Ctrl F, strpos.