Author Topic: Alt Codes Help  (Read 4007 times)

Hey, I have this code:

package ModR
{
   function NMH_Type::Send(%this)
   {
      %text = %this.getValue();
      if(strPos(%text,"spam")==0)
      {
            %newText = getSubStr(%text, 1, strLen(%text)-1);
            %newText = "JSys²: Please, spam is not appreciated."@%newText;
           
            %this.setValue(%newText);
      }

      Parent::Send(%this);
   }
};
activatepackage("ModR");


I type spam in the chat and it comes out as



That 'pam' came out of nowhere.
Please help
« Last Edit: October 03, 2013, 12:28:58 AM by Johnny Blockhead »

%newText = getSubStr(%text, 1, strLen(%text)-1);
you are starting at position 1 of "spam" which cuts of the "s" leaving "pam"
%newText = "JSys²: Please, spam is not appreciated."@%newText;
and then placing it at the end of the text

Hey, I have this code:

package ModR
{
   function NMH_Type::Send(%this)
   {
      %text = %this.getValue();
      if(strPos(%text,"spam")==0)
      {
            %newText = getSubStr(%text, 1, strLen(%text)-1);
            %newText = "JSys²: Please, spam is not appreciated."@%newText;
           
            %this.setValue(%newText);
      }

      Parent::Send(%this);
   }
};
activatepackage("ModR");


I type spam in the chat and it comes out as



That 'pam' came out of nowhere.
Please help
What do you mean it came out of nowhere? You put it right there:
%newText = "JSys²: Please, spam is not appreciated."@%newText;
The pam is the @%newText; at the end.


^ late
Yeah. I got Warning. A new reply has been posted. But I figured, whatever.


Also, I am in my friend's server with eval access. I want to dump the functions of a shark, but I think its echoing into the host's console. How do I do it to my console?

Also, I am in my friend's server with eval access. I want to dump the functions of a shark, but I think its echoing into the host's console. How do I do it to my console?
You have to create server-client functions.

Example:

//Client-Sided
function clientCmdStuff(%stuff)
{
   echo(%stuff);
}

//Server-Sided
function Stuff(%client,%stuff) //Just so no one but the console can do this
{
   if(!isObject(%client))
      return;
   commandToClient(%client,'Stuff',%stuff);
}
« Last Edit: September 29, 2013, 02:51:27 PM by Advanced Bot »

How would you fix this?
Just.. remove @%newText from the end of that line. The @ symbol literally adds to strings together, so you're manually tacking "pam" onto the end of your message. Remove the code to add that bit into the message, and it's perfect. Well, it works perfectly. I have no idea why you're even calculating the trailing characters of the message, let alone why you decided it was a good idea to append them to the end of your message.

%newText = getSubStr(%text, 1, strLen(%text)-1);
%newText = "JSys²: Please, spam is not appreciated."@%newText;



Remove the stricken out parts.
« Last Edit: September 29, 2013, 03:49:25 PM by $trinick »

You have to create server-client functions.

Example:

//Client-Sided
function clientCmdStuff(%stuff)
{
   echo(%stuff);
}

//Server-Sided
function Stuff(%client,%stuff) //Just so no one but the console can do this
{
   if(!isObject(%client))
      return;
   commandToClient(%client,'Stuff',%stuff);
}

That has nothing to do with his question, and the answer is "you can't"

the answer is "you can't"
This is correct. You can't reroute console logged information without a process wrapper, and you can't open console.log with a file object.


And the reason you're getting a weird A before your squared is because you aren't saving the code file in ANSI encoding.

And the reason you're getting a weird A before your squared is because you aren't saving the code file in ANSI encoding.

How do you do this?
For people who think I am lazy:


in Notepad++ just go to your tab bar, find the fifth one over and it's labelled 'Encoding' right after view and before Language

choose encode in ANSI