mtzvd's Recent Forum Activity

  • And .get(%path%) expression of JSON object just gets the value at given path of JSON https://www.construct.net/en/make-games/manuals/construct-3/plugin-reference/json

  • Well, what I do is I use .asJSON to save properties from Text object. And I get something like this

    {"c3":true,"w":{"x":93,"y":64,"w":200,"h":30,"l":919232524966002,"zi":0,"oX":0,"oY":0},"data":{"t":"Text","c":[0.39215686274509803,0,0,0],"fn":"Arial","ps":12,"bbc":true}}
    

    So I see that inside this JSON text object "data" contains property "c" which is array of 4 of numbers from 0 to 1. Which is r g b and alfa - font color of Text object. Then I parse text to JSON to get actual values inside JSON object. And I need to get following path to get array elements: data.c.0 data.c.1 data.c.2 . I use JSON.GET(%path%) for each of those paths and set color of newText object accordingly.

  • Sorry, mistake, like this yadi.sk/i/rbBsBU_Huxk3Zw

  • I do not konow if it is a proper way, but i did it like that yadi.sk/i/GHMCD6dmVp_G9w

  • Hi Ashley, thanks for the feedback.

    Just to check if I got you right:

    I just make, let's say, gtm.js script file, and in that file put the whole code into runOnStartup function?

    And it will do the job?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hello. Maybe "System -> Create object (by name)" could help?

  • Hi all! I'm completely new to Construct 3, but I want to share the way I've found today to add GTM container to my HTML 5 app without using 3d party addons.

    1. Locate your GTM code and copy this part from there

    (blurred part is your GTM ID)

    You will have something like this:

    (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataLayer','GTM-XXXXXXX');
    

    2. Go to layout which loads first and add global string variable. Put the code to it's initial value, make it constant and give some meaningful name, in my case it's "gtm":

    3. Add "Browser" object type to your project.

    4. Add event with "On start layout" system condition.

    5. Add action "Execute javascript" of "Browser" object. Input following string in "Javascript" input (replace "gtm" with the name of your variable):

    		 "var head = document.getElementsByTagName(""head"")[0];
    			var scriptTag = document.createElement(""script"");
    			scriptTag.innerHTML = "&gtm&";
    			head.appendChild(scriptTag);"
    

    6. You should have something like this:

    7. That's it, you should now have your GTM container in place (even in Preview mode).

    8. But it's not working if "Use worker" option in "Advanced" section of project properties is checked.

    Thank you.

mtzvd's avatar

mtzvd

Member since 13 Jan, 2020

None one is following mtzvd yet!

Trophy Case

  • 4-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

6/44
How to earn trophies