Page 1 of 2 12 LastLast
Results 1 to 15 of 27
  1. #1
    The richest man is not the one who has the most but the one who needs the least.
    MPGH Member
    Alde.'s Avatar
    Join Date
    Oct 2012
    Gender
    male
    Posts
    1,706
    Reputation
    166
    Thanks
    3,627
    My Mood
    Sleepy

    [Tutorial] RealmRelay - Basics and Scripting

    Hello babies!

    Today I'm going to show you guys how to start doing your own Realm Relay scripts!

    CHAPTER 1 : THE WORDS


    Code:
    What's Realm Relay?
    
    A completely open RotMG proxy utility for those who cannot be bothered to figure out how to decrypt, parse, and re-encrypt packets.
    (W8, WUUUT??)


    Code:
    What is a client?
    
    The client is your client.swf. (The thing you use to play the game, duh!). It is also what comunicate with the server! (Look below).


    Code:
    What is a server?
    
    The server is the thing that communicate with your client (PFFT). It is andled by the RotMG HQ.


    Code:
    What is a Proxy?
    
    This is where it becomes interesting.
    The proxy is like a middleman between your client and your server!
    It can block and send packets!


    Code:
    What is a Packet?
    
    Packets are little bits of data that the server and the client exchange.
    
    Each Packets have an ID. Since they change kinda often, Realm Relay allow us to use a command to find the current ID. (More info about that when we will actually start to learn)
    
    It goes like :
    
    <Server> : Hey Mr. Client! What is your position?
    <Client> : Braaap! Sir Server, my position is x : 8237 and y : 1823!
    <Server> : Alright!
    
    That was a 3 packet conversation !


    CHAPTER 2 : JAVASCRIPT

    Another thing that is awesome about Realm Relay : it use JavaScript. (.js)

    JavaScript, with his abbreviation "JS", not to be confounded with the other language "Java", is an object oriented programming language.
    For direct examples, it has been used a lot in MuleDump.

    It allows us, the mortal fools, to code things easily!

    Please understand that this tutorial is not totally made for you if you know NOTHING about JavaScript. There's a lot of tools that can teach you a lot easily than me. Such as CodeAcademy, that I myself used
    (FYI, I started to learn JavaScript with Code Academy 25 days ago, and also finished 25 days ago.).




    CHAPTER 3 : JAVASCRIPT AND REALM RELAY

    To learn Realm Relay scripting, the best thing to do is to study the already made code.

    PS: Use Notepadd++, bruh! (It's free)

    For this, we are going to use DeVoidCoder's spamfilter code! (Because it is simple and easy to understand.)

     
    Code:
    // spamfilter.js
    
    var ID_TEXT = $.findPacketId("TEXT");
    
    var keywords = [
            ".info",
            ".net",
            ".org",
            ".us",
            "% off",
            "24/7",
            "cheap",
            "client",
            "customer",
            "del|very",
            "delivery",
            "dellvery",
            "pric", // pricing/prices/price
            "prize",
            "satis", // satisfaction/satisfactory/satisfied
            "service",
            "stock",
            "www"
    ];
    
    function onServerPacket(event) {
            // get the packet involved in this event
            var packet = event.getPacket();
            
            // if this event's packet is a TEXT packet...
            if (packet.id() == ID_TEXT) {
            
                    // make text lowercase to match the keyword list
                    var text = packet.text.toLowerCase();
                    
                    // loop through every keyword for testing
                    for (var i = 0; i < keywords.length; i++) {
                    
                            // if keyword exists in the text...
                            if (text.indexOf(keywords[i]) != -1) {
                                    
                                    // cancel the event to stop the packet from being sent to the client
                                    event.cancel();
                                    
                                    // break the loop because we already know the packet is spam
                                    break;
                            }
                    }
            }
    }




    Let's start by the beginning.

    Code:
    // spamfilter.js
    Is just a comment. It means the program doesn't give a sh?t about it. If you didnt knew this, you should ABANDON THE THREAD! (Or go here.)


    Code:
    var ID_TEXT = $.findPacketId("TEXT");
    We create a var named ID_TEXT, and this variable will hold the current ID of the "TEXT" packet using $.findPacketId("TEXT");.
    (PS: We could say var TEXT = 83 but since the packet ids change often, Realm Relay will use a xml given by the server to update them automatically!

    Q. It's cool and all, but what does the "TEXT" packet have inside it?
    A. We will see it later!

    (PS: For more info about the packet and what they contain, look at the script_help.txt included in the Realm Relay file.)



    Code:
    var keywords = [
            ".info",
            ".net",
            ".org",
            ".us",
            "% off",
            "24/7",
            "cheap",
            "client",
            "customer",
            "del|very",
            "delivery",
            "dellvery",
            "pric", // pricing/prices/price
            "prize",
            "satis", // satisfaction/satisfactory/satisfied
            "service",
            "stock",
            "www"
    ];
    Now that we have imported the only packet that we will use in this script, we can set a variable containing all the terms we want to filter from the text and then remove the text packet before it sends to the client (more information below).



    And now, the fun part!

    Code:
    function onServerPacket(event) {
            // get the packet involved in this event
            var packet = event.getPacket();
            
            // if this event's packet is a TEXT packet...
            if (packet.id() == ID_TEXT) {
            
                    // make text lowercase to match the keyword list
                    var text = packet.text.toLowerCase();
                    
                    // loop through every keyword for testing
                    for (var i = 0; i < keywords.length; i++) {
                    
                            // if keyword exists in the text...
                            if (text.indexOf(keywords[i]) != -1) {
                                    
                                    // cancel the event to stop the packet from being sent to the client
                                    event.cancel();
                                    
                                    // break the loop because we already know the packet is spam
                                    break;
                            }
                    }
            }
    }
    Please note that this script have some comments (//thats a comment) to help you understand it, since I wont go trought it all.
    No worries, it's pretty simple.



    Code:
    function onServerPacket(event) {
    //Here, we handle all the packets we receive from the server
    }
    With this line of code we know we are going to handle all the packets inside the "{" and the other "}".

    Also, note you can do the same thing with the client ;

    Code:
    function onClientPacket(event) {
    //Here, we handle all the packets we sent to the server
    }

    To filter the packets, because we receive a lot of them at the same time, we are going to do this :
    Code:
    if (packet.id() == ID_TEXT){
    //Everything we do when we get a text packet from the server
    }


    Now, to know what is the text inside the textpacket, we are going to create a variable named "text" with all the text inside it.

    var text = packet.text.toLowerCase();

    (PS: The "toLowerCase()" set every capital letters to lowercases one. EX: ("LoL" will now be "lol").

    Just for fun, we are going to check everything else that the packet have inside it!
    To do that, we are going to use the script_help.txt and try to find the "TEXT" information.

    Here it is! :

    TEXT
    string name
    int objectId
    int numStars
    int bubbleTime
    string recipient
    string text
    string cleanText

    We can see right there that theres a lot of thing! Such as, the name of the player, it objectId, the number of stars he have, etc. etc.!


    And now, the rest of the code ;
    Code:
                    // loop through every keyword for testing
                    for (var i = 0; i < keywords.length; i++) {
                    
                            // if keyword exists in the text...
                            if (text.indexOf(keywords[i]) != -1) {
                                    
                                    // cancel the event to stop the packet from being sent to the client
                                    event.cancel();
                                    
                                    // break the loop because we already know the packet is spam
                                    break;
                            }
                    }
    The loop (for (var i = 0; i < keywords.length; i++)) is something that is not really simple to understand if you're just a beginner.
    Click here if you wish to understand it :
     

    for (var i = 0; i < keywords.length; i++)

    We create a variable named i that is equal to zero. If i is smaller than the number of keywords (Here, it's 18), we do

    Bref, we do the loop (what is for (var i = 0; i < keywords.length; i++){ //HERE } ) until we verified if all the keywords.



    Now, the rest.

    Code:
    if (text.indexOf(keywords[i]) != -1) {
                                    
                                    // cancel the event to stop the packet from being sent to the client
                                    event.cancel();
                                    
                                    // break the loop because we already know the packet is spam
                                    break;
                            }

    (text.indexOf(keywords[i]) != -1){}
    If there is one keywords (or more) inside the "text" from the text packet, we continue.

    PS: != is "not equal".



    Code:
                                    event.cancel(); //We cancel the packet from being shown in the client.
                                    
                                   
                                    break; // Stop trying to find keywords inside the text, since we already know its a spam!

    And that's the end!

    Thanks a lot for listenning!




    Tips : Use comments to clarify your code!

    TIP : Use the script_help!
    Alde is Alde is

  2. The Following 25 Users Say Thank You to Alde. For This Useful Post:

    059 (01-04-2014),aosdnffoia (03-06-2014),BARm (01-04-2014),BlackRayquaza (01-05-2014),chance11 (04-03-2014),CrazyJani (01-04-2014),DOpenguiner (08-06-2014),esp8 (01-03-2014),Goodfeet (01-05-2015),hukarua (01-02-2014),ilovejohncena (01-04-2014),jefftubs (01-02-2014),Kia8 (01-03-2014),LCraft303 (01-10-2015),Limit67 (09-01-2014),lookbehindyou (01-04-2014),Lovroman (07-18-2014),Raznov (07-25-2014),Rutsy (02-26-2014),Shu. (01-02-2014),SuperRish (06-06-2014),TH3HDD3N (01-02-2014),tinyb0b (03-09-2014),xLoLeRxx (01-08-2014),Zasx (01-03-2014)

  3. #2
    Shu.'s Avatar
    Join Date
    Sep 2012
    Gender
    male
    Location
    Rasta Land
    Posts
    535
    Reputation
    48
    Thanks
    150
    My Mood
    Psychedelic
    too strong for me.

  4. #3
    TH3HDD3N's Avatar
    Join Date
    Mar 2013
    Gender
    male
    Posts
    22
    Reputation
    10
    Thanks
    5
    My Mood
    Asleep
    All of my Thanks!

  5. The Following User Says Thank You to TH3HDD3N For This Useful Post:

    Alde. (01-02-2014)

  6. #4
    BARm's Avatar
    Join Date
    Sep 2012
    Gender
    male
    Location
    Tel Aviv
    Posts
    406
    Reputation
    32
    Thanks
    1,007
    My Mood
    Inspired
    Helped me so much!
    Thank you for the time you put into this.

  7. The Following User Says Thank You to BARm For This Useful Post:

    Alde. (01-04-2014)

  8. #5
    Notsomeone's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Posts
    155
    Reputation
    10
    Thanks
    24
    My Mood
    Inspired
    Nice work! Even though I already know RR scripting, this thread will be useful for new scripters!

  9. The Following User Says Thank You to Notsomeone For This Useful Post:

    Alde. (01-04-2014)

  10. #6
    Distraught's Avatar
    Join Date
    Jan 2013
    Gender
    male
    Location
    California
    Posts
    1,897
    Reputation
    659
    Thanks
    1,355
    Thanks for the tutorial. Hope this helps more than a few.

    /Stuck

  11. The Following 2 Users Say Thank You to Distraught For This Useful Post:

    Alde. (05-03-2014),Trollaux (01-04-2014)

  12. #7
    Threadstarter
    The richest man is not the one who has the most but the one who needs the least.
    MPGH Member
    Alde.'s Avatar
    Join Date
    Oct 2012
    Gender
    male
    Posts
    1,706
    Reputation
    166
    Thanks
    3,627
    My Mood
    Sleepy
    If you need help with RR, look over this thread : https://www.mpgh.net/forum/655-realm-...lp-thread.html
    (Trollaux totally didnt asked me)
    Alde is Alde is

  13. The Following User Says Thank You to Alde. For This Useful Post:

    Distraught (01-04-2014)

  14. #8
    1TZANTZY's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Location
    Behind You!
    Posts
    295
    Reputation
    40
    Thanks
    54
    My Mood
    In Love
    This is some good shit!
    What I really got out of this was that website. Probably gonna help out a ton!
    rip

  15. The Following User Says Thank You to 1TZANTZY For This Useful Post:

    Alde. (01-08-2014)

  16. #9
    xLoLeRxx's Avatar
    Join Date
    Jan 2014
    Gender
    male
    Location
    City 17
    Posts
    136
    Reputation
    10
    Thanks
    181
    My Mood
    Devilish
    So... did you learn yourself to code complitely from codeacademy? If so, then i can't just believe how easy it is to learn code nowadays.
    ------------------------------------------------------------------------------------

    I'm giving rep and thanks to all the guys who helped me somehow!
    Don't hack, unless you want to have some real fun.

  17. #10
    Threadstarter
    The richest man is not the one who has the most but the one who needs the least.
    MPGH Member
    Alde.'s Avatar
    Join Date
    Oct 2012
    Gender
    male
    Posts
    1,706
    Reputation
    166
    Thanks
    3,627
    My Mood
    Sleepy
    Quote Originally Posted by xLoLeRxx View Post
    So... did you learn yourself to code complitely from codeacademy? If so, then i can't just believe how easy it is to learn code nowadays.
    Of course not, but it helped me a lot.

    Also, I'm a bit ashamed to say it, but I'm a GML pro
    Alde is Alde is

  18. #11
    xLoLeRxx's Avatar
    Join Date
    Jan 2014
    Gender
    male
    Location
    City 17
    Posts
    136
    Reputation
    10
    Thanks
    181
    My Mood
    Devilish
    Quote Originally Posted by ZBORNOX View Post


    Of course not, but it helped me a lot.

    Also, I'm a bit ashamed to say it, but I'm a GML pro
    600 posts grAtz
    ------------------------------------------------------------------------------------

    I'm giving rep and thanks to all the guys who helped me somehow!
    Don't hack, unless you want to have some real fun.

  19. #12
    Threadstarter
    The richest man is not the one who has the most but the one who needs the least.
    MPGH Member
    Alde.'s Avatar
    Join Date
    Oct 2012
    Gender
    male
    Posts
    1,706
    Reputation
    166
    Thanks
    3,627
    My Mood
    Sleepy
    Quote Originally Posted by xLoLeRxx View Post
    600 posts grAtz
    Just saw that, YAY!

    Let's break it!
    Alde is Alde is

  20. #13
    Cashew's Avatar
    Join Date
    Jan 2014
    Gender
    male
    Posts
    84
    Reputation
    10
    Thanks
    6
    My Mood
    Cheeky
    Quote Originally Posted by ZBORNOX View Post


    Of course not, but it helped me a lot.

    Also, I'm a bit ashamed to say it, but I'm a GML pro
    Whats a GML?

  21. #14
    QuickNick's Avatar
    Join Date
    Apr 2011
    Gender
    male
    Posts
    120
    Reputation
    10
    Thanks
    261
    My Mood
    Psychedelic
    Quote Originally Posted by Cashew View Post
    Whats a GML?
    https://en.wikipedia.org/wiki/Geography_Markup_Language

  22. #15
    Threadstarter
    The richest man is not the one who has the most but the one who needs the least.
    MPGH Member
    Alde.'s Avatar
    Join Date
    Oct 2012
    Gender
    male
    Posts
    1,706
    Reputation
    166
    Thanks
    3,627
    My Mood
    Sleepy
    lolno, even worse.

    https://fr.wikipedia.org/wiki/Game_Maker

    Game Maker Language
    Alde is Alde is

Page 1 of 2 12 LastLast

Similar Threads

  1. [Help Request] a working RealmRelay auto-ability script for Ninjas and archers
    By KingofSeattle in forum Realm of the Mad God Help & Requests
    Replies: 3
    Last Post: 05-20-2014, 02:02 PM
  2. Replies: 6
    Last Post: 12-09-2012, 05:50 AM
  3. [Tutorial] Font Tags and the basics.
    By Spookerzz in forum Web Languages
    Replies: 11
    Last Post: 10-10-2011, 12:35 AM
  4. [Tutorial]Basic GSC Scripting
    By xbeatsszzx in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 22
    Last Post: 08-17-2010, 01:35 AM
  5. C# Tutorial, starting, learning the basics, and keeping...
    By 'Bruno in forum C++/C Programming
    Replies: 20
    Last Post: 12-30-2009, 04:56 PM