Thread: When trying to create a class file..

Results 1 to 3 of 3
  1. #1 When trying to create a class file.. 
    Registered Member
    Join Date
    Jul 2012
    Posts
    134
    Thanks given
    3
    Thanks received
    5
    Rep Power
    11
    Hey,

    So I've been trying to make a class file..

    Basically what I'm trying to do:
    -I'm trying to create a portal (Object ID = 2465) that brings up multiple teleport options when clicked.

    I've added a code in src->com->rs->game->player->dialogues:
    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.game.WorldTile;
    import com.rs.game.player.content.Magic;
    
    public class 2465Portal extends Dialogue {
            
            private int npcId;
    
            @Override
            public void run(int interfaceId, int componentId) {
    if (stage == -1) {
                            sendDialogue(SEND_2_OPTIONS, "Where would you like to go?",
                                            "Rock Crabs", "Slayer Tower", "Taverley Dungeon", "Abyss");
                            stage = 1;
                    } else if (stage == 1) {
                            if (componentId == 1) {
                                        teleportPlayer(2673, 3709, 0);
                                    end();
                            } else if (componentId == 2) {
                                    teleportPlayer(3428, 3538, 0);
                                    end();
                            } else if (componentId == 3) {
                                    teleportPlayer(2884, 9799, 0);
                                    end();
                            } else if (componentId == 4) {
                                    teleportPlayer(3039, 4836, 0);
                                    end();
                            }
            
                    }
            }
            
            private void teleportPlayer(int x, int y, int z) {
                    Magic.sendNormalTeleportSpell(player, 0, 0.0D, new WorldTile(x, y, z),
                                    new int[0]);
            }
    
            @Override
            public void finish() {
                    
            }
           
            
            public void doTrip() {
                    
            }
    
    }
    I've also added it in objecthandler and such, too lazy to bring them up to get the codes at this time, but they're right.

    Now, inside dialoguehandler.java, I have:

    Code:
    			   Class<Dialogue> value54 = (Class<Dialogue>) Class
    					.forName(2465Portal.class.getCanonicalName());
    			handledDialogues.put("2465Portal", value54);
    When I try to compile, I get 5 errors:
    Code:
    src\com\rs\game\player\dialogues\DialogueHandler.java:179: error: ')' expected
                                            .forName(2465Portal.class.getCanonicalNa
    me());
                                                         ^
    src\com\rs\game\player\dialogues\DialogueHandler.java:179: error: illegal start
    of expression
                                            .forName(2465Portal.class.getCanonicalNa
    me());
                                                               ^
    src\com\rs\game\player\dialogues\DialogueHandler.java:179: error: ';' expected
                                            .forName(2465Portal.class.getCanonicalNa
    me());
                                                                ^
    src\com\rs\game\player\dialogues\DialogueHandler.java:179: error: illegal start
    of expression
                                            .forName(2465Portal.class.getCanonicalNa
    me());
                                                                     ^
    src\com\rs\game\player\dialogues\DialogueHandler.java:179: error: ';' expected
                                            .forName(2465Portal.class.getCanonicalNa
    me());
    
      ^
    5 errors
    Press any key to continue . . .
    I assume this error is because the class file isn't correct, and the dialoguehandler it leads it to the class file. I've made the class file in the correct spot, but it's empty. I've tried removing the code from dialoguehandler.java to get rid of the compiling errors, so it would create the class file with the code, but that didn't work.

    Can anyone help?
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Apr 2010
    Age
    30
    Posts
    199
    Thanks given
    49
    Thanks received
    23
    Rep Power
    11
    Use eclipse or netbeans or any other IDE.
    Reply With Quote  
     

  3. #3  
    Father Of Lies


    Join Date
    May 2012
    Age
    26
    Posts
    1,216
    Thanks given
    267
    Thanks received
    289
    Rep Power
    242
    It's obvious that a class name cannot start with numbers.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. how would i create my own .idx file
    By Paketa in forum Help
    Replies: 0
    Last Post: 12-31-2010, 01:12 AM
  2. Decompiler Class File Into Java File
    By PrataKosong in forum Help
    Replies: 1
    Last Post: 12-28-2009, 10:14 AM
  3. Some Class file that popped up when loading rsbot 574 jar file
    By Streax in forum Application Development
    Replies: 2
    Last Post: 12-15-2009, 03:05 PM
  4. Create your First Html File
    By Hax On in forum Website Development
    Replies: 14
    Last Post: 02-14-2009, 07:27 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •