Phoenix Labs Posted November 12, 2013 Share Posted November 12, 2013 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 calledLet me know how that worksThank you for your timeI 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. Quote Link to comment Share on other sites More sharing options...
Mike Posted November 12, 2013 Share Posted November 12, 2013 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; Quote Link to comment Share on other sites More sharing options...
Rune Posted November 12, 2013 Share Posted November 12, 2013 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 AhmedElyamani 1 Quote Link to comment Share on other sites More sharing options...
Bluevessel Games Posted November 12, 2013 Share Posted November 12, 2013 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 Quote Link to comment Share on other sites More sharing options...
Phoenix Labs Posted November 16, 2013 Author Share Posted November 16, 2013 Hello, sorry I just saw you post. This looks like it'll work thanks for the help I'll try this when I next get on the computer. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.