Preview mode, Log to console?

For developers using the Construct 2 Javascript SDK

Post » Thu Mar 26, 2015 11:06 am

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

Code: Select all
// 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");
}


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. :)
B
21
S
13
G
8
Posts: 306
Reputation: 5,458

Post » Mon Mar 30, 2015 8:16 pm

hum, guy, if you just want to log some info, just use the "Log" action of the browser object ^^
http://armaldio.xyz

Join now the Discord C2server ;)
https://discord.gg/0eLPLj96B4tUr1D3

Check out this superb Plugin Manager

If you like my work you can donate some bucks ;)
Image
B
49
S
14
G
1
Posts: 237
Reputation: 4,889


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 1 guest