HTML5 Execute javascript code

V

Vialgames_com

Guest
Hi,

I've finished developing my first game in GMS2, it's a Free HTML5 game.

I'd like to show one typical interstitial ad every time a level is finished. I think on create an object and in the Room End event execute this JavaScript code provided by my Advertising Network:

The JavaScript code looks like this:

<script src="url to AD network provider"></script>

Final target is that this will show an interstitial ad just when room (level) will be finished before to load new room with score information.

How is the best way to include/insert/execute this code in my GMS2 HTML5 game ?

Thank you in advance,

Charles
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
The JavaScript code looks like this:

<script src="url to AD network provider"></script>
That's HTML rather than JavaScript. This would go into a custom index.html template (see manual)

How is the best way to include/insert/execute this code in my GMS2 HTML5 game ?
Create a blank extension, add a JS file to it, write the desired JS code inside (having game-accessible functions as function some_func(...) ... or window.some_func = function(...) ...), then set up references to those functions via IDE, and that should be it.
 
V

Vialgames_com

Guest
Thank you very much. Ok, I'll try to write this in a function and call it in GMS2 from dnd or by code
 
Top