Ashley's Forum Posts

  • Here is my usage case - I have a dialogue system based on JSON files. These dialogues may call various functions with variable number of parameters:

    Construct does something similar when reading project files: depending on strings in the JSON, it calls different functions. For that we use function maps. Otherwise you end up encoding function names in the data format, which causes the maintenance problems I was talking about: you can never rename any functions without breaking compatibility with all your existing data files.

    I guess you can use the scripting feature if you want to anyway - after all part of the reason it's there is for more advanced use cases like processing complex JSON data structures. It's just if someone prefers to use event sheets and wants to call a function by a string, then I think the first suggestion should be to use function maps. Alternatively for small cases you can use other simple solutions like a string parameter and if-else-if style sub-events doing something different depending on the parameter. Only then if these solutions don't meet the demands of the particular use case would it then be appropriate to talk about scripting. There's no need to use a sledgehammer to crack a nut, as they say.

  • See the guide Exporting to Windows with the WebView2 wrapper. tl;dr - run WindowsIconUpdater.exe.

  • But this is the Scripting section, lol

    But I think they're only here because they read advice elsewhere to use scripting instead of function maps in the event sheet:

    i found this topic where the answer was given which says to use scripting.

    I'm afraid I still don't understand the example you gave afterwards either. I don't see that it is using calling functions by a string variable at all. They just all look like ordinary function calls.

  • Aside from the calling of maps/strings, which is already puzzling, have you considered how strange and limited the forwarding of parameters is?

    I don't understand the point. If you call a function by a variable string, you have to provide the same parameters regardless of the string provided, right? Function maps are no different in that regard.

    I don't think the poll proves anything. It could just mean most people don't have a need for calling a function by a string.

    In Construct's own codebase we use the function maps pattern in several places as it's useful, and one of our goals with event sheets is to design things in a way that mimics how programming languages work. While JavaScript does allow calling a function by a string of its name, it causes maintenance headaches, so we tend to use a Map with string keys and function values - the same approach as used with function maps.

    I think questions like "How do I call a function by name in an event sheet?" are best answered by "Function maps". Otherwise you are telling someone to ignore an existing event sheet feature and use JavaScript coding instead - which is ignoring the preference of the user if they want to stick to event sheets, and was a prospect a lot of people were worried about when we first introduced the JavaScript coding feature - so let's try not to fall in to that trap!

  • Function maps are pretty simple. I think people are overreacting. It's pretty much "map function to string", which assigns a string to a function so you can then refer to it by that string. Then you can have different maps with different names, and "call mapped function" calls a function by its assigned string.

    It also has the advantage of separating the string from the function name. With calling directly by a string of the name, if you rename the function, you break your events. So it's a brittle setup. With function maps, you can rename a function and everything still works.

    The existing "Function maps" example shows it pretty much in full. There's not much else to cover.

  • It's difficult to help without more details. If you run in to a problem please file an issue following all the guidelines, so we have enough information to investigate.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Are you aware that you can put data storage plugins like Array, Dictionary and JSON in to a container and get per-instance storage? That feature is aimed at covering exactly this, for more advanced per-instance data storage.

  • Look in Chrome's dev tools and you'll see the elements Construct is creating are actually <input type="button"> elements, not <button> elements. So the selector button won't match them. Instead try a selector like input[type="button"].

  • Please file an issue with all these details. Issues not filed to our tracker are easily lost and forgotten.

  • From what you've said, it should work. It's hard to say more without seeing your project file though.

  • Construct remains primarily a 2D engine and so things like collisions continue to work in 2D. You can add logic to "fake" 3D collision detection such as in the First-person platformer example, but Construct is not a full 3D engine, it's a 2D engine with a few 3D features that you can use creatively.

  • If you want to use an external text editor, save the project to a folder, and then you can edit individual files separately.

  • Please file an issue following all the guidelines. It's difficult to help if you miss out required details, like the system info which tells us about your system and software details.

  • Please note suggestions in replies to this thread will not be considered. See the original post for details on posting suggestions.

  • I meant that if they already have the tech to run an HTML5 game in browser, they should(?) be able to run it native?

    Yes, the tech is all there - but they need to add support for running HTML5 games inside console apps so they can be distributed through the stores.