PostToRuntime works, but subsequent Trigger not

0 favourites
  • 9 posts
From the Asset Store
Game Triggers is as versatile as a Swiss army knife, and will be a great resource for any type of game you're creating.
  • Ashley

    I found this post construct.net/en/forum/construct-3/plugin-sdk-10/posttoruntimehandler-data-157028 but can't necro it, so... new topic...

    I get my domSide.js to PostToRuntime, instance.js catch the message after adding the handler with AddDOMMessageHandler, the handler call back called, but the trigger is never... triggered...

    Code: github.com/AirConsole/airconsole-construct3/blob/1.8.0.0/plugin/c3runtime/instance.js

    Condition declaration is very basic and simple

    OnDisconnect() {
    		return true
    	}
    

    aces.json is declared

    			{
    				"id": "on-disconnect",
    				"c2id": 1,
    				"scriptName": "OnDisconnect",
    				"highlight": false,
    				"isTrigger": true,
    				"isInvertible": false
    			}

    The console throws no error but prints the "instance.js" `messaged` log

    The plugin has a test call so it fires by just adding the plugin to an empty project and previewing it.

    domSide.js line 78: github.com/AirConsole/airconsole-construct3/blob/1.8.0.0/plugin/c3runtime/domSide.js

  • I can't really get in to debugging people's addons for them, I hardly have time to do everything else as it is - but just glancing over this it looks like inst.conditions.OnDisconnect is the wrong way to refer to a condition so you're basically passing undefined to the Trigger method. Get used to using a JavaScript debugger and you should be able to find mistakes like this yourself.

  • I'm just following your guides on your documentation and your exemples..... So, yeah, that's how triggers are called based on your sdk. If I was passing undefined to the trigger, the console would throw an error, or you have an empty catch exception that doesn't return the error to the front. I get no message, I've been using Jetbrain's entire suite for over 15 years now, so I'm sorry to bother you, but either the SDK (which is not an SDK btw) or the documentation is lagging behind or missing parts

  • I'm sorry to bother you, but either the SDK (which is not an SDK btw) or the documentation is lagging behind or missing parts

    Construct 3's official Addon SDK documentation is definitely not a real documentation, it's more of a dictionary.

    In the early days, we used to inspect Construct 3 to know how to use them properly, which is also inconvenient due to the engine being obfuscated.

    Fortunately, there are already a lot of addons available now for learning material, you can just unpack them and see how it all works.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah, that's what I do too, download, unminify, deobfuscate and keep the sources private, which is the only way to have your IDE not whine about everything. And downloading others plugins to see how things are done. Yet, due to the "docs" not being real docs, you never know if it's a bug, you doing wrong, something you oversaw, and that's monkey job and countless hours spent by each and every new person here. I did AirConsole's C2 plugin and when C3 was still in early access, did the C3 one as well, using C2 runtimes, had to cry to get access to external api scripts without having to hot load them, hoping and praying the docs for the C3 runtimes would be something real.... Just to be recalled by NDreams AG to update the plugins, 5 years later, to find out it's not at all and that I have to monkey toy to even have access to the sources which an SDK should provide

  • The documentation demonstrates using Trigger() like this:

    this.Trigger(C3.Plugins.Sprite.Cnds.OnAnimFinished)

    Your code uses Trigger() incorrectly like this:

    inst.Trigger(inst.conditions.OnDisconnect)

    Conditions are not part of inst. I'm not sure where you got that from!

  • If you had read the code and the history, you would have seen that "inst" is "this"... And that's the only way I found to get the refs back to "this" as it's not defined when coming from a DOMMessage

  • But it's ok, we've had clashes together in the past, I know how things work here... I'm not a construct user anymore for those very reasons and I'm only here because I've been asked to update the AirConsole plugins, past that I won't bother you guys anymore

  • I'm... not sure you understand still?

    You wrote inst.Trigger(inst.conditions.OnDisconnect)

    You need to write inst.Trigger(C3.Plugins.AirConsole.Cnds.OnDisconnect)

    ...because the OnDisconnect method is at C3.Plugins.AirConsole.Cnds, not inst.conditions. I meant to say "I'm not sure where you got inst.conditions from", because I don't believe that appears anywhere in the SDK samples or documentation.

    Edit: oh right, I see that your code adds a inst.conditions property. This is why trying to debug other people's code is difficult and time consuming. It looks like a mistake because the SDK addon coding samples never use that style, but your own addon coding style does this. I'm sorry my advice was wrong. But this is why I normally try not to get in to debugging other people's addons! Even code this simple is easy to get tripped up on if it's not your own code, and it only gets harder with more code.

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