You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, great work with this steamworks4j so far, it is a life savior. This being said, i m new here and i needed a way to access the steam leaderboards and i was looking in your tests to find how to call what i need. This being said, i copied all the callbacks from the SteamClientAPITest.java and the problem is that the attribute currentLeaderboard, defined as private SteamLeaderboardHandle is always null, even after reading the leaderboard
The method registerInterfaces() is copied from your test too, together with all the callbacks and the console informations are correct
This is my code:
//initialize and connect to steam
public boolean initAndConnect()
{
try {
SteamAPI.loadLibraries("./steam");
}
catch (SteamException e1) {
System.out.println("Load libraries error");
}
//initiation of a connection with the steam client
try {
if (!SteamAPI.init())
{
System.out.println("Initialization failed");
System.out.println("Steam running: " + SteamAPI.isSteamRunning());
isOnline = false;
return false;
}
} catch (SteamException e) {
e.printStackTrace();
}
System.out.println("Steam running: " + SteamAPI.isSteamRunning());
registerInterfaces();
isOnline = true;
return true;
};
public boolean setLeaderboard()
{
if(isOnline == false)
{
System.out.println("Steam is not online, oops problem");
return false;
}
System.out.println("We are doing some leaderboard searching here..");
System.out.println(currentLeaderboard);
//1
String name = "leaderboard_test";
userStats.findLeaderboard(name);
System.out.println(currentLeaderboard);
//2
if(currentLeaderboard != null) {
userStats.downloadLeaderboardEntries(currentLeaderboard,
SteamUserStats.LeaderboardDataRequest.Global,
100, 420);
}
//4
int score = 2200;
if (currentLeaderboard != null) {
System.out.println("uploading score " + score + " to leaderboard " + currentLeaderboard.toString());
userStats.uploadLeaderboardScore(currentLeaderboard,
SteamUserStats.LeaderboardUploadScoreMethod.KeepBest, score, new int[] {});
}
return false;
}
public void disconnect()
{
userStats.dispose();
utils.dispose();
friends.dispose();
SteamAPI.shutdown();
};
What i call from my test method is this:
sl.initAndConnect();
sl.setLeaderboard();
This being said, in the method setLeaderboard(), i print System.out.println(currentLeaderboard); in 2 locations, before and after i call this:
String name = "leaderboard_test";
userStats.findLeaderboard(name);
The name of the leaderboard is correct, i copied and pasted it from my steam admin, but the currentLeaderboard attribute is always null. And after i read the steam documentation, i heart that it should call "onLeaderboardFindResult", but nothing inside it is printed in the console, so it is not called at all, i think, hence the " currentLeaderboard = leaderboard;" is never set, so it is null
I attached the files that i am using for the test. The MainTestStart is the class where i call the actual leaderboard steam implementation from MainTestStart.txt SteamLeaderboard.txt
Thank you in advance for your help and keep up the good work XD
The text was updated successfully, but these errors were encountered:
Hello, great work with this steamworks4j so far, it is a life savior. This being said, i m new here and i needed a way to access the steam leaderboards and i was looking in your tests to find how to call what i need. This being said, i copied all the callbacks from the SteamClientAPITest.java and the problem is that the attribute currentLeaderboard, defined as private SteamLeaderboardHandle is always null, even after reading the leaderboard
The method registerInterfaces() is copied from your test too, together with all the callbacks and the console informations are correct
This is my code:
What i call from my test method is this:
This being said, in the method setLeaderboard(), i print System.out.println(currentLeaderboard); in 2 locations, before and after i call this:
String name = "leaderboard_test";
userStats.findLeaderboard(name);
The name of the leaderboard is correct, i copied and pasted it from my steam admin, but the currentLeaderboard attribute is always null. And after i read the steam documentation, i heart that it should call "onLeaderboardFindResult", but nothing inside it is printed in the console, so it is not called at all, i think, hence the " currentLeaderboard = leaderboard;" is never set, so it is null
I attached the files that i am using for the test. The MainTestStart is the class where i call the actual leaderboard steam implementation from
MainTestStart.txt
SteamLeaderboard.txt
Thank you in advance for your help and keep up the good work XD
The text was updated successfully, but these errors were encountered: