We're archiving the forums and going read only! You'll be able to see old threads, but new topics and replies have been disabled.

Visit the Game Jolt community for new questions and conversations.


Introduction

In this post I am going to explain how you can implement trophies and high scores into your games with GM.

If you are new to GM or the Game API at first glance it can look a little daunting right? Well I will show you the absolute basics for adding trophies and high scores so the code will be nice and simple. After you can have a play around and make it look fancier.

Preparing the API library

First download the latest version of the GM API library from the link below. This tutorial will be using thatbrod's Game API library.

Game Maker API Library

Once you have downloaded the latest version, unzip the folder and take a slight glance at its contents; it should contain the following items:

(In folder - "GameJolt API")

  • "Assets"(folder) - Needed

  • "Example"(.exe)

  • "GameJoltAPI v3.0"(.gmk)

(In folder - "Assets")

  • "constants"(.txt)

  • "functions"(.txt)

  • "Game Jolt API.gex"- Needed (If using extensions)

  • "GJAPILibary.gml"- Needed (If importing)

  • "http_dll_2_3.gex"- Needed (If using extensions)

  • "scripts"(.gmk)

Where I have put "Needed" those are the ones we will be using. For some of the files you may noticed I have put in backets, "If using extensions" and "If importing". This is because there are two ways of doing this next step.

Note: I suggest using the extensions for this next step, rather than importing all of the scripts into your game. However I will go through on how to do both.

Extension method

