Shoutbox

A Radio Code script - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: A Radio Code script (/showthread.php?tid=74480)

A Radio Code script by EaglesNestOne on 05-18-2007 at 08:58 AM

Hi,

<off topic>
Although this is my first post on this forum and you all might think i'm a noob I am very experienced with forums. (I even used to be a moderator of one)
</off topic>

I was wondering if somebody could teach me to (or make) a script that goes something like this:

If you type something (when in a conversation) like "/rdocde <message>" would it be possible to change the text to radio code?

Example:
     "ABC 123" would be changed to Alpha Bravo Charlie   One Two Three."

Anyway heres the translation of Radio Code:

A.............................. ALPHA
B.............................. BRAVO
C.............................. CHARLIE
D.............................. DELTA
E.............................. ECHO
F.............................. FOXTROT
G.............................. GOLF
H.............................. HOTEL
I.............................. INDIA
J.............................. JULIET
K.............................. KELO
L.............................. LIMA
M.............................. MIKE
N.............................. NOVEMBER
O.............................. OSCAR
P.............................. PAPA
Q.............................. QUEBEC
R.............................. ROMEO
S.............................. SIRREA
T.............................. TANGO
U.............................. UNIFORM
V.............................. VICTOR
W.............................. WHISKEY
X.............................. XRAY
Y.............................. YANKEE
Z.............................. ZULU


RE: A Radio Code script by markee on 05-18-2007 at 09:56 AM

Have a try at this:

code:
var letters = {
    "a":"ALPHA",
    "b":"BRAVO",
    "c":"CHARLIE",
    "d":"DELTA",
    "e":"ECHO",
    "f":"FOXTROT",
    "g":"GOLF",
    "h":"HOTEL",
    "i":"INDIA",
    "j":"JULIET",
    "k":"KELO",
    "l":"LIMA",
    "m":"MIKE",
    "n":"NOVEMBER",
    "o":"OSCAR",
    "p":"PAP",
    "q":"QUEBEC",
    "r":"ROMEO",
    "s":"SIRREA",
    "t":"TANGO",
    "u":"UNIFORM",
    "v":"VICTOR",
    "w":"WHISKEY",
    "x":"XRAY",
    "y":"YANKEE",
    "z":"ZULU",
    "1":"ONE",
    "2":"TWO",
    "3":"THREE",
    "4":"FOUR",
    "5":"FIVE",
    "6":"SIX",
    "7":"SEVEN",
    "8":"EIGHT",
    "9":"NINE",
    "0":"ZERO"
}
function OnEvent_ChatWndSendMessage(ChatWnd, sMessage){
    if (/^\/rdocde(?:\s+([\s\S]*)|$)/i.exec(sMessage) !== null) {
        var parameter = RegExp.$1.toLowerCase();
        for(key in letters){
        Debug.Trace(key+"\t"+letters[key]);
            //remove this line if you want double spaces at the end of words
            parameter = parameter.replace(RegExp(key+"\b","g"),letters[key]);
            parameter = parameter.replace(RegExp(key,"g"),letters[key]+" ");
        }
        ChatWnd.SendMessage(parameter);
        return "";
    }
}
function OnGetScriptCommands(){
    return "<ScriptCommands><Command><Name>Radio Code</Name><Description>Convert your message to radio code</Description><Parameters>Message</Parameters></Command>";
}

RE: A Radio Code script by EaglesNestOne on 05-18-2007 at 09:58 AM

THX MAN