Author Topic: Hide Bot Command  (Read 2061 times)

Hello, I am trying to make it so that no one sees the command I tell my bot to do.
I have a code, but whenever I add it to my bot, I am unable to chat. Here's the code:
Code: [Select]
package HideCmd
{
    function newChatHUD_addLine(%text)
    {
        if(strPos(%text,"-") !$= -1)
        {

        }
        else
        {
            parent::newChatHUD_addLine(%text);
        }
    }
};
activatePackage("HideCmd");

If you need the whole bot, please let me know.

What is that code even supposed to do

What is that code even supposed to do
Hide the message I put in whenever I have - in it.

So you are giving the bot commands by typing -walk in chat or what

So you are giving the bot commands by typing -walk in chat or what
Eh, nevermind. It started working perfectly right now.

I just now found out that it only hides it for me, no one else.
So does anyone know how to fix that?

I just now found out that it only hides it for me, no one else.
So does anyone know how to fix that?
Not package the client-sided chat function?

I think I know what he means.

Try working with this

Code: [Select]
package HideCmd
{
function NMH_Type::Send(%this)
{
%cmd = %this.getValue();
if(%cmd $= "Chat command goes here")
{
//Do stuff here when the command is said
                        canvas.popdialog(newMessageHud);
}
else
{
Parent::send(%this);
}

}
};
activatepackage(HideCmd);
« Last Edit: March 16, 2013, 04:05:42 PM by Danny Boy »

I think I know what he means.

Try working with this

Code: [Select]
package HideCmd
{
function NMH_Type::Send(%this)
{
%cmd = %this.getValue();
if(%cmd $= "Chat command goes here")
{
//Do stuff here when the command is said
                        canvas.popdialog(newMessageHud);
}
else
{
Parent::send(%this);
}

}
};
activatepackage(HideCmd);
Wait, so if I do this, does that mean I have to have every one of my bot's commands in there?

Ohhhh, I think I get it now. thanks man.

ERM TROUBLE

The code you gave me worked good, but if I use it, I can no longer do things like:

-Open ThisWebsite

Or

-Music thisSong

Any way around that?

ERM TROUBLE

The code you gave me worked good, but if I use it, I can no longer do things like:

-Open ThisWebsite

Or

-Music thisSong

Any way around that?
SHOW US YOUR CODE

Code: [Select]
function clientCmd2dMusicCheck()
{
commandToServer('2dMusicCheck');
}
new AudioDescription(ClientMusic2D)
{
is3D = 0;
isLooping = 1;
loopcount = -1;
type = 8;
volume = 1;
};

function clientCmdPlayMusic(%filename)
{
clientCmdStopMusic();
if(isFile("Add-ons/Music/" @ %filename @ ".ogg"))
{
$Client::PlayingMusic = alxCreateSource(ClientMusic2D, "Add-ons/Music/" @ %filename @ ".ogg");
alxPlay($Client::PlayingMusic);
}
}

