Page 1 of 2
Lua GameJolt API [Highscore tables / achievements]
Posted: Thu Feb 05, 2015 9:16 pm
by ManInBlackSweater
Oh hey there.
I've been playing with this for a couple of hours and I guess it's ready-ready to be released.
Lua GameJolt API
Github
Have fun.
Cheers, Max.
Re: Lua GameJolt API [Highscore tables / achievements]
Posted: Thu Feb 05, 2015 10:40 pm
by josefnpat
About time! I keep saying the words "nice" over and over in a high voice.
I can't wait to try this out!
Re: Lua GameJolt API [Highscore tables / achievements]
Posted: Fri Feb 06, 2015 2:53 am
by josefnpat
About time! I keep saying the words "nice" over and over in a high voice.
I can't wait to try this out!
update:
I've had a chance to test this, and while I have a few issues, this library is perfect!
Log in with your gamejolt account, and visit this page:
http://gamejolt.com/games/arcade/teting ... ces/48003/
and run the attached love!
Re: Lua GameJolt API [Highscore tables / achievements]
Posted: Fri Feb 06, 2015 3:46 am
by andmatand
Hmm I did those steps...am I supposed to get trophies? 'cause I didn't
Re: Lua GameJolt API [Highscore tables / achievements]
Posted: Fri Feb 06, 2015 3:59 am
by josefnpat
You will have to change the user token in main.lua of the .love, sorry to not mention that.
Re: Lua GameJolt API [Highscore tables / achievements]
Posted: Fri Feb 06, 2015 5:36 am
by andmatand
Ah, that explains it
Re: Lua GameJolt API [Highscore tables / achievements]
Posted: Fri Feb 06, 2015 12:15 pm
by ManInBlackSweater
Added bit-sized
wiki to help guys get started.
Re: Lua GameJolt API [Highscore tables / achievements]
Posted: Sat Feb 07, 2015 7:12 am
by Davidobot
I'm not too familiar with GameJolt. Do the games usually ask for the username and usertoken of a player for achievements, or are those somehow detected while downloading or something?
Re: Lua GameJolt API [Highscore tables / achievements]
Posted: Sat Feb 07, 2015 11:27 am
by ManInBlackSweater
Davidobot wrote:I'm not too familiar with GameJolt. Do the games usually ask for the username and usertoken of a player for achievements, or are those somehow detected while downloading or something?
GameJolt automatically passes username and token into Java, Silverlight, Flash and Unity apps.
Also there's a Quick Play that downloads your game and tries to pass user info into your game.
Let's see if we can catch this data in Lua.
Re: Lua GameJolt API [Highscore tables / achievements]
Posted: Sat Feb 07, 2015 11:48 pm
by Positive07
ManInBlackSweater wrote:
Also there's a Quick Play that downloads your game and tries to pass user info into your game.
Let's see if we can catch this data in Lua.
I got this to work, already made an Issue in the Issue Tracker with two solutions, anyway I'm posting it here too.
Solution one:
Get them in love.load
Code: Select all
love.load = function (args) --Note the args here, this are the aguments passed through the console
data = {}
GJ = require "gamejoltlua"
GJ.init("myid", "mykey")
for k,v in pairs(args) do
local a = v:match("^gjapi_(.*)")
if a then
key, value = a:match("^(.-)=(.-)$")
data[key] = value
end
end
GJ.authUser(data.username,data.token)
GJ.openSession()
end
Solution two:
Using the gjapi_credentials.txt file
Code: Select all
data = {}
GJ = require "gamejoltlua"
GJ.init("myid", "mykey")
local a = love.system.getOS() == "Windows" and "\\" or "/"
local f = io.open(love.filesystem.getWorkingDirectory()..a.."gjapi-credentials.txt")
if f then
data.username = f:read()
data.token = f:read()
end
GJ.authUser(data.username,data.token)
GJ.openSession()
The benefit of the second alternative is that you can call it from everywhere, while the first one needs to be in love.load
The second alternatives also let users connect to GameJolt API leaving a .txt file next to the executable (not sure if anyone wanted that feature, but it's there)