Triggering condition - not working, no "this.running_layout"

For developers using the Construct 2 Javascript SDK

Post » Sun Jan 08, 2017 4:44 pm

I am working on my plugin and I'd like to trigger condition. I did everything as it was described and as I saw in examples, however it won't trigger my condition.

I decided to dig a bit deeper and to put a couple of console.logs into "preview.js -> Runtime.prototype.trigger" and discovered something: the "trigger" stops on
Code: Select all
if (!this.running_layout)

When my condition is triggered - this.running_layout equals to null!

OK, I trigger my trigger a second later. Now this.running_layout is not empty, but my trigger wasn't called anyway...

Here is the condition for edit:
Code: Select all
AddStringParam('Lazy section', 'The section you want to spot');
AddCondition(7, cf_trigger, 'Is lazy section loaded', 'HUD', 'Is lazy section <b>"{0}"</b> loaded', 'Check if this lazy section is loaded', 'IsLazySectionLoaded');

Then in Conditions I have this:
Code: Select all
Cnds.prototype.IsLazySectionLoaded = function(t){
  console.log('IsLazySectionLoaded('+t+')');
  return true;
};

- it never gets to this console.log. (notice that I have other conditions, regular, not triggering, and they all work)
Finally I do this somewhere:
Code: Select all
console.log('  => about to trigger...' );
var done = runtime.trigger(cr.plugins_.genericHUD.prototype.cnds.IsLazySectionLoaded, instance, sectionName);
console.log('triggering result: '+done);

Needless to say that runtime.trigger returns false...

What am I doing wrong? I also see no error messages, everything is resolved correctly, function "cr.plugins_.genericHUD.prototype.cnds.IsLazySectionLoaded" exists...
B
6
S
2
Posts: 30
Reputation: 540

Post » Mon Jan 09, 2017 11:43 am

It means nothing is running and you tried to run a trigger. I think this is possible if you try to run a trigger while the game is still loading, because the first layout hasn't started yet.
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,772


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests