Thread: Orphaned case [PI]

Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1 Orphaned case [PI] 
    Registered Member
    Join Date
    Oct 2013
    Age
    30
    Posts
    363
    Thanks given
    54
    Thanks received
    84
    Rep Power
    54
    Hello,

    While I am following a tutorial, I opened 'ClickItem.java' and added the code:
    [SPOIL]case 6199:
    if(System.currentTimeMillis() - c.lastMysteryBox < 5000) {
    c.sendMessage("You can only use the mystery box every 5 seconds.");
    return;
    }
    MysteryBox.addItem(c);
    break/SPOIL]

    After I've finished everything, I got an error:


    Your help is needed & appreciated. I'm new to coding. :l
    Reply With Quote  
     

  2. #2  
    Registered Member
    Jay's Avatar
    Join Date
    Apr 2012
    Posts
    541
    Thanks given
    96
    Thanks received
    177
    Rep Power
    201
    Look in clickitem.java for another case 6199 or change the one you are using to another.
    Orphaned case means that case is already used.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Oct 2013
    Age
    30
    Posts
    363
    Thanks given
    54
    Thanks received
    84
    Rep Power
    54
    Quote Originally Posted by Jay' View Post
    Look in clickitem.java for another case 6199 or change the one you are using to another.
    Orphaned case means that case is already used.
    Nope, I changed the case to 6198 and I still get the same error & I'm sure 100% that the case 6199 isn't used.
    Reply With Quote  
     

  4. #4  
    Registered Member
    Jay's Avatar
    Join Date
    Apr 2012
    Posts
    541
    Thanks given
    96
    Thanks received
    177
    Rep Power
    201
    Quote Originally Posted by Enviat View Post
    Nope, I changed the case to 6198 and I still get the same error & I'm sure 100% that the case 6199 isn't used.
    Could you post your clickitems.java here for us to check, use code/spoiler wrap.
    Reply With Quote  
     

  5. #5  
    Registered Member
    shed's Avatar
    Join Date
    Dec 2010
    Posts
    1,835
    Thanks given
    504
    Thanks received
    576
    Rep Power
    5000
    iirc orphaned case means it's not in a switch. Check if you entered it correctly.

    post your clickitem.java.
    "We don't submit to terror. We make the terror." - #FU2016
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Jan 2013
    Age
    29
    Posts
    80
    Thanks given
    61
    Thanks received
    9
    Rep Power
    33
    Check that it's actually inside the switch statement, or if it's definitely inside the switch, make sure it's not surrounded by an if statement
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Oct 2013
    Age
    30
    Posts
    363
    Thanks given
    54
    Thanks received
    84
    Rep Power
    54
    Here's ClickItem class:
    package server.model.players.packets;

    import server.model.players.Client;
    import server.model.players.PacketType;


    /**
    * Clicking an item, bury bone, eat food etc
    **/
    public class ClickItem implements PacketType {

    @Override
    public void processPacket(Client c, int packetType, int packetSize) {
    int junk = c.getInStream().readSignedWordBigEndianA();
    int itemSlot = c.getInStream().readUnsignedWordA();
    int itemId = c.getInStream().readUnsignedWordBigEndian();
    if (itemId != c.playerItems[itemSlot] - 1) {
    return;
    }
    if (itemId >= 5509 && itemId <= 5514) {
    int pouch = -1;
    int a = itemId;
    if (a == 5509)
    pouch = 0;
    if (a == 5510)
    pouch = 1;
    if (a == 5512)
    pouch = 2;
    if (a == 5514)
    pouch = 3;
    c.getPA().fillPouch(pouch);
    return;
    }
    case 6199:
    if(System.currentTimeMillis() - c.lastMysteryBox < 5000) {
    c.sendMessage("You can only use the mystery box every 5 seconds.");
    return;
    }else
    MysteryBox.addItem(c);
    if (c.getHerblore().isUnidHerb(itemId))
    c.getHerblore().handleHerbClick(itemId);
    if (c.getFood().isFood(itemId))
    c.getFood().eat(itemId,itemSlot);
    //ScriptManager.callFunc("itemClick_"+itemId, c, itemId, itemSlot);
    if (c.getPotions().isPotion(itemId))
    c.getPotions().handlePotion(itemId,itemSlot);
    if (c.getPrayer().isBone(itemId))
    c.getPrayer().buryBone(itemId, itemSlot);
    if (itemId == 952) {
    if(c.inArea(3553, 3301, 3561, 3294)) {
    c.teleTimer = 3;
    c.newLocation = 1;
    } else if(c.inArea(3550, 3287, 3557, 3278)) {
    c.teleTimer = 3;
    c.newLocation = 2;
    } else if(c.inArea(3561, 3292, 3568, 3285)) {
    c.teleTimer = 3;
    c.newLocation = 3;
    } else if(c.inArea(3570, 3302, 3579, 3293)) {
    c.teleTimer = 3;
    c.newLocation = 4;
    } else if(c.inArea(3571, 3285, 3582, 3278)) {
    c.teleTimer = 3;
    c.newLocation = 5;
    } else if(c.inArea(3562, 3279, 3569, 3273)) {
    c.teleTimer = 3;
    c.newLocation = 6;
    }
    }
    }

    }
    Reply With Quote  
     

  8. #8  
    Registered Member
    Jay's Avatar
    Join Date
    Apr 2012
    Posts
    541
    Thanks given
    96
    Thanks received
    177
    Rep Power
    201
    [SPOIL]
    Code:
    package server.model.players.packets;
    
    import server.model.players.Client;
    import server.model.players.PacketType;
    
    
    /**
    * Clicking an item, bury bone, eat food etc
    **/
    public class ClickItem implements PacketType {
    
    @Override
    public void processPacket(Client c, int packetType, int packetSize) {
    int junk = c.getInStream().readSignedWordBigEndianA();
    int itemSlot = c.getInStream().readUnsignedWordA();
    int itemId = c.getInStream().readUnsignedWordBigEndian();
    if (itemId != c.playerItems[itemSlot] - 1) {
    return;
    }
    if (itemId >= 5509 && itemId <= 5514) {
    int pouch = -1;
    int a = itemId;
    if (a == 5509)
    pouch = 0;
    if (a == 5510)
    pouch = 1;
    if (a == 5512)
    pouch = 2;
    if (a == 5514)
    pouch = 3;
    c.getPA().fillPouch(pouch);
    return;
    }
    case 6199: 
    if(System.currentTimeMillis() - c.lastMysteryBox < 5000) {
    c.sendMessage("You can only use the mystery box every 5 seconds.");
    return;
    }else {
    MysteryBox.addItem(c);
    return;
    }
    if (c.getHerblore().isUnidHerb(itemId))
    c.getHerblore().handleHerbClick(itemId);
    if (c.getFood().isFood(itemId))
    c.getFood().eat(itemId,itemSlot);
    //ScriptManager.callFunc("itemClick_"+itemId, c, itemId, itemSlot);
    if (c.getPotions().isPotion(itemId))
    c.getPotions().handlePotion(itemId,itemSlot);
    if (c.getPrayer().isBone(itemId))
    c.getPrayer().buryBone(itemId, itemSlot);
    if (itemId == 952) {
    if(c.inArea(3553, 3301, 3561, 3294)) {
    c.teleTimer = 3;
    c.newLocation = 1;
    } else if(c.inArea(3550, 3287, 3557, 3278)) {
    c.teleTimer = 3;
    c.newLocation = 2;
    } else if(c.inArea(3561, 3292, 3568, 3285)) {
    c.teleTimer = 3;
    c.newLocation = 3;
    } else if(c.inArea(3570, 3302, 3579, 3293)) {
    c.teleTimer = 3;
    c.newLocation = 4;
    } else if(c.inArea(3571, 3285, 3582, 3278)) {
    c.teleTimer = 3;
    c.newLocation = 5;
    } else if(c.inArea(3562, 3279, 3569, 3273)) {
    c.teleTimer = 3;
    c.newLocation = 6;
    }
    }
    }
    
    }
    [/SPOIL]
    Try this, havnt coded in awhile but guess this should work.
    Reply With Quote  
     

  9. #9  
    The internet's reject
    Andy's Avatar
    Join Date
    Jun 2007
    Age
    33
    Posts
    4,371
    Thanks given
    148
    Thanks received
    1,522
    Rep Power
    3133
    Quote Originally Posted by Enviat View Post
    Here's ClickItem class:
    your code is showing as orphaned because it isn't inside a switch statement.

    Code:
    package server.model.players.packets;
    
    import server.model.players.Client;
    import server.model.players.PacketType;
    
    
    /**
    * Clicking an item, bury bone, eat food etc
    **/
    public class ClickItem implements PacketType {
        
        @Override
        public void processPacket(Client c, int packetType, int packetSize) {
            int junk = c.getInStream().readSignedWordBigEndianA();
            int itemSlot = c.getInStream().readUnsignedWordA();
            int itemId = c.getInStream().readUnsignedWordBigEndian();
            if (itemId != c.playerItems[itemSlot] - 1) {
                return;
            }
            if (itemId &gt;= 5509 && itemId &lt;= 5514) {
                int pouch = -1;
                int a = itemId;
                if (a == 5509)
                pouch = 0;
                if (a == 5510)
                pouch = 1;
                if (a == 5512)
                pouch = 2;
                if (a == 5514)
                pouch = 3;
                c.getPA().fillPouch(pouch);
                return;
            }
          if (itemId == 6199) {
        if (System.currentTimeMillis() - c.lastMysteryBox & lt; 5000) {
            c.sendMessage("You can only use the mystery box every 5 seconds.");
            return;
        } else {
            MysteryBox.addItem(c);
        }
    }
            if (c.getHerblore().isUnidHerb(itemId))
            c.getHerblore().handleHerbClick(itemId);
            if (c.getFood().isFood(itemId))
            c.getFood().eat(itemId,itemSlot);
            //ScriptManager.callFunc("itemClick_"+itemId, c, itemId, itemSlot);
            if (c.getPotions().isPotion(itemId))
            c.getPotions().handlePotion(itemId,itemSlot);
            if (c.getPrayer().isBone(itemId))
            c.getPrayer().buryBone(itemId, itemSlot);
            if (itemId == 952) {
                if(c.inArea(3553, 3301, 3561, 3294)) {
                    c.teleTimer = 3;
                    c.newLocation = 1;
                    } else if(c.inArea(3550, 3287, 3557, 3278)) {
                    c.teleTimer = 3;
                    c.newLocation = 2;
                    } else if(c.inArea(3561, 3292, 3568, 3285)) {
                    c.teleTimer = 3;
                    c.newLocation = 3;
                    } else if(c.inArea(3570, 3302, 3579, 3293)) {
                    c.teleTimer = 3;
                    c.newLocation = 4;
                    } else if(c.inArea(3571, 3285, 3582, 3278)) {
                    c.teleTimer = 3;
                    c.newLocation = 5;
                    } else if(c.inArea(3562, 3279, 3569, 3273)) {
                    c.teleTimer = 3;
                    c.newLocation = 6;
                }
            }
        }
        
    }
    The red code indicates what was changed
    What am I watching now?

    Reply With Quote  
     

  10. #10  
    Registered Member
    Join Date
    Oct 2013
    Age
    30
    Posts
    363
    Thanks given
    54
    Thanks received
    84
    Rep Power
    54
    Quote Originally Posted by Andy View Post
    your code is showing as orphaned because it isn't inside a switch statement.

    Code:
    package server.model.players.packets;
    
    import server.model.players.Client;
    import server.model.players.PacketType;
    
    
    /**
    * Clicking an item, bury bone, eat food etc
    **/
    public class ClickItem implements PacketType {
        
        @Override
        public void processPacket(Client c, int packetType, int packetSize) {
            int junk = c.getInStream().readSignedWordBigEndianA();
            int itemSlot = c.getInStream().readUnsignedWordA();
            int itemId = c.getInStream().readUnsignedWordBigEndian();
            if (itemId != c.playerItems[itemSlot] - 1) {
                return;
            }
            if (itemId >= 5509 && itemId <= 5514) {
                int pouch = -1;
                int a = itemId;
                if (a == 5509)
                pouch = 0;
                if (a == 5510)
                pouch = 1;
                if (a == 5512)
                pouch = 2;
                if (a == 5514)
                pouch = 3;
                c.getPA().fillPouch(pouch);
                return;
            }
          if (itemId == 6199) {
    		        if(System.currentTimeMillis() - c.lastMysteryBox < 5000) {
    		            c.sendMessage("You can only use the mystery box every 5 seconds.");
    		            return;
    		        } else {
    		        MysteryBox.addItem(c);
    		        }
            if (c.getHerblore().isUnidHerb(itemId))
            c.getHerblore().handleHerbClick(itemId);
            if (c.getFood().isFood(itemId))
            c.getFood().eat(itemId,itemSlot);
            //ScriptManager.callFunc("itemClick_"+itemId, c, itemId, itemSlot);
            if (c.getPotions().isPotion(itemId))
            c.getPotions().handlePotion(itemId,itemSlot);
            if (c.getPrayer().isBone(itemId))
            c.getPrayer().buryBone(itemId, itemSlot);
            if (itemId == 952) {
                if(c.inArea(3553, 3301, 3561, 3294)) {
                    c.teleTimer = 3;
                    c.newLocation = 1;
                    } else if(c.inArea(3550, 3287, 3557, 3278)) {
                    c.teleTimer = 3;
                    c.newLocation = 2;
                    } else if(c.inArea(3561, 3292, 3568, 3285)) {
                    c.teleTimer = 3;
                    c.newLocation = 3;
                    } else if(c.inArea(3570, 3302, 3579, 3293)) {
                    c.teleTimer = 3;
                    c.newLocation = 4;
                    } else if(c.inArea(3571, 3285, 3582, 3278)) {
                    c.teleTimer = 3;
                    c.newLocation = 5;
                    } else if(c.inArea(3562, 3279, 3569, 3273)) {
                    c.teleTimer = 3;
                    c.newLocation = 6;
                }
            }
        }
        
    }
    The red code indicates what was changed
    Ah. I changed the whole class to the one you gave me and got 9 errors:
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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. Orphaned case [PI]
    By 420 in forum Help
    Replies: 6
    Last Post: 10-31-2012, 01:15 AM
  2. [PI] Orphaned case
    By LorenzoMKW in forum Help
    Replies: 9
    Last Post: 05-16-2011, 08:16 AM
  3. Orphaned Case - PI
    By Ophion in forum Help
    Replies: 4
    Last Post: 04-16-2011, 04:43 PM
  4. Replies: 0
    Last Post: 01-08-2011, 04:25 AM
  5. [PI] Orphaned case
    By Mark in forum Help
    Replies: 12
    Last Post: 11-12-2010, 01:17 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
  •