Jump to content
  • 0
Sign in to follow this  
chrischris567

NPC in Minigame, Orphaned Case

Question

I'm making a minigame where basically you kill monsters in a room until you get a key. Then you talk to a near NPC with the key in your inventory and he rewards you with 10M. If you don't have the key, he says Hmm, I don't see a key in your inventory! I think I got most of this working except where he gives 10m if you have the key or says Hmm, I don't see a key in your inventory if you dont have the key. When I compile, I get one error. (Remember, this is in DialogueManager.java)

Compile error:

Compiling RS2Server...
src\org\dementhium\content\DialogueManager.java:1964: error: orphaned case
case 1706:
^
1 error
Complete
Press any key to continue . . .


Here is the script that is becoming orphaned:

case 758:
}
if (player.getInventory().contains(18300, 1)) {
player.getInventory().deleteItem(18300, 1);
player.getInventory().addDropable(new Item(995, 10000000));
sendDialogue(player, HAPPY_TALKING, 758, -1, "Spend that hard earned money! You deserve it!");
} else {
sendDialogue(player, CONFUSED, 758, -1, "Hmmm, you don't seem to have a key!");
return false;
case 1706:
sendDialogue(player, MEAN_FACE, 1706, 70000, "Ah, what is this? A new challenger?");
return true;

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0
Usually orphaned cases are a missing bracket, so I added a bracket between sendDialogue(player, MEAN_FACE, 1706, 70000, "Ah, what is this? A new challenger?"); and return true and got 100 compiling errors.

Share this post


Link to post
Share on other sites
  • 0
What I saw in the code you posted, in a matter of seconds:
1) You have a closing bracket at the beginning of your case, if it doesn't have an actual purpose, then shame on you.
2) You didn't close the if else in the first case..
3) you're not using break; at the end of your cases.. (I'm not even sure why you're making it return a boolean)
I don't develop this base and never looked into it so my statements might not be 100% accurate, but it just seemed really odd..

Mouth open, here comes the spoon:

[code]
case 758:
if (player.getInventory().contains(18300, 1)) {
player.getInventory().deleteItem(18300, 1);
player.getInventory().addDropable(new Item(995, 10000000));
sendDialogue(player, HAPPY_TALKING, 758, -1, "Spend that hard earned money! You deserve it!");
} else {
sendDialogue(player, CONFUSED, 758, -1, "Hmmm, you don't seem to have a key!");
}
break;
case 1706:
sendDialogue(player, MEAN_FACE, 1706, 70000, "Ah, what is this? A new challenger?");
break;
[/code]

Share this post


Link to post
Share on other sites
  • 0
[quote name='Mercenary']What I saw in the code you posted, in a matter of seconds:
1) You have a closing bracket at the beginning of your case, if it doesn't have an actual purpose, then shame on you.
2) You didn't close the if else in the first case..
3) you're not using break; at the end of your cases.. (I'm not even sure why you're making it return a boolean)
I don't develop this base and never looked into it so my statements might not be 100% accurate, but it just seemed really odd..

Mouth open, here comes the spoon:

[code]
case 758:
if (player.getInventory().contains(18300, 1)) {
player.getInventory().deleteItem(18300, 1);
player.getInventory().addDropable(new Item(995, 10000000));
sendDialogue(player, HAPPY_TALKING, 758, -1, "Spend that hard earned money! You deserve it!");
} else {
sendDialogue(player, CONFUSED, 758, -1, "Hmmm, you don't seem to have a key!");
}
break;
case 1706:
sendDialogue(player, MEAN_FACE, 1706, 70000, "Ah, what is this? A new challenger?");
break;
[/code][/QUOTE]

Lmao I liked the mouth open, here comes the spoon. Anyway man, it worked. Thanks :) Next time i'll learn from mistakes and not act so dumb! :) I really appreciate it

Share this post


Link to post
Share on other sites
Sign in to follow this  

×