Jump to content

Need help adding a non-conventional JS extension for GM.


Ivatrix
 Share

Recommended Posts

Hi I'm looking to add javascript functions to game maker for an API, but the format of them is like this:

companyname.initialize({soundMuteCallback: muteSound, // optionalsoundUnmuteCallback: unmuteSound // optional});

And in the file they look like this

this.initialize = function(params) {companyname.getSharedEventCenter().postEvent(SharedEventKeys.API_INITIALIZE);_isInitialized = true;if (typeof params !== "undefined") {var muteSoundCallback = ("soundMuteCallback" in params && typeof params["soundMuteCallback"] === "function") ? params["soundMuteCallback"] : undefined;var unmuteSoundCallback = ("soundUnmuteCallback" in params && typeof params["soundUnmuteCallback"] === "function") ? params["soundUnmuteCallback"] : undefined;_adsManager.setSoundCallbacks(function() {typeof muteSoundCallback === "function" && muteSoundCallback();[].forEach.call(document.getElementsByTagName("audio"), function(element){element.muted = true;});}, function() {typeof unmuteSoundCallback === "function" && unmuteSoundCallback();[].forEach.call(document.getElementsByTagName("audio"), function(element){element.muted = false;});});}_tryShowAd();};

Does anyone have any idea how to do this in game maker? I don't know what information to put in the extension function properties.

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...