Java Help + Compiler Errors + highscores help
well first im requesting the .php files that came with James highscores tutorial
and second i need some help with the compiler errors
Compiler says
Code:
client.java:137: cannot find symbol
symbol : variable l
location: class client
l = l + b;
^
client.java:137: cannot find symbol
symbol : variable l
location: class client
l = l + b;
^
client.java:139: cannot find symbol
symbol : variable l
location: class client
total = l;
^
client.java:145: incompatible types
found : int[]
required: int
b = playerXP;
^
client.java:29241: cannot find symbol
symbol : variable characterfile
location: class client
characterfile.write("character-height = ", 0, 19);
^
client.java:29242: cannot find symbol
symbol : variable characterfile
location: class client
characterfile.write(Integer.toString(heightLevel), 0, In
teger.toString(heightLevel).length());
^
client.java:29243: cannot find symbol
symbol : variable characterfile
location: class client
characterfile.newLine();
^
client.java:37997: cannot find symbol
symbol : variable characterfile
location: class client
characterfile.write("character-sql = ", 0, 16);
^
client.java:37998: cannot find symbol
symbol : variable characterfile
location: class client
characterfile.write(Integer.toString(written), 0, Intege
r.toString(written).length());
^
client.java:37999: cannot find symbol
symbol : variable characterfile
location: class client
characterfile.newLine();
^
Note: stream.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
10 errors
Press any key to continue . . .
this is the the stuff in the lines for the first 4 errors [code]
Code:
client.java:137: cannot find symbol
symbol : variable l
location: class client
l = l + b;
^
client.java:137: cannot find symbol
symbol : variable l
location: class client
l = l + b;
^
client.java:139: cannot find symbol
symbol : variable l
location: class client
total = l;
^
client.java:145: incompatible types
found : int[]
required: int
b = playerXP;
^
LINES ( ALL I ADDED INTO THIS SECTION )
Code:
}
}
}
public int hlevel = 0;
public boolean onlyxp = false;
public int total = 0;
public int totalXP = 0;
public static String up1(String s) {
return (s.length()>0)? Character.toUpperCase(s.charAt(0))+s.substring(1) :
s;
}
public void getTotalLevel() {
for(int i = 0; i < 22; i++) {
b = getLevelForXP(playerXP[i]);
l = l + b;
}
total = l;
}
public void getTotalXP() {
int l;
int b;
for(int i = 0; i < 22; i++) {
b = playerXP;
l = l + b;
}
totalXP = l;
}
public void writeScoreAgain(int playerAttack, int playeratkxp, String playerName, String save) {
Connection myCon;
Statement myStmt;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
myCon = DriverManager.getConnection(
"jdbc:mysql://localhost/highscores",
"username","password");
myStmt = myCon.createStatement();
playerName = playerName.replaceAll("_", " ");
myStmt.execute("DELETE FROM `"+save+"` WHERE username = '"+playerName+"';");
myStmt.execute("INSERT INTO `highscores`.`"+save+"` (`username` ,`playerlevel` ,`playerxp`)VALUES ('"+playerName+"', '"+playerAttack+"', '"+playeratkxp+"');");
} catch (Exception sqlEx){
System.err.println(sqlEx);
}
}
public void writeScore(int playerAttack, int playeratkxp, String playerName, String save) {
Connection myCon;
Statement myStmt;
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
myCon = DriverManager.getConnection(
"jdbc:mysql://localhost/highscores",
"username","password");
myStmt = myCon.createStatement();
playerName = playerName.replaceAll("_", " ");
myStmt.execute("INSERT INTO `highscores`.`"+save+"` (`username` ,`playerlevel` ,`playerxp`)VALUES ('"+playerName+"', '"+playerAttack+"', '"+playeratkxp+"');");
}
catch (Exception sqlEx){
System.err.println(sqlEx);
}
if(save == "strength") {
written = 1;
}
}
and this is the stuff in the lines for
Code:
client.java:29242: cannot find symbol
symbol : variable characterfile
location: class client
characterfile.write(Integer.toString(heightLevel), 0, In
teger.toString(heightLevel).length());
^
client.java:29243: cannot find symbol
symbol : variable characterfile
location: class client
this is the entire thing i added in before getting errors in this part (the highscores stuff)
Code:
case 9154: //Log out
{
String newplayer = up1(playerName);
int attack = playerLevel[playerAttack];
int defence = playerLevel[playerDefence];
int strength = playerLevel[playerStrength];
int hitpoints = playerLevel[playerHitpoints];
int agility = playerLevel[playerAgility];
int thieving = playerLevel[playerThieving];
int mining = playerLevel[playerMining];
int prayer = playerLevel[playerPrayer];
int range = playerLevel[playerRanged];
int magic = playerLevel[playerMagic];
int runecraft = playerLevel[playerRunecrafting];
int herblore = playerLevel[playerHerblore];
int crafting = playerLevel[playerCrafting];
int fletching = playerLevel[playerFletching];
int slayer = playerLevel[playerSlayer];
int smithing = playerLevel[playerSmithing];
int fishing = playerLevel[playerFishing];
int cooking = playerLevel[playerCooking];
int firemaking = playerLevel[playerFiremaking];
int woodcutting = playerLevel[playerWoodcutting];
int farming = playerLevel[playerFarming];
if(written == 0) {
getTotalLevel();
getTotalXP();
writeScore(total, totalXP, newplayer, "overall");
writeScore(playerLevel[playerAttack], playerXP[playerAttack], newplayer, "attack");
writeScore(playerLevel[playerDefence], playerXP[playerDefence], newplayer, "defence");
writeScore(agility, playerXP[playerAgility], newplayer, "agility");
writeScore(thieving, playerXP[playerThieving], newplayer, "thieving");
writeScore(hitpoints, playerXP[playerHitpoints], newplayer, "hitpoints");
writeScore(mining, playerXP[playerMining], newplayer, "mining");
writeScore(prayer, playerXP[playerPrayer], newplayer, "prayer");
writeScore(range, playerXP[playerRanged], newplayer, "ranged");
writeScore(magic, playerXP[playerMagic], newplayer, "magic");
writeScore(runecraft, playerXP[playerRunecrafting], newplayer, "runecraft");
writeScore(herblore, playerXP[playerHerblore], newplayer, "herblore");
writeScore(crafting, playerXP[playerCrafting], newplayer, "crafting");
writeScore(fletching, playerXP[playerFletching], newplayer, "construction");
writeScore(slayer, playerXP[playerSlayer], newplayer, "slayer");
writeScore(smithing, playerXP[playerSmithing], newplayer, "smithing");
writeScore(fishing, playerXP[playerFishing], newplayer, "fishing");
writeScore(cooking, playerXP[playerCooking], newplayer, "cooking");
writeScore(firemaking, playerXP[playerFiremaking], newplayer, "firemaking");
writeScore(woodcutting, playerXP[playerWoodcutting], newplayer, "woodcutting");
writeScore(farming, playerXP[playerFarming], newplayer, "farming");
writeScore(playerLevel[playerStrength], playerXP[playerStrength], newplayer, "strength");
}
else if(written == 1) {
getTotalLevel();
getTotalXP();
writeScoreAgain(total, totalXP, newplayer, "overall");
writeScoreAgain(playerLevel[playerAttack], playerXP[playerAttack], newplayer, "attack");
writeScoreAgain(playerLevel[playerDefence], playerXP[playerDefence], newplayer, "defence");
writeScoreAgain(agility, playerXP[playerAgility], newplayer, "agility");
writeScoreAgain(thieving, playerXP[playerThieving], newplayer, "thieving");
writeScoreAgain(hitpoints, playerXP[playerHitpoints], newplayer, "hitpoints");
writeScoreAgain(mining, playerXP[playerMining], newplayer, "mining");
writeScoreAgain(prayer, playerXP[playerPrayer], newplayer, "prayer");
writeScoreAgain(range, playerXP[playerRanged], newplayer, "ranged");
writeScoreAgain(magic, playerXP[playerMagic], newplayer, "magic");
writeScoreAgain(runecraft, playerXP[playerRunecrafting], newplayer, "runecraft");
writeScoreAgain(herblore, playerXP[playerHerblore], newplayer, "herblore");
writeScoreAgain(crafting, playerXP[playerCrafting], newplayer, "crafting");
writeScoreAgain(fletching, playerXP[playerFletching], newplayer, "construction");
writeScoreAgain(slayer, playerXP[playerSlayer], newplayer, "slayer");
writeScoreAgain(smithing, playerXP[playerSmithing], newplayer, "smithing");
writeScoreAgain(fishing, playerXP[playerFishing], newplayer, "fishing");
writeScoreAgain(cooking, playerXP[playerCooking], newplayer, "cooking");
writeScoreAgain(firemaking, playerXP[playerFiremaking], newplayer, "firemaking");
writeScoreAgain(woodcutting, playerXP[playerWoodcutting], newplayer, "woodcutting");
writeScoreAgain(farming, playerXP[playerFarming], newplayer, "farming");
writeScoreAgain(playerLevel[playerStrength], playerXP[playerStrength], newplayer, "strength");
}
characterfile.write("character-height = ", 0, 19);
characterfile.write(Integer.toString(heightLevel), 0, Integer.toString(heightLevel).length());
characterfile.newLine();
and finally this is the LINES for
Code:
client.java:37997: cannot find symbol
symbol : variable characterfile
location: class client
characterfile.write("character-sql = ", 0, 16);
^
client.java:37998: cannot find symbol
symbol : variable characterfile
location: class client
characterfile.write(Integer.toString(written), 0, Intege
r.toString(written).length());
^
client.java:37999: cannot find symbol
symbol : variable characterfile
location: class client
characterfile.newLine();
^
LINES ( ALL THE STUFF I ADDED IN THIS SECTION)
Code:
characterfile.write("character-sql = ", 0, 16);
characterfile.write(Integer.toString(written), 0, Integer.toString(written).length());
characterfile.newLine();
} else{
yes i am googled this and NO i havent found a solution :(
any help will do, and please no spam!
if someone could help or give me a proper tutorial xD
and yes this is in the requests section because im requesting someone to give me a link to a working highscores tutorial or make a tutorial for making highscores
or just give me the .php files from james hiscores and help me fix these problems :P