Object effects JavaScript API

0 favourites
  • 10 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi there.

    I'm trying to toggle two effects on an SVG Picture through scripting and can't find any references in the documentation.

    As an example, if I have an SVG Picture called Tile with the Grayscale and Tint effects, how would I toggle them in the following script:

    	runtime.objects.Tile
    	.getAllInstances()
    	.map(tile => tile/* How to access effects API? */);
    
  • I'm afraid it's not currently supported. If it's not covered in the reference section of the documentation, it's not there.

  • How about using a CallAction?

    Something like this (you may need to find the exact method name, but it's likely something like the below.)

    inst._sdkInst.CallAction(C3.Plugins.Sprite.Acts.SetEffectEnable, effectName,true)

  • Mikal - no such method exists in the scripting feature. I think you're confusing the addon SDK which uses different APIs.

    There is however runtime.callFunction() which may provide a convenient way to call in to the event system for other features.

  • Ah, you are right, I forgot this was the 'Scripting' forum :)

    The callFunction is a nice solution for the Scripting interface.

    [redacted discussion on using SDK in scripting.]

  • Ugh, that is an unmitigated disaster for compatibility. Please, please don't do that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley The runtime.callFunction() seems useful, though I was using a boolean instant variable and an event sheet to switch the effects, but it's still inconvenient as it leaks logic into event sheets since I'm trying to do all the logic with scripting and stay away from event sheets.

    Is there any plans to extend the JavaScript API to support effects control in the future?

  • Ashley I removed the discussion on SDK.

  • Ashley The runtime.callFunction() seems useful, though I was using a boolean instant variable and an event sheet to switch the effects, but it's still inconvenient as it leaks logic into event sheets since I'm trying to do all the logic with scripting and stay away from event sheets.

    Is there any plans to extend the JavaScript API to support effects control in the future?

    I'm also struggling to change the cursor type to hand through the scripts. Any ideas Ashley?

  • This doesn't seem related to this thread, you should start a new thread for new questions. But you can change the document's cursor CSS style, e.g.:

    document.documentElement.style.cursor = "pointer";
    
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)