PDA

View Full Version : 1 Compiling error! =[[



Shadow Ranqe
June 17th, 2010, 23:34
Thieving.java:22: cannot find symbol
symbol : variable thief
location: class Thieving
int chance = misc.random(maxlevel - thief);
^


Where do I declare public void thief? =\

bloodpk3r
June 18th, 2010, 01:12
not sure if this will work but its definitely what i would try -- declare it in client.java under

public class client extends Player implements Runnable {

then use

something like
client c = (client) server.playerHandler.players[a];

and change (maxlevel - theif); to (maxlevel - c.thief);

not sure that it will definitely work but i would do that.. :) hope it works for you

Shadow Ranqe
June 18th, 2010, 01:16
Thanks but I fixed that =]]

bloodpk3r
June 18th, 2010, 01:17
fair enough lol :) well done

Divine
June 18th, 2010, 01:17
^^That (probably) wouldn't do anything... Still worth a try but.... Ugh here's why

The error is saying the you're pointing to a variable that doesn't exsist...

In other words, you have to declare what *theif* is.

Shadow Ranqe
June 18th, 2010, 01:24
^^That (probably) wouldn't do anything... Still worth a try but.... Ugh here's why

The error is saying the you're pointing to a variable that doesn't exsist...

In other words, you have to declare what *theif* is.

I declared it in client.java but all I put was:

public int thief; Idk what to really put..

Divine
June 18th, 2010, 01:24
I declared it in client.java but all I put was:

public int thief; Idk what to really put..

o_O and your source doesn't have theiving built in????

Aaron
June 18th, 2010, 01:25
Hold on, going to redirect someone hopefully someone to help you:)

Shadow Ranqe
June 18th, 2010, 01:26
It's not that it's not already put in but I was adding a seperate ThievingHandler instead of just a small snippet in client.java.


public class Thieving {
client c;
public int[] npclist = { 1, 2, 3 };

public void checkNPC(int NPCID, client a) {
c = a;

if (NPCID == 1 || NPCID == 2 || NPCID == 3) {
Rob(1, 10, "Man", 5, 80, 0, 0, 0, 0, 0, 0);
}

}

/* BEGIN THIEVING VOID */

public void Rob(int minlevel, int maxlevel, String npc, int gold, int exp,
int items1, int items2, int items3, int items1q, int items2q,
int items3q) {
int chance = misc.random(maxlevel - c.playerLevel[17]);
int chancei1 = misc.random(3);
int chancei2 = misc.random(3);
int chancei3 = misc.random(3);
int thief = c.playerLevel[17];
if (chance <= 1) {
if (thief >= minlevel) {
c.sM("You pickpocket the " + npc + ".");
if (gold > 0) {
c.addItem(995, gold);
}
if (items1 > 0 && chancei1 == 1) {
c.addItem(items1, items1q);
}
if (items2 > 0 && chancei2 == 1) {
c.addItem(items2, items2q);
}
if (items3 > 0 && chancei3 == 1) {
c.addItem(items3, items3q);
}
c.addSkillXP(exp, 17);
c.setAnimation(881);
} else {
c.sM("You need to have a thieving level of " + minlevel
+ " to pickpocket this " + npc + ".");
}
}

else if (chance > 1) {
if (thief >= minlevel) {
c.sM("You fail to pickpocket the " + npc);
c.NewHP = (c.playerLevel[c.playerHitpoints] - 1);
c.updateRequired = true;
c.hitUpdateRequired = true;
} else {
c.sM("You need to have a thieving level of " + minlevel
+ " to pickpocket this " + npc);
}
}
}
/* END THIEVING VOID */

}

Divine
June 18th, 2010, 01:29
Hold on, going to redirect someone hopefully someone to help you:)
*Cough spamz0r Cough*

It's not that it's not already put in but I was adding a seperate ThievingHandler instead of just a small snippet in client.java.