Here we will add the library using extensions. These will be the .GEX files . To do this open up Game Maker (I'm using GM 8.1 Standard).

Now go to "Resources" -> "Select Extension Packages". When done a dialog window should appear called "Extension Packages". In here left click "Install" then another dialog box should appear called "Installing Extension Packages". Click "Install" which then should bring up an open file dialog box, search and open the GameJolt API folder and locate "Game Jolt API.gex" in "Assets" click "Open" and it will be added to the list when you install it (do the same for "http_dll_2_3.gex"). When it has added the extensions, they should appear under "Installed Packages".

Importing method

(Skip this, if you have installed the GJ API extension)

To add the library by importing, go to "Scripts"-> "Import Scripts..." then locate the file "GJAPILibary.gml" and select then click "Open". This will add all the required scripts in the "Scripts" folder check it out now in your game, it will be in a folder called "GJAPI Library".

Adding the basics/implementation

First create a new object and name it GJ_controller to implement this stuff. Check the box "Persistent" between rooms as well.

In this object add a Create event and add the following line of code:

		
			GJ_begin(real gameID, string "Key");
		
	

Where I have put gameID replace that with the ID of your game, which can be identified by going to Game Jolt -> Dashboard -> Your Games. Find your game and click Game API then API Settings. You should see the following screen:

5d099e6fba18e.png

Then replace "Key" with the Private key on the same. Below is an example:

		
			 GJ_begin(80640, "381e2309cf82106f3a1d67cbbfecbdc6");
		
	

Now in the Step event of the same object execute the following line of code...

		
			GJ_step();
		
	

Place this object in the first room of your game.

This is simple right? Well then you will find the next bits just as simple and easy, I will break it down as much as possible.

Now this will begin the GJ API, now we need to get users to login to your game, this is the simplest method of doing this. Now this can be triggered by using a key press of some kind such as L so add a key press event preferable L key. But before we add anything to the Create event and execute the following.

		
			inputUserName = "";
inputToken = "";
		
	

"L" key event

		
			keyboard_string = "";
inputUserName = "";
inputToken = "";

keyboard_string = inputUserName;
keyboard_string = inputToken;

// input username and token
if (!GJ_isLoggedIn())
 {
    inputUserName = get_string("Please enter your username","");
    inputToken = get_string("Please enter your token","");
}

// check username and token, login if correct
switch(GJ_login(inputUserName, inputToken)) 
{
    case GJ_STATUS_OK:
        GJ_fetch_userKeys(true);
        GJ_fetch_trophies(true);
        show_message("Login successful!");
        break;
    case GJ_STATUS_REQUEST_FAILED: case GJ_STATUS_INVALID_INPUT:
        show_message("Login failed!");
        break;
    case GJ_STATUS_INVALID_CALL:
        show_message("You are logged in, press the o key to log out");
        break;
}
		
	

The above code prompts the user to enter their token and username if the credentials provided are correct it logs in the user. If the above makes sense to you can change small portions to personalize the text . You can now test this, by running the game and pressing the L key when the game starts.

Now you should also give the user the option to logout too, so in the O key press event, or whatever key you think would be best to trigger this, add and execute the following code.

		
			//logout
if(GJ_isLoggedIn())
{
    GJ_logout();
    show_message("Log out successful!");
}
else
{
    show_message("You are logged out");
}
		
	

Adding trophies

Now here is the bit we have been waiting for, trophies!!! If you haven't done the previous section make sure you do it else this will not work.

This section will always be different for you because your game is different and achievements will be obtained in different ways, so this part is up to you. But this is what you do to add a trophy.

To get the trophy ID go to Dashboard -> Your Games -> Game API -> Trophies then copy the trophy ID you want to be achieved. Below is an image showing this:

5d099e723f304.png

Since all games are different I will add an example , it is up to you to decide when the trophy is achieved. Trophies are achieved using GJ_store_trophyEarned(boolean now?, real ID);

The following script will just achieve the trophy once run.

		
			if (GJ_isLoggedIn() && !GJ_trophy_isAchieved(ID))
{
     GJ_store_trophyEarned(true, 3464);
}
		
	

Let me explain the above. The code is saying, if the user is logged in and the is not achieved yet, then achieve it; which is done in the line "GJ_store_trophyEarned(now?, ID);". Make sure you change where it says "ID" to the actual ID of your trophy you want them to achieve.

Here is an example to show this below to help you out further.

in obj_player step event

		
			If (global.playerscore > 100)
{
    if (GJ_isLoggedIn() && !GJ_trophy_isAchieved(7675))
    {
        GJ_store_trophyEarned(true, 7675);
    }
}
		
	

High scores

Now finally for the high scores, which is even more simple than adding trophies, you will be very pleased to know.

Now again like trophies achieving high scores will depend on when you want the player to achieve it in your game; so I will just add the code you need to do this.

		
			GJ_store_score(now?,tableid,scorestr,sortvalue,extradata);
		
	

Now let me explain and talk you through what you must change. where it says "now?" change it to true, then enter the ID of the high score table, which can be found in Dashboard -> Your Games -> Game API -> Scores (if you only have one table set the value to 0 for the primary table) where it says "scorestr" add the variable you are storing the score in, then for same variable for "sortvalue" and finally for extra data enter a string of your choice (if you don't wish to put anything just put a 0 as a value).**

Below is an example to help explain this.

		
			GJ_store_score(true,0, global.playerscore,global.playerscore,0);
		
	

Using strings in highscores

Note: This section is not requried to get scores working.

The above will display the score value in the table , so for instance if the score is at 10 it will just display the number 10. However you may wish to have something added to the end so for instance instead of just 10 you may want "10 Points".

One way you can do this is as followed. First create a new variable above the GJ_store_score() function and give it a suitable name; the variable will hold your chosen score string, below is an example of this. Make sure once you have declared the variable to assign a value to it in this example I have used the value "Clicks!". (The below does not have to be global)

		
			var global.score_string = "Clicks!"; 
		
	

Then create another variable to store both the score and the string.

		
			var display_score;
		
	

Now write the following, replacing my score variable and my string also stored in a variable, called "global.score_string"; the score is called "global.clicks" in this example.

		
			display_score = string(global.clicks) + " " + string(global.score_string);
		
	

All we are doing is concatenating the two variables together and converting the score variable (currently a real number) into a string value. This is done with string()

Now all you do is use this variable in the GJ_store_score() function, at the "scorestr" parameter. Use the below example to help you.

		
			GJ_store_score(true,0,display_score,global.clicks,0);**
		
	

Now if you test it the score should display with a string and not just a single score value.

Guest scoring

We have already looked at storing scores for registered users, but it is often a good idea to allow guests to highscore in the leaderboards. This section is not much of a requirement so you can skip this section if you wish.

First of all you need to enable guest scoring in the leaderboard you wish to do this. So go to your Dashboard -> Your Games -> Game API -> Scores. Then select the leaderboard you wish to enable this and find "Guest Scoring?" and from the drop down select Enabled. Then remember to click the "Edit Settings" button to confirm.

Now in your game find the section of code where you are storing highscores. To add guest highscores you must write the following.

		
			GJ_store_guestScore(now?,TableID,guestname,scorestr,sortvalue,extradata);
		
	

This is very similar to the GJ_store_score() function we used earlier so most of the arguments are the same, with a few additional ones. below is an example to help you:

		
			GJ_store_guestScore(true,0,global.guest_name,global.display_score,global.score,0);
		
	

I will talk about getting the guest name after I show an example of how you use the above.

		
			if(GJ_isLoggedIn()) //if the user is logged in, then store the score as usual  
{
    GJ_fetch_tableScores(true,0,global.score);
    GJ_store_score(true,0,global.display_score,global.score,0);  
}
else //otherwise store the score as a guest score
{
    GJ_fetch_tableScores(true,0,global.score);
    GJ_store_guestScore(true,0,global.guest_name,global.display_score,global.score,0);  
}
		
	

I will now talk about a way to get the name of your guest user. You could just enter a string such as "Player" but it's better to get the name of the person playing so they are not completely anonymous. First of all look at the example above where I have put "global.guest_name" that is the variable that stores the guest name. To get the guest name find the object where you got the login details which we did in the earlier section of this topic, then in the create event drop set a new variable and give it a sensible name such as Guest_name make sure it is global; so it would be global.guestname. Then set the value to "" and click ok. Now find the code where it checks for login details and update it to match the following.

		
			keyboard_string = "";
inputUserName = "";  
inputToken = "";

keyboard_string = inputUserName; 
keyboard_string = inputToken;

keyboard_string = global.guest_name /*change global.guest_name to your variable that stores the guest name string */

if (show_message_ext("Login to GameJolt?","Yes","No","") == 1)  
{
    // input username and token
    if (!GJ_isLoggedIn())
    {
        inputUserName = get_string("Please enter your username","");
        inputToken = get_string("Please enter your token","");
    }

    // check username and token, login if correct
    switch(GJ_login(inputUserName, inputToken))
    {
        case GJ_STATUS_OK:
            GJ_fetch_userKeys(true);
            GJ_fetch_trophies(true);
            show_message("Login successful!");
            break;
        case GJ_STATUS_REQUEST_FAILED: case GJ_STATUS_INVALID_INPUT:
            show_message("Login failed!");
            break;
        case GJ_STATUS_INVALID_CALL:
            show_message("You are logged in, press the o key to log out");
            break;
    }
}
else
{
    global.guest_name = get_string("Name of guest?","");
}
		
	

So now that guest name is stored in a variable you can show the value in the GJ_store_guestScore() function.

Loading scores from highscore tables

If you want to load scores into a game, the enter the following lines of code.

		
			Var GJScoreAmount, TableID;
GJScoreAmount = 10; // Get the number of scores you want to load
TableID = 0; //table ID

GJ_fetch_tables(now?) //call this first
GJ_fetch_tableScores(now?,tableID,count);
		
	

All you must do is replace Now? (for both GJ_fetch_tables() & GJ_fetch_tableScores()) to true as you done before and change tableID to variable TableID that stores the ID if your table and count to the variable GJScoreAmount.

Below is an example to help you out further if you are stuck.

		
			var GJScoreAmount, TableID;
GJScoreAmount = 10; //get the number of scores you want to load
TableID = 8987; //table ID
GJ_fetch_tables(true) //call first and only once
GJ_fetch_tableScores(true,TableID,GJScoreAmount);
		
	

Drawing loaded scores

In the previous section of this guide I went through how to fetch highscores into your game. Once you have loaded the data from the leaderboards into your game you are able to draw it in your game.

First of all I would create another object and give it a sensible name such as draw_highscores.

Then in the draw event execute this code as follows:

		
			var i, j, tbID, placeNum, placeString, userScore, tableSize, userName, guestName;
tbID = 0;
tableSize = GJ_table_size(tbID);

for(placeNum = 0; placeNum < 10; placeNum+=1)
{
    if(placeNum < 9)
        placeString = "0" + string(placeNum + 1);
    else
        placeString = string(placeNum + 1);

    draw_set_color(c_black);
    draw_text(38,20 + placeNum*20,placeString);

    for(i = 0; i <= tableSize; i+=1)
    {
        userScore = GJ_tableScore_getScoreName(tbID,i);
        userName = GJ_tableScore_getUserName(tbID,i);
        guestName = GJ_tableScore_getGuestName(tbID,i);

        if(GJ_tableScore_isGuestScore(tbID,i))
            draw_set_color(c_gray);
        else if (GJ_tableScore_isUserScore(tbID,i))
            draw_set_color(c_green);

        if(i != 0) {
            draw_text(110, 0 + i *20, userScore);
            draw_text(200, 0 + i *20, userName);
            draw_text(200, 0 + i *20, guestName);
        }
    }
}
		
	

Quite a bit to write so allow me to break it down.

First we called the function below, and stored it in a variable. This function gets the size of the table, which only takes one argument. So the argument tbID must contain the table ID you wish to get the information from. So just before we call this function make sure you assign tbID with the correct value (remember 0 is the default table).

		
			tableSize = GJ_table_size(tbID);
		
	

The next important part is the snippet of code below. What you should change here is this part placeNum < 10. This is because you might want to draw a different number of scores, so for instance you may wish to draw 20 so you would change the value to this. Note: the maximum is 100.

		
			for(placeNum = 0; placeNum < 10; placeNum+=1)
		
	

Now the code below writes the place number in a sequence of 01, 02 etc. When the place number is larger than 10 the 0 is not included, to prevent it being wrote as 050 for instance. You can remove this code altogether if you wish.

		
			if(placeNum < 9) // Draw scores as 01, 02, 03 etc before 10, to prevent being printed as 010
{
    placeString = "0" + string(placeNum + 1);
}
else
{
    placeString = string(placeNum + 1);
}
		
	

Then we draw the place numbering, which will appear as 01, 02, 03 etc. The snippet below draws this, all you must change is the x,y position of the text to suit your needs.

		
			draw_text(38,20 + placeNum*20,placeString);
		
	

After this we come across another loop which draws the score strings by calling the score getter functions.

		
			userScore = GJ_tableScore_getScoreName(tbID,i);
userName = GJ_tableScore_getUserName(tbID,i);
guestName = GJ_tableScore_getGuestName(tbID,i);
		
	

Using the variables that we declared aat the start, we stored the needed getter functions into each of them. GJ_tableScore_getScoreName(tableID,rank), GJ_tableScore_getUserName(tableID,rank) and GJ_tableScore_getGuestName(tableID,rank) are the 3 getter functions we used., and of course there are more.

Then the next part was to test whether the score was achieved by a user or guest. Two functions are used to test this which are as followed GJ_tableScore_isGuestScore(tableID,rank) and GJ_tableScore_isUserScore(tableID,rank). You can do anything you like with this part or you don't even have to include it, in order for this to work.

		
			if(GJ_tableScore_isGuestScore(tbID,i))
{
    draw_set_color(c_gray);
}
else if (GJ_tableScore_isUserScore(tbID,i))
{
    draw_set_color(c_green); 
}
		
	

And finally all we do is draw the scores, the only thing you really need to change here is the x, y position of the text.

		
			if(i != 0) {
    draw_text(110, 0 + i *20, userScore);
    draw_text(200, 0 + i *20, userName);
    draw_text(200, 0 + i *20, guestName);
}
		
	

Once you have drawn all the data, you just place the object in the room in which you want the data to appear in. Then you format the information drawn to look however you please.

Conclusion

I hope this guide helped you implement GJ achievements into your games and hopefully you didn't find any of this too difficult at all. Some things may need to be added or improved in future which should be noted here. If you have any further questions or have spotted something I missed, then please let me know and I will get straight to it.

Good luck to you and good day!


Page 1 of 103 replies.

almost 12 years ago

Very Nice work.

Can you please add how to draw the top 10 scores from a leaderboard?

almost 12 years ago

Hey thanks and do you mean within your game? Well I guess that could be something to add, I will take that onboard then :)

almost 12 years ago

..hmm,what if i've made a lot of highscore table?? how would i place them to their specific table?

almost 12 years ago

Hey, great job with this topic

I'll help clear up some of the confusion.

First: I'd go against using GJ_login() several times, it will attempt to log you in everytime so if it messes up it'll mess up 3 times in a row, for example. Instead, try something like this:

switch(GJ_login(inputUserName, inputToken))
**{
case GJ_STATUS_OK:
show_message("success!");
break;

		
			case GJ_STATUS_REQUEST_FAILED:  
		
	

show_message("invalid login! try again!");
break;

case GJ_STATUS_INVALID_CALL:
show_message("you're already logged in, silly!");
** break;
}

Second: You don't need to import the scripts if you're using the extension! The extension has all the scripts in it already, and they're only there for people who don't like using extensions.

Third: For storing into different highscore tables, you can do that by using a different ID. In order to place it into a specific table, just replace "0" with the ID of that table. All "0" means is "default to primary table." For example:

var TABLEID;
TABLEID = 9999; // ID of your table. You can find table IDs in the highscore page of your game's dashboard!
GJ_store_score(true,TABLEID,global.playerscore,global.playerscore,0);****

Fourth: To download top 10 scores, you're gonna wanna use GJ_fetch_tableScores()!
But before you can use that, you'll have to download the table information using GJ_fetch_tables(), so your code should look something like this:

var TABLEID, AMOUNTOFSCORES;
TABLEID = 0; // Primary table
AMOUNTOFSCORES = 10; // I want 10 scores!
GJ_fetch_tables(true); // Please note that this only needs to be called ONCE per game!!!!
GJ_fetch_tableScores(true, TABLEID, AMOUNTOFSCORES);

Last modified on October 2, 2013 by brianrodri @brianrodri

almost 12 years ago

@thatbrod

Hey thank you for your reply and feedback on this! And yes I will take the things you said and edit the post to implement them in. Reply again if you spot anything that needs changing/adding or made clearer, I wrote this in a short space of time so some things need tweaking. I just hope this come useful to someone in the future.

almost 12 years ago

Just done a few updates on this. I've added new sections ,especially to the high score part, and just made it a little easier to read by adding a few extra headings. If there is anything I have missed or you have any suggestions I would like to hear them.

over 11 years ago

Do you think you can make a tutorial for Game Maker studio?

Also, Im still a little confused with drawing the leaderboards In-Game.

can anyone help?

Last modified on November 29, 2013 by Ji_Rath @Ji_Rath

over 11 years ago

There's a thread next to this one with the GMS scripts. Easy to use. Doesn't require any external programs or DLLs.

over 11 years ago

@crazehboy709 I'm sorry but I've never used GM Studio before, but if it would be useful to people such as yourself who's having trouble implementing the GJ API then yes I wil look into it for you. Then I will notify you when I have put a tutorial/guide together.

Last modified on November 29, 2013 by Dr. Bowen @ttbowen

over 11 years ago

@Bowenware games

Ok

I edited my last comment but incase if you didnt see it, iim having trouble with the leaderboard and drawing it in-game.

#emotions_dlg.tongue}" title="{#emotions_dlg.tongue}" />

over 11 years ago

@crazehboy709 Like I said I haven't used GM Studio before but I will try and create another tutorial for this. Anyway cya around

over 11 years ago

No, Im not using GM studio, it was just a question because i have 8.1 and studio

I was asking if you could help with the code you gave me (Im making a game with gamemaker 8.1)

Last modified on November 29, 2013 by Ji_Rath @Ji_Rath

over 11 years ago

@crazehboy709 Okay so I guess you need help drawing the leaderboard scores in game, is that right? Yeah I guess I could expand on that part, also if you having trouble with any of the other sections then give me more details about the problem and upload the code as well.

over 11 years ago

@Bowenware games

Alright, thanks

antoher thing that you should add is auto logging in for quick play

Thanks for making this article, I would have givin up on linking GameJolt to my game if it wasn't for this article

Last modified on November 30, 2013 by Ji_Rath @Ji_Rath

over 11 years ago

@crazehboy709 No problem and I will look into that also, although I had a problem when trying to implement that feature in my game. But I didn't look into it properly, so I will do that and add a section on it

cya around!

over 11 years ago

..Thanks a lot! yow!

over 11 years ago

@sheigeno

You're quite welcome

Last modified on December 22, 2013 by Dr. Bowen @ttbowen

over 11 years ago

Does this not work in Game Maker Studio?

I just keep getting loads of errors, or the game does not load at all.

over 11 years ago

@Imrie

The answer is no this will not work in GM studio, as this libary was wrote for previous versions of GM. The one you want is found in the link below.

http://gamejolt.com/community/forums/topics/gamemaker-studio-library-beta/1431/

over 11 years ago

Another update to this topic, now there is a section on drawing highscores within your game. If you have any questions on this or if you have any requests for this topic, please contact me using this post.

over 11 years ago

@Bowenware games

AWESOME! The thing I have finally been waiting for!

I can now continue my game! lol

over 11 years ago

@crazeh_boy709

Yes thankyou so much for your patience I know I took a while on this, I kind of got caught up on other things, then having to look through the functions as well, and seeing how to use them properly; as I have never used them before myself. Hope it helps!

over 11 years ago

@Bowenwaregames

Alright, I got ONE (maybe more

) more suggestion for you to try.

Drawing Trophies In-Game + The picture if its possible

It would really help my game so insted of refreshing the gamejolt page and looking at the achievements you got, you can just click a button and all the ones you have earned, will appear!

One more thing, is there any specific time where you plan to help with Gamejolt api and GM Studio?

Thanks in advance!

over 11 years ago

@crazeh_boy709

I'll see what I can do, as I think that would be a good idea also. I'll let you know here when i've updated on this.

Also no there isn't any specific time I will write a tutorial on GM studio, mainly because I haven't used it before. But if I get time, I will look into it and write a tutorial on it.

over 11 years ago

Hi all, if you are currently using GM: Studio then you might be intrested in this tutorial. Yes I have now done a new tutorial on adding achievements with GM: Studio!

I would appreciate your feedback and helping me make this tutorial even better, so please feel free to ask questions and give me feedback.

http://gamejolt.com/community/forums/topics/gm-studio-adding-achievements-complete-beginners-guide/2935/#post-24990

Last modified on February 16, 2014 by Dr. Bowen @ttbowen

over 11 years ago

Hi Bowenware, i told you earlier the achievements work, well they did for me however i don't think anyone who plays is getting them.

Can someone try and this is not a shameless plug, play both these games and get a score of 2 and tell me if you unlocked them thanks this will help make sure its working and with the development of this tutorial.

http://gamejolt.com/games/arcade/the-flappy-bird/22633/#show-notifications

http://gamejolt.com/games/other/flapping/22443/#show-notifications

both flappy bird games should take a few seconds to do thanks.

about 11 years ago

When I attempt to launch it, I get this error:


COMPILATION ERROR in extension package Game Jolt API

Error in code at line 1:

var dataString, trophyID, difficulty, data, trophyMap, curLineEnd, handle, newLine;dataString = argument0;newLine = chr(13)+chr(10);if (string_length(dataString)){ curLineEnd = string_pos(newLine, dataString) + 1; trophyID = real(string_copy(dataString, 5, curLineEnd - 7)); dataString = string_delete(dataString, 1, curLineEnd); if (ds_map_exists(_GJ_trophyMaps, trophyID)) { curLineEnd = string_pos(newLine, dataString); dataString = string_delete(dataString, 1, curLineEnd + 1); curLineEnd = string_pos(newLine, dataString); dataString = string_delete(dataString, 1, curLineEnd + 1); curLineEnd = string_pos(newLine, dataString); dataString = string_delete(dataString, 1, curLineEnd + 1); curLineEnd = string_pos(newLine, dataString); dataString = string_delete(dataString, 1, curLineEnd + 1); curLineEnd = string_pos(newLine, dataString); if (!curLineEnd) curLineEnd = string_length(dataString); dataString = string_delete(dataString, 1, curLineEnd + 1); } else { trophyMap = ds_map_create(); ds_map_add(_GJ_trophyMaps, trophyID, trophyMap); ds_map_add(trophyMap, "image", noone); curLineEnd = string_pos(newLine, dataString) + 1; data = string_copy(dataString, 8, curLineEnd - 10); dataString = string_delete(dataString, 1, curLineEnd); ds_map_add(trophyMap, "title", data); curLineEnd = string_pos(newLine, dataString) + 1; data = string_copy(dataString, 14, curLineEnd - 16); dataString = string_delete(dataString, 1, curLineEnd); ds_map_add(trophyMap, "description", data); curLineEnd = string_pos(newLine, dataString) + 1; data = string_copy(dataString, 13, curLineEnd - 15); dataString = string_delete(dataString, 1, curLineEnd); switch (data) { case "Bronze": difficulty = 0; break; case "Silver": difficulty = 1; break; case "Gold": difficulty = 2; break; case "Platinum": difficulty = 3; break; } ds_map_add(trophyMap, "difficulty", difficulty); curLineEnd = string_pos(newLine, dataString) + 1; data = string_copy(dataString, 12, curLineEnd - 14); dataString = string_delete(dataString, 1, curLineEnd); handle = httprequest_create(); httprequest_connect(handle, data, false); ds_list_add(_GJ_apiHTTP_requests, 4); ds_list_add(_GJ_apiHTTP_requests, 61); ds_list_add(_GJ_apiHTTP_requests, handle); ds_list_add(_GJ_apiHTTP_requests, trophyID); curLineEnd = string_pos(newLine, dataString); if (!curLineEnd) curLineEnd = string_length(dataString); data = string_copy(dataString, 11, curLineEnd - 12); dataString = string_delete(dataString, 1, curLineEnd + 1); ds_map_add(trophyMap, "isAchieved", (data != "false")); ds_map_add(trophyMap, "timeAchieved", data); } GJ_make_trophyMap(dataString);}

		
			                                  ^
		
	

at position 37: Variable name expected.

about 11 years ago

This seems like an actual error in the extension itself. So the question stands, what version of GM are you using? And what have you got so far?

Also sorry for the slightly late reply, the GJ notification system failed to notify me about the new post which may be a temporary issue with the site.

Last modified on July 7, 2014 by Dr. Bowen @ttbowen

about 11 years ago

Great but, can i put it in a game maker 8.0 pro game? I think this is for studio html5 games, so if you could tell me which version of game maker works with it I will be really happy.

And Thanks.

Edit: I readed your post about this API is for older game maker editions not studio, thanks!

-Nexusrex

Last modified on August 4, 2014 by Nexusrex Games @Nexusrex

almost 11 years ago

the variable name expected is one i had a few time, most of the time, i think it mean that sopemthing i nyour game (sprite or object) is using the same name as a variable in the package (if my guess is right it might be data)