0 Favourites

How do I get values using console

  • My question is:

    How I can get values using the Developer Tools (console)

    For example I can run Construct functions by entering the console:

    "c2_callFunction("Function Name", [array of params])"

    But is there is some kind of DOM system that let me enter and see the values of my spriter, texts...

    Their instance values and regular values...

    Examples of what I want:

    spriteName.instanceValue

    spriteName.height

    someText.text

    system.time

    and etc...

    Or is there other solutions to get values of things rather than console.

    We just want to make some automation testing without adding scripts to the games.

    Thank you.

  • Be sure to use the debugger and otherwise, use the Browser plugin's action "Log" to log whatever you want in the console.

  • Be sure to use the debugger and otherwise, use the Browser plugin's action "Log" to log whatever you want in the console.

    No, I need the other way around.

    Not the game telling me what the values are, but to be able to see the values inside the game from the browser.

    For example if I want to see the content of this forum comment, I would press F12 (on Crome) and look inside the elements of the DOM to find out that my comment containing:

    "[quote="Kyatric.... ....those values?" Or using console to get the element by its ID and geting the data. The same I want to do with my game, I know the names of the variables and etc, everything is happening on the client-side inside JavaScript, that mean that all I need is the API to get values from the construct2-canvas... Some body knows how I can get those values?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • From the web browser debug console you can type cr_getC2Runtime() to get a snapshot of the entire c2 runtime that you can browse. It doesn't have the object names so it's a bit trickier, but if you know the uid of the object you can get it with cr_getC2Runtime().objectsByUid[2] where 2 is the uid. It's probably more of a novelty that you can access everything that way if you locate where to look, in practice it's better to use C2's debugger.

  • From the web browser debug console you can type cr_getC2Runtime() to get a snapshot of the entire c2 runtime that you can browse. It doesn't have the object names so it's a bit trickier, but if you know the uid of the object you can get it with cr_getC2Runtime().objectsByUid[2] where 2 is the uid. It's probably more of a novelty that you can access everything that way if you locate where to look, in practice it's better to use C2's debugger.

    Thank you! That is exactly what I needed!!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)