여기 요아킴의 솔루션 후 코드입니다 :자바 라벨과 휴식 오류
Scripts\OHDHerblaw.java:109: error: undefined label: label1084 if (getInventoryCount(new int[] { this.Herb }) == 0) if (getInventoryCou nt(new int[] { this.Unfinished }) == 0) if (getInventoryCount(new int[] { this.I dentified }) == 0) break label417; if (getInventoryCount(new int[] { this.Vials }) != 0) if (getInventoryCount(new int[] { this.Identified }) != 0) { if (getIn ventoryCount(new int[] { this.Vials }) != 0) if (getInventoryCount(new int[] { t his.Identified }) != 0) break label1084; if (getInventoryCount(new int[] { this. Unfinished }) != 0)
Scripts\OHDHerblaw.java:110: error: undefined label: label1084 break label1084; }
Scripts\OHDHerblaw.java:201: error: undefined label: label1391 break label1391;
Scripts\OHDHerblaw.java:202: error: undefined label: label1706 if (getInventoryCount(new int[] { this.Vials }) != 0) if (getInventoryCo unt(new int[] { this.Identified }) != 0) { if (getInventoryCount(new int[] { thi s.Vials }) != 0) if (getInventoryCount(new int[] { this.Identified }) != 0) brea k label1706; if (getInventoryCount(new int[] { this.Unfinished }) != 0)
Scripts\OHDHerblaw.java:203: error: undefined label: label1706 break label1706; }
5 errors
내가 레이블을 정의하는 방법을 잘 모르겠어요 :
여기에 지금 얻을 오류입니다.약간의 투쟁 끝에, 나는 그것을 작동 시켰습니다. 관심이있는 경우 수정 된 코드가 있습니다.
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.InputStreamReader;
public class OHDHerblaw extends Script {
int Herb;
int Identified = 0;
int Unfinished;
int Ingrediant;
int potsMade;
int Vials = 464;
int[] POTARRAY = new int[]{222, 474, 477, 480, 483, 486, 489, 492, 495, 498, 566, 569, 570};
int[] UNIDARRAY = new int[0];
int[] IDARRAY = new int[0];
boolean onlyId = false;
boolean idHerbs = false;
boolean isMixing = false;
boolean unfinishedOnly = false;
public OHDHerblaw(Extension var1) {
super(var1);
}
public void init(String var1) {
String[] var2 = var1.trim().replaceAll(" ", "").split(",");
if(!var2[0].equals("")) {
this.Herb = Integer.parseInt(var2[0]);
if(this.Herb <= 443) {
if(this.Herb == 165 || this.Herb >= 435 && this.Herb <= 443) {
this.idHerbs = true;
this.unfinishedOnly = false;
if(this.Herb == 165) {
this.Identified = 444;
this.Unfinished = 454;
} else if(this.Herb > 165) {
this.Identified = this.Herb + 10;
this.Unfinished = this.Herb + 20;
}
}
} else if(this.Herb >= 444) {
if(this.Herb >= 444 && this.Herb <= 453) {
this.Herb -= 10;
this.Identified = this.Herb + 10;
this.Unfinished = this.Herb + 20;
this.idHerbs = false;
this.unfinishedOnly = false;
} else if(this.Herb >= 454 && this.Herb <= 463) {
this.Herb -= 20;
this.Identified = this.Herb + 10;
this.Unfinished = this.Herb + 20;
this.idHerbs = false;
this.unfinishedOnly = true;
}
} else {
System.out.println("That\'s is not a valid Herb Id...");
this.stopScript();
}
}
if(!var2[1].equals("")) {
this.Ingrediant = Integer.parseInt(var2[1]);
if(this.Ingrediant != 270 && this.Ingrediant != 473 && this.Ingrediant != 220 && this.Ingrediant != 219 && this.Ingrediant != 471 && this.Ingrediant != 469 && this.Ingrediant != 472 && this.Ingrediant != 501) {
System.out.println("No ingredient selected. We will not be making full potions...");
this.Ingrediant = 0;
this.isMixing = false;
} else {
this.isMixing = true;
}
}
if(this.unfinishedOnly && !this.isMixing) {
System.out.println("Not possible, please re-check script setup...");
this.stopScript();
}
}
public int main() {
if(this.getFatigue() >= 90) {
this.useSleepingBag();
return this.random(800, 1000);
} else {
if(!this.onlyId) {
int[] var1;
if(this.isMixing) {
if(this.idHerbs && this.getInventoryCount(new int[]{this.Herb}) > 0) {
this.useItem(this.getInventoryIndex(new int[]{this.Herb}));
return this.random(200, 350);
}
if(this.getInventoryCount(new int[]{this.Identified}) > 0 && this.getInventoryCount(new int[]{this.Vials}) > 0 && this.getInventoryCount(new int[]{this.Herb}) == 0) {
this.useItemWithItem(this.getInventoryIndex(new int[]{this.Identified}), this.getInventoryIndex(new int[]{this.Vials}));
return this.random(200, 350);
}
if(this.getInventoryCount(new int[]{this.Ingrediant}) > 0 && this.getInventoryCount(new int[]{this.Unfinished}) > 0) {
this.useItemWithItem(this.getInventoryIndex(new int[]{this.Ingrediant}), this.getInventoryIndex(new int[]{this.Unfinished}));
return this.random(500, 600);
}
if(this.getInventoryCount(new int[]{this.Herb}) == 0 && this.getInventoryCount(new int[]{this.Unfinished}) == 0 && this.getInventoryCount(new int[]{this.Identified}) == 0 || this.getInventoryCount(new int[]{this.Vials}) == 0 || this.getInventoryCount(new int[]{this.Identified}) == 0 || (this.getInventoryCount(new int[]{this.Vials}) == 0 || this.getInventoryCount(new int[]{this.Identified}) == 0) && this.getInventoryCount(new int[]{this.Unfinished}) == 0) {
if(this.isQuestMenu()) {
this.answer(0);
return this.random(2000, 3000);
}
if(this.isBanking()) {
int var2;
if(this.unfinishedOnly) {
if(this.getInventoryCount(new int[]{this.Ingrediant}) == 0 || this.getInventoryCount(new int[]{this.Unfinished}) == 0) {
for(var2 = 0; var2 < this.POTARRAY.length; ++var2) {
if(this.getInventoryCount(new int[]{this.POTARRAY[var2]}) > 0) {
this.deposit(this.POTARRAY[var2], this.getInventoryCount(new int[]{this.POTARRAY[var2]}));
return this.random(1250, 1500);
}
}
}
if(this.getInventoryCount(new int[]{this.Unfinished}) == 0) {
this.withdraw(this.Unfinished, 14);
return this.random(1500, 2000);
}
if(this.getInventoryCount(new int[]{this.Ingrediant}) == 0 && this.getInventoryCount(new int[]{this.Unfinished}) > 0) {
this.withdraw(this.Identified, this.getInventoryCount(new int[]{this.Unfinished}));
return this.random(1500, 2000);
}
this.closeBank();
return this.random(200, 300);
}
if(!this.unfinishedOnly) {
if(this.getInventoryCount(new int[]{this.Ingrediant}) == 0 || this.getInventoryCount(new int[]{this.Unfinished}) == 0) {
for(var2 = 0; var2 < this.POTARRAY.length; ++var2) {
if(this.getInventoryCount(new int[]{this.POTARRAY[var2]}) > 0) {
this.deposit(this.POTARRAY[var2], this.getInventoryCount(new int[]{this.POTARRAY[var2]}));
return this.random(1250, 1500);
}
}
}
if(this.getInventoryCount(new int[]{this.Unfinished}) > 0) {
this.withdraw(this.Ingrediant, this.getInventoryCount(new int[]{this.Unfinished}));
this.closeBank();
return this.random(2000, 3000);
}
if(this.getInventoryCount(new int[]{this.Vials}) == 0) {
this.withdraw(this.Vials, 14);
return this.random(1000, 1500);
}
if(this.getInventoryCount(new int[]{this.Herb}) == 0 && this.getInventoryCount(new int[]{this.Unfinished}) == 0 && this.getInventoryCount(new int[]{this.Identified}) == 0 && this.idHerbs) {
this.withdraw(this.Herb, 14);
return this.random(2000, 3000);
}
if(this.getInventoryCount(new int[]{this.Identified}) == 0) {
this.withdraw(this.Identified, 14);
return this.random(1000, 1500);
}
this.closeBank();
return this.random(1000, 1500);
}
}
var1 = this.getNpcByIdNotTalk(this.BANKERS);
if(var1[0] != -1 && !this.isBanking() && !this.isQuestMenu() && this.getInventoryCount(new int[]{this.Ingrediant}) == 0) {
this.talkToNpc(var1[0]);
return this.random(3250, 3500);
}
}
}
if(!this.isMixing) {
if(this.idHerbs && this.getInventoryCount(new int[]{this.Herb}) > 0) {
this.useItem(this.getInventoryIndex(new int[]{this.Herb}));
return this.random(200, 350);
}
if(this.getInventoryCount(new int[]{this.Identified}) > 0 && this.getInventoryCount(new int[]{this.Vials}) > 0 && this.getInventoryCount(new int[]{this.Herb}) == 0) {
this.useItemWithItem(this.getInventoryIndex(new int[]{this.Identified}), this.getInventoryIndex(new int[]{this.Vials}));
return this.random(200, 350);
}
if(this.getInventoryCount(new int[]{this.Herb}) == 0 && this.getInventoryCount(new int[]{this.Unfinished}) == 0 && this.getInventoryCount(new int[]{this.Vials}) == 0 && this.getInventoryCount(new int[]{this.Identified}) == 0 || this.getInventoryCount(new int[]{this.Vials}) == 0 || this.getInventoryCount(new int[]{this.Identified}) == 0 || (this.getInventoryCount(new int[]{this.Vials}) == 0 || this.getInventoryCount(new int[]{this.Identified}) == 0) && this.getInventoryCount(new int[]{this.Unfinished}) == 0) {
if(this.isQuestMenu()) {
this.answer(0);
return this.random(2000, 3000);
}
if(this.isBanking()) {
if(this.getInventoryCount(new int[]{this.Herb}) == 0 && this.getInventoryCount(new int[]{this.Unfinished}) == 0 && this.getInventoryCount(new int[]{this.Vials}) == 0 && this.getInventoryCount(new int[]{this.Identified}) == 0 && this.idHerbs) {
this.withdraw(this.Herb, 14);
return this.random(2000, 3000);
}
if(this.getInventoryCount(new int[]{this.Unfinished}) > 0) {
this.deposit(this.Unfinished, this.getInventoryCount(new int[]{this.Unfinished}));
return this.random(200, 300);
}
if(this.getInventoryCount(new int[]{this.Vials}) == 0) {
this.withdraw(this.Vials, 14);
return this.random(1000, 1500);
}
if(this.getInventoryCount(new int[]{this.Identified}) == 0) {
this.withdraw(this.Identified, 14);
return this.random(1000, 1500);
}
this.closeBank();
return this.random(1000, 1500);
}
var1 = this.getNpcByIdNotTalk(this.BANKERS);
if(var1[0] != -1 && !this.isBanking() && !this.isQuestMenu()) {
this.talkToNpc(var1[0]);
return this.random(3500, 3750);
}
}
}
}
return this.random(200, 300);
}
}
}
무엇이 문제입니까? – Ingo
한 단계를 해결 한 후에 전체 질문을 다시 작성하지 마십시오. 새 정보를 질문에 추가하거나 원래 질문과 크게 다른 경우 별도의 질문을하십시오. 그러나이 방법을 사용하면 나중에 솔루션을 검색하는 사람들에게 의미있는 질문을 남기지 않을 것입니다. (그리고 * 대부분은 SO 사용자입니다.) –
여러 번 추가하려고 시도했지만 코드에 잘못된 들여 쓰기가 있었기 때문에 코드 패드에 넣은 것입니다. 코드와 관련하여, 필자와 다른 사람들도 이해할 수 있습니다. 라벨이 정의되어 있으면 왜 정의되지 않은 것으로 나타 납니까? –