public class Thieving {
client c;
public int[] npclist = { 1, 2, 3 };

public void checkNPC(int NPCID, client a) {
c = a;

if (NPCID == 1 || NPCID == 2 || NPCID == 3) {
Rob(1, 10, "Man", 5, 80, 0, 0, 0, 0, 0, 0);
}

}

/* BEGIN THIEVING VOID */

public void Rob(int minlevel, int maxlevel, String npc, int gold, int exp,
int items1, int items2, int items3, int items1q, int items2q,
int items3q) {
int chance = misc.random(maxlevel - c.playerLevel[17]);
int chancei1 = misc.random(3);
int chancei2 = misc.random(3);
int chancei3 = misc.random(3);
int thief = c.playerLevel[17];
if (chance <= 1) {
if (thief >= minlevel) {
c.sM("You pickpocket the " + npc + ".");
if (gold > 0) {
c.addItem(995, gold);
}
if (items1 > 0 && chancei1 == 1) {
c.addItem(items1, items1q);
}
if (items2 > 0 && chancei2 == 1) {
c.addItem(items2, items2q);
}
if (items3 > 0 && chancei3 == 1) {
c.addItem(items3, items3q);
}
c.addSkillXP(exp, 17);
c.setAnimation(881);
} else {
c.sM("You need to have a thieving level of " + minlevel
+ " to pickpocket this " + npc + ".");
}
}

else if (chance > 1) {
if (thief >= minlevel) {
c.sM("You fail to pickpocket the " + npc);
c.NewHP = (c.playerLevel[c.playerHitpoints] - 1);
c.updateRequired = true;
c.hitUpdateRequired = true;
} else {
c.sM("You need to have a thieving level of " + minlevel
+ " to pickpocket this " + npc);
}
}
}
/* END THIEVING VOID */

}

Gotcha.

Try changing this...

Public int theif;

to this...

Public int theif ();


Probably won't work but you know :D.

Shadow Ranqe
June 18th, 2010, 01:31
No no no...what I'm saying is I fixed the error already, but I'm not sure I put enough info in client.java where I declared it.
All I declared in client.java was Public int thief(); Is that all I need in client.java? O_o

Sunni
June 18th, 2010, 01:43
No no no...what I'm saying is I fixed the error already, but I'm not sure I put enough info in client.java where I declared it.
All I declared in client.java was Public int thief(); Is that all I need in client.java? O_o

Test the skill out after you compiled it and see if you get any errors while compiling it again and then if you see if the skill worked only way I can suggest if you added "enough" info, which that should've been all I believe.

The Soul
June 18th, 2010, 01:53
Don't create the instance to the client class like that, you'll receive an exception during runtime. Pass it as a parameter, for example:

public void example(Client c)

Shadow Ranqe
June 18th, 2010, 01:59
I tested it and it works, so should I change
public int thief();
to
public void thief(Client c)

Wouldn't I have to change the thief in ThievingHandler to c.thief?

The Soul
June 18th, 2010, 02:02
I tested it and it works, so should I change
public int thief();
to
public void thief(Client c)

Wouldn't I have to change the thief in ThievingHandler to c.thief?

Yes, if your 'thief' variable happens to be in the client class.

Shadow Ranqe
June 18th, 2010, 02:04
Okay, I'll test it.

Sunni
June 18th, 2010, 02:06
Is it necessary to change it to that way if it already works?

Shadow Ranqe
June 18th, 2010, 02:09
No, I guess not >_>
Can someone close this?

The Soul
June 18th, 2010, 02:10
Is it necessary to change it to that way if it already works?

Didn't you read what I said previously? I said that it would cause runtime exceptions.

Sunni
June 18th, 2010, 02:17
Didn't you read what I said previously? I said that it would cause runtime exceptions.

Well I'm sorry, I can't read. >:|

The Soul
June 18th, 2010, 02:19
Well I'm sorry, I can't read. >:|

It's fine. :p