Jump to content

Game Maker Javascript Api Help


Phoenix Labs
 Share

Recommended Posts

Hello,

I recently was contacted by a sponsor and he asked if I can implement his api.  Here's the email he sent me:

 

We can try a test achievement, whenever you score 100 points call this:

 
 saveAch(5);
 
Include this in the html file

<script src="http://dombruno.com/m/api.js"></script>
A blue box should pop up when the function is called

Let me know how that works

Thank you for your time

I have no knowledge of javascript so I have no idea what I'm surpossed to do with this.

Any help would be much appreciated.

I'm using Game Maker by the way. 

Link to comment
Share on other sites

Well it sound straight: (still I never used Game Maker)

 

1. Include the api in your html file: <script src="http://dombruno.com/m/api.js"></script>

2. In your game find where score is updated and add something like this:

 

if(score > lastScoreCheck + 100) {

 lastScoreCheck = score;

saveAch(5);

}

 

also when game start set: lastScoreCheck = 0;

Link to comment
Share on other sites

I think you will have to download the .js file, and import it into GM as an extension.  You will have to manually create any functions that you use, and specify their return values.  It's really not that hard, here's a guide...

 

http://gmc.yoyogames.com/index.php?showtopic=520070

 

 

Considering what Rune wrote, you have to know that every js call made from GM:STUDIO need to be a function itself. So according with your sponsor, you need a function like This one : 

function send_score(argument0){  // argument0 is the gm variable for the scorevar score=argument0;var error_message="Score not sent"if (score!=undefined) {saveAch(5);} else {return error_message;}}

If you need other informations about GM  (i'm a experienced gm user) ask me without problems also with a pm

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...