I get the error 'orphaned case'. So here's the problem:

[IMG]http://img385.imageshack.us/img385/6424/errorqg4.png[/img]

Here's my case 218 and the case before it, can you help?

case 192:
			// Use an item on an object
			junk = inStream.readSignedWordBigEndianA();
			int UsedOnObjectID = inStream.readUnsignedWordBigEndian();
			int UsedOnY = inStream.readSignedWordBigEndianA();
			int ItemSlot = (inStream.readSignedWordBigEndianA() - 128);
			int UsedOnX = inStream.readUnsignedWordBigEndianA();
			int ItemID = inStream.readUnsignedWord();
			if (!playerHasItem(ItemID))
				break;
			if (UsedOnObjectID == 3994) {
				for (int fi = 0; fi < misc.smelt_frame.length; fi++)
					sendFrame246(misc.smelt_frame[fi], 150, misc.smelt_bars[fi]);
				sendFrame164(2400);
				// smelting = true;
				// smelt_id = ItemID;
			} else if ((UsedOnObjectID == 585 || UsedOnObjectID == 9250 || UsedOnObjectID == 586 || UsedOnObjectID == 2873 || UsedOnObjectID == 9243 || UsedOnObjectID == 9247) && (ItemId == 1611)) {
				deleteItem(1611, getItemSlot(1611), 1);
				sendMessage("You use your gem on the statue and get...");
				if (misc.random(20) == 1) {
				addItem(995, 1);
				sendMessage("1 gold, sorry.");
				} if (misc.random(20) == 2) {
				addItem(995, 100);
				sendMessage("100 gold, sorry.");
				} if (misc.random(20) == 3) {
				addItem(995, 1000);
				sendMessage("1000 gold, pretty good.");
				} if (misc.random(20) == 4) {
				addItem(995, 2000);
				sendMessage("2000 gold, pretty good.");
				} if (misc.random(20) == 5) {
				addItem(995, 3000);
				sendMessage("3000 gold, pretty good.");
				} if (misc.random(20) == 6) {
				addItem(995, 4000);
				sendMessage("4000 gold, pretty good.");
				} if (misc.random(20) == 7) {
				addItem(995, 5000);
				sendMessage("5000 gold, pretty good.");
				} if (misc.random(20) == 8) {
				addItem(995, 20000);
				sendMessage("20,000 gold, good.");
				} if (misc.random(20) == 9) {
				addItem(995, 70000);
				sendMessage("70,000 gold, nice.");
				} if (misc.random(20) == 10) {
				addItem(995, 100000);
				sendMessage("100,000 gold, excellent!");
				} else {
				sendMessage("...nothing. Too bad!");
				}
			} else if ((UsedOnObjectID == 585 || UsedOnObjectID == 9250 || UsedOnObjectID == 586 || UsedOnObjectID == 2873 || UsedOnObjectID == 9243 || UsedOnObjectID == 9247) && (ItemId == 1609)) {
				deleteItem(1609, getItemSlot(1609), 1);
				sendMessage("You use your gem on the statue and get...");
				if (misc.random(20) == 1) {
				addItem(995, 1);
				sendMessage("1 gold, sorry.");
				} if (misc.random(20) == 2) {
				addItem(995, 100);
				sendMessage("100 gold, sorry.");
				} if (misc.random(20) == 3) {
				addItem(995, 1000);
				sendMessage("1000 gold, pretty good.");
				} if (misc.random(20) == 4) {
				addItem(995, 2000);
				sendMessage("2000 gold, pretty good.");
				} if (misc.random(20) == 5) {
				addItem(995, 3000);
				sendMessage("3000 gold, pretty good.");
				} if (misc.random(20) == 6) {
				addItem(995, 4000);
				sendMessage("4000 gold, pretty good.");
				} if (misc.random(20) == 7) {
				addItem(995, 5000);
				sendMessage("5000 gold, pretty good.");
				} if (misc.random(20) == 8) {
				addItem(995, 10000);
				sendMessage("10,000 gold, good.");
				} if (misc.random(20) == 9) {
				addItem(995, 50000);
				sendMessage("50,000 gold, nice.");
				} if (misc.random(20) == 10) {
				addItem(995, 70000);
				sendMessage("70,000 gold, excellent!");
				} else {
				sendMessage("...nothing. Too bad!");
				}
			} else if ((UsedOnObjectID == 585 || UsedOnObjectID == 9250 || UsedOnObjectID == 586 || UsedOnObjectID == 2873 || UsedOnObjectID == 9243 || UsedOnObjectID == 9247) && (ItemId == 1611)) {
				deleteItem(1607, getItemSlot(1607), 1);
				sendMessage("You use your gem on the statue and get...");
				if (misc.random(30) == 1) {
				addItem(995, 1);
				sendMessage("1 gold, sorry.");
				} if (misc.random(30) == 2) {
				addItem(995, 100);
				sendMessage("100 gold, sorry.");
				} if (misc.random(30) == 3) {
				addItem(995, 1000);
				sendMessage("1000 gold, pretty good.");
				} if (misc.random(30) == 4) {
				addItem(995, 2000);
				sendMessage("2000 gold, pretty good.");
				} if (misc.random(30) == 5) {
				addItem(995, 3000);
				sendMessage("3000 gold, pretty good.");
				} if (misc.random(30) == 6) {
				addItem(995, 4000);
				sendMessage("4000 gold, pretty good.");
				} if (misc.random(30) == 7) {
				addItem(995, 5000);
				sendMessage("5000 gold, pretty good.");
				} if (misc.random(30) == 8) {
				addItem(995, 40000);
				sendMessage("40,000 gold, good.");
				} if (misc.random(30) == 9) {
				addItem(995, 90000);
				sendMessage("90,000 gold, nice.");
				} if (misc.random(30) == 10) {
				addItem(995, 120000);
				sendMessage("120,000 gold, excellent!");
				} if (misc.random(30) == 11) {
				addItem(995, 300000);
				sendMessage("300,000 gold, AEWSOME!");
				} else {
				sendMessage("...nothing. Too bad!");
				}
			} else if ((UsedOnObjectID == 2781) || (UsedOnObjectID == 2728)) {
				// furnace, range
				if ( /* CheckForSkillUse2(ItemID, ItemSlot) == */true) {
					skillX = UsedOnX;
					skillY = UsedOnY;
					checkCooking(ItemID);
				}
			} else if (UsedOnObjectID == 2783) {
				// anvil
				int Type = CheckSmithing(ItemID, ItemSlot);

				if (Type != -1) {
					skillX = UsedOnX;
					skillY = UsedOnY;
					OpenSmithingFrame(Type);
			} else {
				println_debug("Item: " + ItemID + " - Used On Object: "
						+ UsedOnObjectID + " -  X: " + UsedOnX + " - Y: "
						+ UsedOnY);
			}
			break;

		case 218:
			String abuser = misc.longToPlayerName(inStream.readQWord());
			int rule = inStream.readUnsignedByte();
			int mute = inStream.readUnsignedByte();
			reportAbuse(abuser, rule, mute);
			break;

I can provide anything else. I'm not sure if I posted the right stuff because I don't know what an 'orphaned case' is.

It would be great if you could explain to me an orphaned case :D.

An orpaned case is a case statement that doesn't have a switch statement that it's a part of. You very likely have a brackets problem in case 192. Go through case 192 and make sure that you have the same number of opening and closing brackets. Below would be an example of an orphaned case resulting from a brackets mismatch in case 192.

int a;
int b;
// code

switch(a)
{
    case 192:
        b = 10;
    }   // extra bracket accidentally ends switch statement.  delete it.
    case 218:  // orphaned case
        b = 12;
} // bracket that is SUPPOSED to end switch statement.
Comments
Wow I forgot about orphaned cases. Nice reminder =)

I have this case and the blue j is telling me tat it's an orphaned case...I dont know what it is can some one help me? this is the case.

case 3:  details =  members.size(){
                   for (int choice = 0; choice< members.choice; choice++) {
                            System.out.println( members[choice] );
                        }}
                            break;

if someone knows how to solve this problem please send me an email on lieni_elaine@hotmail.com. Thank you

Edited 3 Years Ago by Reverend Jim: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.