Author Topic: Annoucements mod..  (Read 1508 times)

I need a addon that you say /annouce [Message] Or something that works

use Eval or console and type this.
announce("Text here");


But an actual command would be nice.

But an actual command would be nice.

function servercmdAnnounce(%client, %m0, %m1, %m2, %m3, %m4, %m5, %m6, %m7, %m8, %m9, %m10, %m11, %m12, %m13, %m14, %m15, %m16, %m17, %m18, %m19)
{
    if(!%client.isAdmin)
        return;

    for(%i = 0; strlen(%m[%i]); %i++)
        %message = %message SPC %m[%i];

    messageAll('', "\c6" @ trim(%message));
}

function servercmdAnnounce(%client, %m0, %m1, %m2, %m3, %m4, %m5, %m6, %m7, %m8, %m9, %m10, %m11, %m12, %m13, %m14, %m15, %m16, %m17, %m18, %m19)
{
    if(!%client.isAdmin)
        return;

    for(%i = 0; strlen(%m[%i]); %i++)
        %message = %message SPC %m[%i];

    messageAll('', "\c6" @ trim(%message));
}
Well nice but it doesn't really have the 'announce' feeling. Its just white text that looks like someone talking.

Well nice but it doesn't really have the 'announce' feeling. Its just white text that looks like someone talking.
.....what else should it do except send everyone a message? Also you can just color it by saying /announce \c4blah.

What if the announcement was actually a center print? Wouldn't that be more noticeable if the chat's too busy?

Also you can just color it by saying /announce \c4blah.
hmm?

I was too lazy to crop.

EDIT: using <color:######> and <font:name:size> works.
« Last Edit: July 19, 2014, 05:53:42 AM by espio100 »

hmm?
Oh. Well then you'll have to use /announce <color:00ffff>blah.

What if the announcement was actually a center print? Wouldn't that be more noticeable if the chat's too busy?
Center prints arent always seen though, for example if someone is dead the "Respawn in x" (or whatever) thing will replace it, things like that.

hmm?
-snip-
-snip-
Zeblote is technically right. However, for some reason, when you do things like this, (it happens it the Welcome Message also), when ever you do \cnumber, it actually registers as \\cnumber, so it doesn't work in that situation.

Zeblote is technically right. However, for some reason, when you do things like this, (it happens it the Welcome Message also), when ever you do \cnumber, it actually registers as \\cnumber, so it doesn't work in that situation.
The problem is that you enter the command in a text field, so it simply gets the string \c4 instead of the color. If you do commandtoserver('announce', "\c4blah"); it will work.

What if the announcement was actually a center print? Wouldn't that be more noticeable if the chat's too busy?
Good idea! If everyones not listening to me i would say "SHUT THE **** UP AND LISTEN TO ME"

If it was only 2 args (client and message), like serverCmdMessageSent, you could do \c chars.

/aa "\c4Aaa" using quotes could work

None of these methods are going to work. If you input a \c# color code into a text field as its component characters, 0x92 0x99 0x50 (for \c2), then it's never going to turn into the really iffy method by which TorqueScript represents its color codes.

You have to actually replace each of the color codes' string representation, such as 0x92 0x99 0x50, with its equivalent metacharacter representation.

%colorCodes = "\c0\c1\c2\c3\c4\c5\c6\c7\c8";
for(%i=0;%i<9;%i++)
    %text = strReplace("\c"@%i, getSubStr(%colorCodes, %i, 1));


Note that this would miss all the non-numeric color codes, such as \cr, \cp, and \co.

Why not use strReplace(%message,"\\","\\\\");?

Why not use strReplace(%message,"\\","\\\\");?

You're saying to replace the ASCII string 0x92 with the ASCII string 0x92 0x92. The \\ isn't special in a string - it's just two backslashes.

Only in code is \ actually a metacharacter, so that's the only place it'll be parsed as anything but 0x92.