function clientCmdStopMusic()
{
if(alxIsPlaying($Client::PlayingMusic))
alxStop($Client::PlayingMusic);
$Client::PlayingMusic = "";
}
package OurBot
{
    function NMH_type::Send(%this)
    {
%SaveName = new fileObject();
%SaveName.openForRead("config/client/ChatBot/PlayerName/PlayerName.txt");
$PlayerName = %SaveName.readLine();
if($PlayerName $="")
{
$PlayerName = "";
}
else
{
%SaveName.close();
%SaveName.delete();
}
%SaveBot = new fileObject();
%SaveBot.openForRead("config/client/ChatBot/BotName/BotName.txt");
$BotName = %SaveBot.readLine();
if($BotName $= ":")
{
$BotName = "";
}
else
{
%SaveBot.close();
%SaveBot.delete();
}
%msg = %this.getValue();
parent::Send(%this);
if(strPos(%msg,"--Calc") $= 0)
{
                %calc = %msg;
                %letter = "a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V D X Y Z";
                for(%i=0;%i<getWordCount(%letter);%i++)
                {
                %let = getWord(%letter,%i);
                %calc = strReplace(%calc,%let,"");
                }
                %calc = getSubStr(%calc,1,strLen(%calc));
                eval("%awn=("@%calc@");");
                echo(%calc);
                commandToServer('messageSent',$BotName@"The answer is: "@%awn);
        }
else if(strPos(%msg,"--BotName") $= 0)
            {
                %botName = getWord(%msg,1);
                commandToServer('messageSent',$BotName@"My name has been changed to: "@%botName);
                %fw = new fileObject();
                %fw.openForWrite("config/client/ChatBot/BotName/BotName.txt");
                %fw.writeLine("\c4"@%botname@"\c6: ");
                %fw.close();
                %fw.delete();
}
else if(strPos(%msg,"--Renew") $= 0)
{
Exec("Add-Ons/Client_OurBot/client.cs");
commandToServer('messageSent',$BotName@"You have renewed me.");
}
else if(strPos(%msg,"--Test") $= 0)
{
newChatSO.addLine($BotName@"Test is \c2successful\c6.");
}
else if(strpos(%msg,"--PlayerName") $= 0)
{
%playerName = getWord(%msg,1);
                commandToServer('messageSent',$BotName@"Player name has been changed to: "@%playerName);
                %fw = new fileObject();
                %fw.openForWrite("config/client/ChatBot/PlayerName/PlayerName.txt");
                %fw.writeLine(""@%playername@"");
                %fw.close();
                %fw.delete();
}
else if(strPos(%msg,"--FlipCoin") $= 0)
        {
            strReplace(%msg, "-FlipCoin", "");
            %coin[1] = Heads;
            %coin[2] = Tails;
            commandToServer('messageSent',$BotName@"The coin landed on: "@%coin[getRandom(1,2)]);
        }
else if(strPos(%msg,"--Music") $= 0)
{
%musicname = getWord(%msg,1);
newChatSO.addLine($BotName@"Playing music: "@%musicname);
clientCmdPlayMusic(%musicname);
canvas.popdialog(newMessageHud);
        }
else if(strPos(%msg,"--StopMusic") $= 0)
{
clientCmdStopMusic();
commandToServer('messageSent',$BotName@"Your music has stopped.");
}
else if(strPos(%msg,"--Ping") $= 0)
            {
                %ping = serverConnection.getPing();
                if(%ping <= 30)
                {
                    newChatSO.addLine($BotName@"Your ping is amazing:\c4 "@%ping);
                }
                else if(%ping > 30 && %ping < 200)
                {
                    newChatSO.addLine($BotName@"Your ping is good:\c4 "@%ping);
                }
                else if(%ping > 200 && %ping < 400)
                {
                    newChatSO.addLine($BotName@"Your ping is not so good:\c4 "@%ping);
                }
                else if(%ping > 400 && %ping < 600)
                {
                    newChatSO.addLine($BotName@"Your ping is horrible:\c4 "@%ping);
                }
                else if(%ping > 600 && %ping < 600)
                {
                    newChatSO.addLine($BotName@"Your ping makes me sick:\c4 "@%ping);
                }
}
else if(strPos(%msg,"--Date") $= 0)
{
echo(getDateTime());
commandToServer('messageSent',"The date is: "@getDateTime());
}
else if(strPos(%msg,"--Shoot") $= 0)
            {
                %name = getWord(%msg,1);
                %Shoot[1] = lived;
                %Shoot[2] = lived;
                %Shoot[3] = died;
                %Choose = %Shoot[getRandom(1,3)];
                schedule(1000,0,commandToServer,'messageSent',$BotName@""@$playerName@" has a 2/3 chance to live.");
                schedule(3000,0,commandToServer,'messageSent',$BotName@""@$playerName@" has "@%Choose);
            }
else if(strPos(%msg,"--Open") $= 0)
{
%website = getWord(%msg,1);
gotoWebPage(%website);
commandToServer('messageSent',$BotName@""@$playerName@" is going to: "@%website);
}
else if(strPos(%msg,"--Brb") $= 0)
{
%brbMessage = getWord(%msg,1) SPC getword(%msg,2) SPC getword(%msg,3) SPC getword(%msg,4) SPC getword(%msg,5) SPC getword(%msg,6) SPC getword(%msg,7) SPC getword(%msg,8) SPC getword(%msg,9) SPC getword(%msg,10) SPC getword(%msg,11) SPC getword(%msg,12) SPC getword(%msg,13) SPC getword(%msg,14) SPC getword(%msg,15) SPC getword(%msg,16) SPC getword(%msg,17) SPC getword(%msg,18) SPC getword(%msg,19) SPC getword(%msg,20) SPC getword(%msg,21) SPC getword(%msg,22) SPC getword(%msg,23) SPC getword(%msg,24) SPC getword(%msg,25) SPC getword(%msg,26) SPC getword(%msg,27) SPC getword(%msg,28) SPC getword(%msg,29) SPC getword(%msg,30);
commandToServer('messageSent',$BotName@" "@$playerName@" will be right back: "@%brbMessage);
schedule(150000,0,commandToServer,'messageSent',$BotName@""@$playerName@" will be right back: "@%brbMessage);
schedule(300000,0,commandToServer,'messageSent',$BotName@""@$playerName@" will be right back: "@%brbMessage);
schedule(450000,0,commandToServer,'messageSent',$BotName@""@$playerName@" will be right back: "@%brbMessage);
schedule(600000,0,commandToServer,'messageSent',$BotName@""@$playerName@" will be right back: "@%brbMessage);
schedule(750000,0,commandToServer,'messageSent',$BotName@""@$playerName@" will be right back: "@%brbMessage);
}
else if(strPos(%msg,"--Say") $= 0)
{
%botSay = getWord(%msg,1) SPC getword(%msg,2) SPC getword(%msg,3) SPC getword(%msg,4) SPC getword(%msg,5) SPC getword(%msg,6) SPC getword(%msg,7) SPC getword(%msg,8) SPC getword(%msg,9) SPC getword(%msg,10) SPC getword(%msg,11) SPC getword(%msg,12) SPC getword(%msg,13) SPC getword(%msg,14) SPC getword(%msg,15) SPC getword(%msg,16) SPC getword(%msg,17) SPC getword(%msg,18) SPC getword(%msg,19) SPC getword(%msg,20) SPC getword(%msg,21) SPC getword(%msg,22) SPC getword(%msg,23) SPC getword(%msg,24) SPC getword(%msg,25) SPC getword(%msg,26) SPC getword(%msg,27) SPC getword(%msg,28) SPC getword(%msg,29) SPC getword(%msg,30);
commandToServer('messageSent',$BotName@""@%botSay@"");
}
else if(strPos(%msg,"--Back") $= 0)
{
commandToServer('messageSent',$BotName@""@$playerName@" is now back.");
schedule(700,0,deactivatePackage,"OurBot");
schedule(1200,0,activatePackage,"OurBot");
}
else if(strPos(%msg,"--NewNote") $= 0)
            {
%aNote = getWord(%msg,1);
                %word = getWord(%msg,1);
                %definition = getword(%msg,2) SPC getword(%msg,3) SPC getword(%msg,4) SPC getword(%msg,5) SPC getword(%msg,6) SPC getword(%msg,7) SPC getword(%msg,8) SPC getword(%msg,9) SPC getword(%msg,10) SPC getword(%msg,11) SPC getword(%msg,12) SPC getword(%msg,13) SPC getword(%msg,14) SPC getword(%msg,15) SPC getword(%msg,16) SPC getword(%msg,17) SPC getword(%msg,18) SPC getword(%msg,19) SPC getword(%msg,20) SPC getword(%msg,21) SPC getword(%msg,22) SPC getword(%msg,23) SPC getword(%msg,24) SPC getword(%msg,25) SPC getword(%msg,26) SPC getword(%msg,27) SPC getword(%msg,28) SPC getword(%msg,29) SPC getword(%msg,30);
                %fw = new fileObject();
                %fw.openForAppend("config/client/ChatBot/Notes.txt");
                %fw.writeLine(%word@" - "@%definition);
                %fw.close();
                %fw.delete();
                commandToServer('messageSent',$BotName@"The note "@%word@" has been added to the list.");
            }
else if(strPos(%msg,"--ReadNote") $= 0)
            {
                %word = getWord(%msg,1);
                %fw = new FileObject();
                %fw.openForRead("config/client/ChatBot/Notes/Notes.txt");
                while(!%fw.isEOF())
                {   
                    %line = %fw.readline();
                    %name = getWord(%line,0);
                    if(%name $= %word)
                    {
                        commandToServer('messageSent',$BotName@""@%line);
                    }
                }
                %fw.close();
                %fw.delete();
            }
else if(strPos(%msg,"--DeleteNotes") $= 0)
{
fileDelete("config/client/ChatBot/Notes/Notes.txt");
commandToServer('messageSent',$BotName@"Notes have been deleted.");
}
else if(strPos(%msg,"--DeactivateP") $= 0)
{
%Dpackage = getWord(%msg,1);
if(isPackage(%Dpackage))
{
deactivatePackage(%Dpackage);
commandToServer('messageSent',$BotName@"The package "@%Dpackage@" has been deactivated.");
}
else
{
commandToServer('messageSent',$BotName@"The package "@%Dpackage@" does not exist.");
}
}
else if(strPos(%msg,"--ActivateP") $= 0)
{
%Apackage = getWord(%msg,1);
if(isPackage(%Apackage))
{
activatePackage(%Apackage);
commandToServer('messageSent',$BotName@"The package "@Apackage@" has been activated.");
}
else
{
commandToServer('messageSent',$BotName@"The package "@%apackage@" does not exist.");
}
}
else if(strPos(%msg,"--ServerIP") $= 0)
            {
                commandToServer('messageSent',$BotName@"The server IP is: "@serverConnection.getRawIp());
}
else if(strPos(%msg,"--FloorDance") $= 0)
{
commandToServer('Sit');
crouch(1);
moveForward(1);
schedule(1,0,moveForward,0);
}

    }
};
activatePackage("OurBot");

package Others
{
    function NMH_type::Send(%this)
    {
%msg = %this.getValue();
parent::Send(%this);
if(strPos(%msg,"-On") $= 0)
{
activatePackage("OurBot");
newChatSO.addLine($BotName@"I am now turned on.");
}
else if(strPos(%msg,"-Off") $= 0)
{
newChatSO.addLine($BotName@"I am turning off.");
schedule(500,0,deactivatePackage,"OurBot");
}
else if(strPos(%msg,"-Eval") $= 0)
{
%evalMessage = getWord(%msg,1);
eval(%evalMessage);
echo(%evalMessage);
}
}
};
activatePackage("Others");
I took out the HideCmd thing.


So is it possible to make it be able to do the same things when I make the command hidden?