[General] [Tut] Case Coding

Results 1 to 7 of 7
  1. #1
    Best Commu NA Cure is offline
    MemberRank
    Sep 2007 Join Date
    That way .. →Location
    1,247Posts

    Post [General] [Tut] Case Coding

    Love's Case Coding Tutorial

    1.: Introduction
    2.: Helpful Pointers
    3.: Starting a Case
    4.: Item Case Code
    5.: Teleportation Case Code
    6.: Level Up Case Code
    7.: Message Case Code
    8.: Where to add
    9.: Why are these important
    10.: Ending


    Lets Get Started

    1.: Introduction

    Hey, Im Love.. In this tutorial I will teach you a very useful thing used in many RuneScape Private Servers.. Case Coding. Some of you call It "Casing" or "Case-Adding".. But I call it Case Coding.. So get used to it :)

    Case Coding is basically telling what action the server does once clicked, These are used on Dummy's in normal RuneScape to gain experience. For Example.. Adding a Case to a Crate, Will tell the server what action to do once that object is clicked.

    For those who never seen what a Case looks like.. Heres an example of a case used by "Dummy's" to make your attack gain up.

    Code:
    case 823:  
    if (actionTimer == 0) {
    stillgfx(336, absY, absX);
    setAnimation(0x326);
    addSkillXP((500*playerLevel[0]), 0);
    actionTimer = 12;
    }
    break;
    This is what we will be learning.. In this tutorial, you will see how to make a case to add to your own server!

    2.: Helpful Pointers

    While making cases, you may want to organize the case information and not have it everywhere.. that way you know what to edit if the case needs editing, I also advise you to have a backup of your server incase something happens while case coding.

    3.: Starting a Case

    Starting a case is easy. First you want to find the ID of the object you want to add the case to.. You can ussually find this ID by right clicking the object, It will be in brackets - Example: (873) -.. Remember, find the ID of the object you want to case(add action to).

    After you found the object ID.. Start your case in this format

    Code:
    case <OBJECT ID GOES HERE>:  
    if (actionTimer == 0) {
    
    actionTimer = 12;
    }
    break;
    You want to start the top of the code with "Case <Object ID>:", So for a dummy the object ID is 823.. So I would type "Case 823:" at the top of the code. Remember, Dont add the " " to your case.

    4.: Item Case Code

    As you can see from the format above, you've left a space in the middle.. This is where you will add you action, This chapter will teach you how to get a item from the object you click. Therefore; Everytime you click that object, the item will apear in the persons inventory.

    In the space left in the middle of the format you add:

    Code:
    addItem(995, 1);
    Edit whats in RED to your Item ID
    Edit whats in BLUE to the ammount of the item the player obtains

    If you want the player to obtain more then 1 different item.. add the same code under the last one but with the new ID's and ammounts.

    Example of ending result:
    Code:
     
    case <OBJECT ID GOES HERE>:  
    if (actionTimer == 0) {
    addItem(995, 1);
    actionTimer = 12;
    }
    break;
    5.: Teleportation Case Code

    This chapter will teach you how to teleport a player to a certain location once the object is clicked, Remember to follow the format provided in chapter 3.

    The code you would add in the space provided is:

    teleportToX = 3213;
    teleportToY = 3425;
    Edit whats in RED to your X coordinate
    Edit whats in BLUE to your Y coordinate

    In the sample code provided above, the coordinates lead to varrock. Ussually to find your coordinates on your server, type "::mypos" in game.

    Example of ending result:
    case <OBJECT ID GOES HERE>:
    if (actionTimer == 0) {
    teleportToX = 3213;
    teleportToY = 3425;
    actionTimer = 12;
    }
    break;
    6.: Level Up Case Code

    This case code is a little harder then the others.. But if you have any problems PM me. Remember to use the format from chapter 3 again for this code also.

    The code you would add in the space provided is:

    addSkillXP((500*playerLevel[0]), 0);
    Edit whats in RED to the ammount of exp. you get per-click
    Edit whats in BLUE to the stat type

    There are many different stat types, however I do not know them all.. Heres a list of the ones I do know

    Attack = 0
    Strength = 1
    Defence = 2
    Health = 3
    Range = 4
    Prayer = 5
    Magic = 6
    So you would replace "1" with "0" in the code to raise Strength instead of attack

    Example of ending result:
    case <OBJECT ID GOES HERE>:
    if (actionTimer == 0) {
    addSkillXP((500*playerLevel[0]), 0);[/
    actionTimer = 12;
    }
    break;
    7.: Message Case Coding

    This is the most basic case so far, remember, Use the format in chapter 3.

    The code you would add in the space provided is:

    sendMessage("The Message");
    Edit whats in RED to the message that is said to the player

    Example of ending result:
    case <OBJECT ID GOES HERE>:
    if (actionTimer == 0) {
    sendMessage("The Message");
    actionTimer = 12;
    }
    break;
    8.: Where to add

    Go into your "Client.Java" file, If you cant find it.. Press "CTRL+F" and type in "client.java"

    Once you found it.. Go to "Edit" at the top left side and click "Find".. Search For:

    /*OBJECT CLICK TWO*/
    Once you've found that, You should see a code that looks like the following:

    /*OBJECT CLICK TWO*/
    public void objectClick2(int objectID, int objectX, int objectY) {
    if(playerName.equalsIgnoreCase("Shux"))
    println_debug("atObject2: "+objectX+","+objectY+" objectID: "+objectID);
    switch(objectID) {
    case 2213:
    case 2214:
    case 2566:
    case 3045:
    case 5276:
    case 6084:
    case 11758:
    openUpBank();
    break;
    ..Once you've found it, At the end of "break;" hit enter twice then type in your new case code!

    9.: Why are these important

    Cases are used to make your server better, tons of server's use them all the time. Follow the guide and start modifying your server to become better!

    10.: Ending

    Please Guys if you have any questions at all, Feel Free to ask

    Also if you have something to add, Post it and if its important ill add it to the guide!

    Please dont post negitive comments, only positive

    Thanks for reading~

    Tutorial Credits to: Love
    Last edited by GhostSnyper; 15-01-09 at 03:41 AM.


  2. #2
    The next don TheAJ is offline
    DeveloperRank
    May 2007 Join Date
    Toronto, CanadaLocation
    3,946Posts

    Re: [TuT]Case Coding

    I think i saw this tutorial on silabsoft.org

  3. #3
    Best Commu NA Cure is offline
    MemberRank
    Sep 2007 Join Date
    That way .. →Location
    1,247Posts

    Re: [TuT]Case Coding

    Not leeched though :P

    But still, @ least someone replyed

  4. #4
    Novice illl_illl is offline
    MemberRank
    Feb 2008 Join Date
    1Posts

    Re: [TuT]Case Coding

    wooo lol gj :p

  5. #5
    Best Commu NA Cure is offline
    MemberRank
    Sep 2007 Join Date
    That way .. →Location
    1,247Posts

    Re: [TuT]Case Coding

    Nice Ty ill :P

  6. #6
    Apprentice Biggest_Hero is offline
    MemberRank
    Apr 2008 Join Date
    5Posts

    Re: [TuT]Case Coding

    If u have msn, add me at bsutt94@hotmail.com. I need a coder to teach me alot of java and how to create areas in a Runescape Private Server =)

  7. #7
    Canadian Mike is offline
    MemberRank
    Dec 2007 Join Date
    Toronto, ONLocation
    2,747Posts

    Re: [TuT]Case Coding

    Very well explained tutorial.

    Moved to the Knowledge Database ;)



Advertisement