you need to declare it in client class and call it in clickingmost class by c.selection
but i advised to rename selection to something better like classType or classId
|
Im trying to make saving the "classd" of the player on my server work
in clickingMost.java i have
in client.java i haveCode:case 43027: c.sM("You have chosen the Human Class"); c.RemoveAllWindows(); selection = 1; break;
How do i make the variable from clickingMost.java work in client.javaCode:else if (token.equals("character-class")) { selection = Integer.parseInt(token2);
As im currently getting errors of the variable not being found.
you need to declare it in client class and call it in clickingmost class by c.selection
but i advised to rename selection to something better like classType or classId
Have you declared the varible in player.java try public int selection; or public int classd;
Okay add it under public abstract class Player implements Constants { in player.java or player class..
p.s: Read my SB appeal
I assume your getting a static error? Please post the error your getting.
Code:clickingMost.java:75: cannot find symbol symbol : variable selection location: class client c.selection = 1; ^ clickingMost.java:87: cannot find symbol symbol : variable selection location: class client c.selection = 2; ^ clickingMost.java:101: cannot find symbol symbol : variable selection location: class client c.selection = 3; ^ clickingMost.java:115: cannot find symbol symbol : variable selection location: class client c.selection = 4; ^ client.java:10666: cannot find symbol symbol : variable selection location: class client selection = Integer.parseInt(tok en2); ^ Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. 5 errors Press any key to continue . . .
Follow these steps and ignore everyone else.
At the top of client.java under player immplements {
add this:
Then at the top of clicking most, addCode:public static selection = 0;
Post any errors I might of given you.Code:public static client client;
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |