I don't really know any Java but...But wouldnt the tempSave be tempsave or you could change this PlayerSave tempsave = new PlayerSave(plr); to this PlayerSave tempSave = new PlayerSave(plr);
|
umm i don't understand why when i try to use tempSave in a second boolean to save playerdata it doesnt work. I used it in the boolean above to save "username".dat but it wont work when making "username".txt. i get this error when compiling
and btw heres the working boolean:PlayerSave.java:82: cannot find symbol
symbol : variable tempSave
location: class PlayerSave
ObjectOutputStream out = new ObjectOutputStream(new FileOutputSt
ream("./character/"+tempSave.playerName+".txt"));
^
PlayerSave.java:83: cannot find symbol
symbol : variable tempSave
location: class PlayerSave
out.writeObject((PlayerSave)tempSave);
^
Note: stream.java uses or overrides a deprecated API.
Note: Recompile with -Xlinteprecation for details.
2 errors
Press any key to continue . . .
and the nonworking boolean:private boolean saveGame(Player plr)
{
PlayerSave tempSave = new PlayerSave(plr);
try
{
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("./savedGames/"+tempSave.playerName+".dat"));
out.writeObject((PlayerSave)tempSave);
out.close();
/*
ObjectOutputStream out = new ObjectOutputStream( new FileOutputStream("./character/"+tempSave.playerName+".txt"));
out.writeObject((PlayerSave)tempSave);
out.close();*/
}
catch(Exception e){
return false;
}
return true;
}
Help would be GREATLY appreaciatedprivate boolean savedGameAccesible (Player plr)
{
PlayerSave tempsave = new PlayerSave(plr);
try
{
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("./character/"+tempSave.playerName+".txt"));
out.writeObject((PlayerSave)tempSave);
out.close();
}
catch(Exception e){
return false;
}
return true;
}
}
and of course,
repp++
I don't really know any Java but...But wouldnt the tempSave be tempsave or you could change this PlayerSave tempsave = new PlayerSave(plr); to this PlayerSave tempSave = new PlayerSave(plr);
well it has to be tempSave with the capital 2 because java is case sensitive; the second word is started by making the firs letter capital.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |