Preview mode, Log to console?

0 favourites
  • 2 posts
From the Asset Store
Small pixel icons for the 3 most popular controller types.
  • (edit: just realize that "ran" variable was declared just above the if statement, and added it in.)

    I just found a block of code in the Function object's runtime that seems to log info to the browser's(?) console when the game is in preview mode.

    // Note: executing fast trigger path based on fs.name
    var ran = this.runtime.trigger(cr.plugins_.Function.prototype.cnds.OnFunction, this, fs.name);
    
    // In preview mode, log to the console if nothing was triggered
    if (isInPreview && !ran)
    {
    	log("[Construct 2] Function object: called function '" + name_ + "', but no event was triggered. Is the function call spelt incorrectly or no longer used?", "warn");
    }[/code:3owxtq4i]
    
    What do "isInPreview" and "!ran" represent here? I have a guess, but I haven't come across "isInPreview" in the SDK documentation, though I might have just missed them.
    
    Is this method of logging safe to implement as a third-party plugin developer, or is it a special case thing. 
    Any weird pitfalls to be aware of? 
    
    Just curious. Thanks.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hum, guy, if you just want to log some info, just use the "Log" action of the browser object ^^

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