ramtinsoltani's Forum Posts

  • nyuszi008 I'm talking about scripting inside C3 and not the plugins SDK, and inside scripting you do have access to the runtime object both inside and outside of web workers (runtime object is passed to the runOnStartup() method).

  • Ashley Yes I forced it on and realistically I want it always on to benefit from the performance improvements.

    It would be a really useful feature if we could have forced a specific script to always run on the DOM side and have it act as a bridge for all the DOM-specific APIs that are not available inside web workers.

  • The fps difference was due to Battery saving mode! But the web worker is still off in both browsers.

  • It is supported on Safari 15.4.1 (reference: https://caniuse.com/webworkers). I've also tested it on Chrome and it's not running in a Web Worker.

    The other weird thing is that the game is running at 30 fps on Chrome and 60 fps on Safari (on the same phone, both not in a web worker).

  • Thank you nyuszi008. I'm going to install your plugin and try it out. Does it provide scripting API or is it only accessible through Event Sheets?

    Btw, I can't find any mentions to how to run scripts (JS) on the DOM side in the Scripting documentation. Enabling the worker mode basically is running all my code inside a web worker (including main.js).

    Aside from plugins, is there a way to exclude a certain script file from running in the web worker?

    CC: Ashley

  • I've set the Use worker project config to Yes and can confirm that the game runs in a web worker. However, when I use remote preview and run the game on my iPhone 11 (Safari, iOS 15.4.1), the game does not run in web worker any more.

    Any ideas why this is happening?

  • Hi there,

    I'm trying to copy some text inside the clipboard using the following method:

    	navigator.clipboard.writeText('some text')
    

    The above code does not work inside a web worker since the WorkerNavigator class does not provide Clipboard API.

    I'm also not sure if I can use the old method (document.execCommand('copy')) by creating a text input...

    Any ideas how I can achieve this while still keeping the project in a web worker?

  • Thank you for the detailed workaround. I appreciate the time you took to post your answer.

    And that's almost exactly what I did (except for the tags which I'm not using at all)! I'm changing the solid state using a family of objects + UID and state parameters of that function.

    Do you know what is the procedure for requesting a feature?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I can't find a way to set a Sprite's Solid behavior state (enabled on/off) from scripts.

    I had to create a helper function in an Event Sheet to set the Solid behavior state and call the function from the scripts whenever necessary, but this is not ideal since I'm doing everything else from scripts.

    Is this not currently supported or am I missing something? I can't find Solid under "Scripting Reference / Behavior Interfaces" nor did I find any methods for doing this on IObjectClass, IInstance, and ISpriteInstance.

  • 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?

  • 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?

  • 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? */);
    
  • Ashley Thanks for the details. There will be tons of triggering conditions in my plugin such as "on delegate invoked", "on function associated to delegate", etc. that are all recognized by one or two string names (function name and delegate name). I'll keep testing the flags to see what happens.

    Just for clarification, a delegate would hold multiple function references (names) and on action "invoke delegate", the specified delegate (by name) would call all its containing functions through "c2_callFunction".

    If used right, it could solve a lot of headaches with creating a customizable key mapping system.

  • rexrainbow I'm not sure if that's relevant to my question. What would doing that accomplish?

  • rexrainbow Why would the already documented 'cf_trigger' flag be incompatible?