ZingMS

Would you like to react to this message? Create an account in a few clicks or log in to continue.
ZingMS

ZingMS! Ultimate MapleStory gaming experience :)


3 posters

    The idea of object oriented programming and how it relates to Maplestory

    avatar
    Rukia
    Zing's Slave


    Posts : 7
    Join date : 2010-08-02

    The idea of object oriented programming and how it relates to Maplestory Empty The idea of object oriented programming and how it relates to Maplestory

    Post  Rukia Wed Aug 04, 2010 11:22 am

    A Maplestory private server, whether it be run on Java or C++, is a server that is run on a programming language that is Object Oriented.

    What is object oriented programming you say? Well, let's start with the idea of a class.

    A class is a blueprint of an object. It says what the object is, what it can do, and much more. A typical class can contain variables, methods, and constructors.

    A variable can be numbers, text, or a boolean (a value that signifies true or false).

    A method is basically a command that can tell the object what to do. Calling a method means to execute the code inside the method. A method can have parameters, which are basically variables that are given to the method to work with. For example, to set somebody's luk to 10, you would use setLuk(10). The 10 inside the parenthesis is the parameter. The method only accepts integers as the parameters. It will not work if you tried setLuk(twenty) because you are giving it a string, or a chain of letters.

    A constructor is similar to a method in that it can contain commands for what to do when an object is created from a class.

    So how is this related to maplestory?
    Let's take the MapleCharacter class. This is the class that all players in Maplestory are created from.
    Some variables that you can find in it are the number of rebirths, the level of the character, its max hp, its current hp, and more.
    Some methods that you can find inside it are getStr(), setStr(), addFame(), and more. When you call a method such as setStr(), you can say setStr(10). This will make a player's strength 10 (duh). But on a more basic level, the object goes to its method setStr() and reads the commands inside. It will set its variable named strength that represents the amount of strength the character has as the new amount of strength you just gave it.

    Now let's have an example of how to use a method in NPC coding. Lets say you want to have your npc increase your fame by one when you talk to it.
    First we call the npc to get the player. the npc is represented by cm.
    cm.getPlayer();
    We are not done! The computer basically has first looked at the npc, then switched its focus to the player that is interacting with it because we used the method getPlayer(). Now that the focus is on the player, we can execute methods from the player class.
    cm.getPlayer().addFame(1);
    done. Simple enough right? We first gave the computer the npc, executed its getPlayer() method, which gives us the player in question, then executed the player's addFame() method with an integer parameter of 1, aka addFame(1). A semicolon must be at the end of each statement or else the computer will not recognize it as the end of the command.

    With this knowledge and the server source, you can script npc's, make custom pq's, custom code your server, and much more. The maplestory source code is huge and rather confusing, but with some time and experience, anybody can understand how all the classes, subclasses, interfaces, etc work hand in hand to create a whole functioning server.

    If you found this interesting and would like to learn more, I recommend learning the Java computer programming language. There is so much to learn that is not listed here that is essential for things like coding maplestory pservers, creating your own programs to do all your schoolwork (hehe), and hacking (opening up a maplestory trainer and doing 2 bil damage is not hacking btw -_-...neither is using a packet editor to send certain packets that give you mesos).
    To learn more about programming, I'd recommend learning java online with websites such as http://www.javabeginner.com/. Just google "learn java online". Wanna learn programming in C? google that too! Most programming languages are very similar and it is not hard to switch from one to another.


    -Rukia
    avatar
    getlicked
    Zing's Slave


    Posts : 5
    Join date : 2010-07-31

    The idea of object oriented programming and how it relates to Maplestory Empty Re: The idea of object oriented programming and how it relates to Maplestory

    Post  getlicked Wed Aug 04, 2010 3:14 pm

    Dang rukia u smart :L
    EmoChina
    EmoChina
    Moderator
    Moderator


    Posts : 17
    Join date : 2010-08-01
    Location : Deaths sanctuary.... OF COOKIES!

    The idea of object oriented programming and how it relates to Maplestory Empty Re: The idea of object oriented programming and how it relates to Maplestory

    Post  EmoChina Wed Aug 04, 2010 5:53 pm

    Hey rukia can you please post about C++ i wanna learn about that Smile
    avatar
    Rukia
    Zing's Slave


    Posts : 7
    Join date : 2010-08-02

    The idea of object oriented programming and how it relates to Maplestory Empty C++

    Post  Rukia Wed Aug 04, 2010 6:29 pm

    C++ is just a another object oriented programming language. It is different from java of course, but in general, is quite similar to java in that it is an object oriented language. I can't really teach you C++ in a forum, so I'd recommend you read up about it online.

    -Rukia
    EmoChina
    EmoChina
    Moderator
    Moderator


    Posts : 17
    Join date : 2010-08-01
    Location : Deaths sanctuary.... OF COOKIES!

    The idea of object oriented programming and how it relates to Maplestory Empty Re: The idea of object oriented programming and how it relates to Maplestory

    Post  EmoChina Wed Aug 04, 2010 6:33 pm

    Oh ok, Thanks for the help again Rukia

    Sponsored content


    The idea of object oriented programming and how it relates to Maplestory Empty Re: The idea of object oriented programming and how it relates to Maplestory

    Post  Sponsored content


      Current date/time is Sat Apr 27, 2024 11:56 pm